Repository navigation
ci: publish the agent image on ghcr.io (MK8S-446) #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| name: agent-image | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| is-latest: | ||
| description: "Also move the latest (or latest-dev) tag" | ||
| required: false | ||
| default: false | ||
| type: boolean | ||
| is-stable: | ||
| description: "Move latest instead of latest-dev" | ||
| required: false | ||
| default: false | ||
| type: boolean | ||
|
|
||
| # One publish at a time per ref. GitHub keeps only one pending run per group | ||
| # and cancels it when a newer one arrives, so a shared group could drop a | ||
| # release build. Merges to main still run in order. A pre-release can race | ||
| # with a merge to main on latest-dev: if it finishes last, latest-dev points | ||
| # to the pre-release until the next merge that touches agent/. | ||
| concurrency: | ||
| group: agent-image-${{ github.ref }} | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| # git describe needs the tags and the history. | ||
| fetch-depth: 0 | ||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0 | ||
| - name: Log in to ghcr.io | ||
| uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0 | ||
| with: | ||
| registry: ghcr.io | ||
| username: ${{ github.repository_owner }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Compute tags | ||
| id: tags | ||
| env: | ||
| IMAGE: ghcr.io/${{ github.repository_owner }}/image-cache-agent | ||
| IS_LATEST: ${{ inputs.is-latest }} | ||
| IS_STABLE: ${{ inputs.is-stable }} | ||
| run: | | ||
| # A tag push names the image after that tag: two tags can sit on | ||
| # the same commit, and describe would pick one of them. | ||
| if [ "$GITHUB_REF_TYPE" = "tag" ]; then | ||
| version="$GITHUB_REF_NAME" | ||
| else | ||
| version="$(git describe --tags --always --match='v[0-9]*')" | ||
| fi | ||
| tags="$IMAGE:$version" | ||
| if [ "$IS_LATEST" = "true" ]; then | ||
| if [ "$IS_STABLE" = "true" ]; then | ||
| tags="$tags,$IMAGE:latest" | ||
| else | ||
| tags="$tags,$IMAGE:latest-dev" | ||
| fi | ||
| fi | ||
| echo "tags=$tags" >> "$GITHUB_OUTPUT" | ||
| - name: Build and push | ||
| uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0 | ||
| with: | ||
| context: agent | ||
| # The agent only ships for amd64 (see agent/DESIGN.md). | ||
| platforms: linux/amd64 | ||
| push: true | ||
| tags: ${{ steps.tags.outputs.tags }} | ||
| cache-from: type=gha,scope=image-cache-agent | ||
| cache-to: type=gha,mode=max,scope=image-cache-agent | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| --- | ||
| name: Post Merge | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| paths: | ||
| - 'agent/**' | ||
| - '.github/workflows/agent-image.yaml' | ||
| - '.github/workflows/post-merge.yaml' | ||
|
|
||
| jobs: | ||
| agent-image: | ||
| uses: ./.github/workflows/agent-image.yaml | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| with: | ||
| is-latest: true | ||
| is-stable: false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.