From d82a443460fd59e0988dd4d67a986df2f08c9aa0 Mon Sep 17 00:00:00 2001 From: Maroon Ayoub Date: Sun, 18 May 2025 02:38:10 +0300 Subject: [PATCH 1/3] add image-build on merge github workflow --- .github/workflows/ci-merge.yaml | 51 +++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/ci-merge.yaml diff --git a/.github/workflows/ci-merge.yaml b/.github/workflows/ci-merge.yaml new file mode 100644 index 000000000..b5dbf8e35 --- /dev/null +++ b/.github/workflows/ci-merge.yaml @@ -0,0 +1,51 @@ +name: CI - Merge - Docker Container Image + +on: + push: + branches: + - dev + - main + pull_request: # temporary trigger for testing in PRs + branches: + - dev + - main + +jobs: + docker-build-and-push: + runs-on: ubuntu-latest + steps: + - name: Checkout source + uses: actions/checkout@v4 + + - name: Load version information + id: version + run: | + VERSION_FILE=".version.json" + dev_version=$(jq -r '.["dev-version"]' "$VERSION_FILE") + dev_registry=$(jq -r '.["dev-registry"]' "$VERSION_FILE") + prod_version=$(jq -r '.["prod-version"]' "$VERSION_FILE") + prod_registry=$(jq -r '.["prod-registry"]' "$VERSION_FILE") + if [[ "${GITHUB_REF_NAME}" == "dev" ]]; then + echo "tag=$dev_version" >> "$GITHUB_OUTPUT" + echo "registry=$dev_registry" >> "$GITHUB_OUTPUT" + elif [[ "${GITHUB_REF_NAME}" == "main" ]]; then + echo "tag=$prod_version" >> "$GITHUB_OUTPUT" + echo "registry=$prod_registry" >> "$GITHUB_OUTPUT" + else + echo "Error: Unsupported branch ${GITHUB_REF_NAME}" >&2 + exit 1 + fi + shell: bash + + - name: Print version and registry + run: | + echo "Tag: ${{ steps.version.outputs.tag }}" + echo "Registry: ${{ steps.version.outputs.registry }}" + + - name: Build and push image + uses: ./.github/actions/docker-build-and-push + with: + tag: ${{ steps.version.outputs.tag }} + image-name: llm-d-inference-scheduler + registry: ${{ steps.version.outputs.registry }} + github-token: ${{ secrets.GHCR_TOKEN }} From 1a10d6549641afa88c2a7ebdcf83478573a46ca9 Mon Sep 17 00:00:00 2001 From: Maroon Ayoub Date: Sun, 18 May 2025 02:42:14 +0300 Subject: [PATCH 2/3] temporarily build dev from any ref --- .github/workflows/ci-merge.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-merge.yaml b/.github/workflows/ci-merge.yaml index b5dbf8e35..288e7fc8b 100644 --- a/.github/workflows/ci-merge.yaml +++ b/.github/workflows/ci-merge.yaml @@ -32,8 +32,8 @@ jobs: echo "tag=$prod_version" >> "$GITHUB_OUTPUT" echo "registry=$prod_registry" >> "$GITHUB_OUTPUT" else - echo "Error: Unsupported branch ${GITHUB_REF_NAME}" >&2 - exit 1 + echo "tag=$dev_version" >> "$GITHUB_OUTPUT" + echo "registry=$dev_registry" >> "$GITHUB_OUTPUT" fi shell: bash From 7d38ca772ef176cd27dd281b9293c6a26d52272f Mon Sep 17 00:00:00 2001 From: Maroon Ayoub Date: Sun, 18 May 2025 02:48:10 +0300 Subject: [PATCH 3/3] fix private pull in GHA merge --- .github/actions/docker-build-and-push/action.yml | 11 ++++++----- .github/workflows/ci-merge.yaml | 1 + 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/actions/docker-build-and-push/action.yml b/.github/actions/docker-build-and-push/action.yml index 9a18dd86e..c41bc3343 100644 --- a/.github/actions/docker-build-and-push/action.yml +++ b/.github/actions/docker-build-and-push/action.yml @@ -10,6 +10,9 @@ inputs: github-token: required: true description: GitHub token for login + kv-cache-manager-token: + required: true + description: Token for llm-d-kv-cache-manager private module registry: required: true description: Container registry (e.g., ghcr.io/llm-d) @@ -32,12 +35,10 @@ runs: - name: Configure Git to use token for private modules run: | - git config --global url."https://${{ secrets.KV_CACHE_MANAGER_TOKEN }}@github.com/".insteadOf "https://github.com/" + git config --global url."https://${{ inputs.kv-cache-manager-token }}@github.com/".insteadOf "https://github.com/" + go env -w GOPRIVATE=github.com/llm-d/* + shell: bash - - name: Set Go environment for private modules - run: | - go env -w GOPRIVATE=github.com/llm-d/* - - name: Build image run: | docker buildx build \ diff --git a/.github/workflows/ci-merge.yaml b/.github/workflows/ci-merge.yaml index 288e7fc8b..20008b8da 100644 --- a/.github/workflows/ci-merge.yaml +++ b/.github/workflows/ci-merge.yaml @@ -49,3 +49,4 @@ jobs: image-name: llm-d-inference-scheduler registry: ${{ steps.version.outputs.registry }} github-token: ${{ secrets.GHCR_TOKEN }} + kv-cache-manager-token: ${{ secrets.KV_CACHE_MANAGER_TOKEN }}