-
Notifications
You must be signed in to change notification settings - Fork 234
ci: use docker/metadata-action to gather tags/labels #2033
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -123,31 +123,29 @@ jobs: | |
| url: ${{ secrets.VAULT_ADDR }} | ||
| roleId: ${{ secrets.VAULT_ROLE_ID }} | ||
| secretId: ${{ secrets.VAULT_SECRET_ID }} | ||
|
|
||
| - uses: actions/download-artifact@v4 | ||
| with: | ||
| name: build-distribution | ||
| path: ./build | ||
| - id: setup-docker | ||
| name: Set up docker variables | ||
| run: |- | ||
| if [ "${{ startsWith(github.ref, 'refs/tags') }}" == "false" ] ; then | ||
| # for testing purposes | ||
| echo "tag=test" >> "${GITHUB_OUTPUT}" | ||
| echo "latest=test-latest" >> "${GITHUB_OUTPUT}" | ||
| else | ||
| # version without v prefix (e.g. 1.2.3) | ||
| echo "tag=${GITHUB_REF_NAME/v/}" >> "${GITHUB_OUTPUT}" | ||
| echo "latest=latest" >> "${GITHUB_OUTPUT}" | ||
| fi | ||
|
|
||
| - name: Extract metadata (tags, labels) | ||
| id: docker-meta | ||
| uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1 | ||
| with: | ||
| images: ${{ env.DOCKER_IMAGE_NAME }} | ||
| tags: | | ||
| type=raw,value=latest,prefix=test-,enable={{is_default_branch}} | ||
| type=semver,pattern={{version}} | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will use the version when a tag as explained in https://github.com/docker/metadata-action/tree/8e5442c4ef9f78752691e2d8f8d19755c6f78e81/?tab=readme-ov-file#semver |
||
|
|
||
| - name: Build and push image | ||
| id: push | ||
| uses: docker/build-push-action@v5.3.0 | ||
| uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0 | ||
| with: | ||
| context: . | ||
| push: true | ||
| tags: | | ||
| ${{ env.DOCKER_IMAGE_NAME }}:${{ steps.setup-docker.outputs.tag }} | ||
| ${{ env.DOCKER_IMAGE_NAME }}:${{ steps.setup-docker.outputs.latest }} | ||
| tags: ${{ steps.docker-meta.outputs.tags }} | ||
| labels: ${{ steps.docker-meta.outputs.labels }} | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will add some labels to the docker image using the open-containers standard
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We discussed a bit further about this in elastic/apm-agent-nodejs#3998 (comment) |
||
| build-args: | | ||
| AGENT_DIR=./build/dist/package/python | ||
|
|
||
|
|
@@ -156,7 +154,7 @@ jobs: | |
| with: | ||
| subject-name: "${{ env.DOCKER_IMAGE_NAME }}" | ||
| subject-digest: ${{ steps.push.outputs.digest }} | ||
| push-to-registry: false | ||
| push-to-registry: true | ||
|
|
||
| github-draft: | ||
| permissions: | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.