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
ci: use docker/metadata-action to gather tags/labels #3998
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use https://github.com/docker/metadata-action/tree/8e5442c4ef9f78752691e2d8f8d19755c6f78e81/?tab=readme-ov-file#typeref to get the tags/annotatiions/labels
You link to #typeref
there, and link to:
See https://github.com/elastic/apm-agent-nodejs/actions/runs/8878357355
which does show using a config of the "docker-metadata" action with:
type=ref,event=tag,prefix=,suffix=
However, the current diff in this PR does not use type=ref,...
at all, so I am confused.
${{ env.DOCKER_IMAGE_NAME }}:${{ steps.docker-vars.outputs.tag }} | ||
${{ env.DOCKER_IMAGE_NAME }}:${{ steps.docker-vars.outputs.latest }} | ||
tags: ${{ steps.docker-meta.outputs.tags }} | ||
labels: ${{ steps.docker-meta.outputs.labels }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the record this results in adding a number of labels that we never had before:
Before:
/usr/bin/docker buildx build --build-arg AGENT_DIR=/build/dist/nodejs --iidfile /home/runner/work/_temp/docker-actions-toolkit-fyNsIK/iidfile --tag docker.elastic.co/observability/apm-agent-nodejs:test --tag docker.elastic.co/observability/apm-agent-nodejs:test-latest --metadata-file /home/runner/work/_temp/docker-actions-toolkit-fyNsIK/metadata-file --push .
after:
/usr/bin/docker buildx build --build-arg AGENT_DIR=/build/dist/nodejs --iidfile /home/runner/work/_temp/docker-actions-toolkit-zpfy5E/iidfile --label org.opencontainers.image.created=2024-04-29T12:16:23.000Z --label org.opencontainers.image.description=Elastic APM Node.js Agent --label org.opencontainers.image.licenses=BSD-2-Clause --label org.opencontainers.image.revision=f9f28681ae69736728d15aaa93880fffba5f2e6d --label org.opencontainers.image.source=https://github.com/elastic/apm-agent-nodejs --label org.opencontainers.image.title=apm-agent-nodejs --label org.opencontainers.image.url=https://github.com/elastic/apm-agent-nodejs --label org.opencontainers.image.version=test-latest --tag docker.elastic.co/observability/apm-agent-nodejs:test-latest --metadata-file /home/runner/work/_temp/docker-actions-toolkit-zpfy5E/metadata-file .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those are the opencontainer default labels:
We can remove them, sorry if I was not clear about this change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a strong argument either way. If we add these, then they somewhat become a promise that we will always define them in the future. I don't think it likely that that will be an issue.
On balance, I would be inclined to not add these labels unless there is a known use case to have them. I am fine either way however.
I initially used but discovered that the Those details were mentioned in a similar PR that I raised in the |
…es-wolfi * upstream/main: ci: use docker/metadata-action to gather tags/labels (elastic#3998) chore(deps): bump @opentelemetry/exporter-prometheus (elastic#4016) chore(deps): bump @opentelemetry/sdk-metrics to 1.24.1 in test fixtures (elastic#4015) chore(deps): bump @opentelemetry/sdk-metrics from 1.24.0 to 1.24.1 (elastic#4014) chore(deps-dev): bump azure-functions-core-tools (elastic#4017) chore(deps-dev): bump undici from 6.15.0 to 6.16.1 (elastic#4013) chore(deps-dev): bump fastify from 4.26.2 to 4.27.0 (elastic#4012) chore(deps): bump pino from 8.17.1 to 8.21.0 (elastic#4011) chore(deps): bump @opentelemetry/core from 1.24.0 to 1.24.1 (elastic#4010) chore(deps-dev): bump mongodb from 6.6.0 to 6.6.1 (elastic#4009) chore(deps-dev): bump eslint-plugin-n in the eslint group (elastic#4008)
* feature/docker-images-wolfi: ci: use docker/metadata-action to gather tags/labels (#3998) chore(deps): bump @opentelemetry/exporter-prometheus (#4016) chore(deps): bump @opentelemetry/sdk-metrics to 1.24.1 in test fixtures (#4015) chore(deps): bump @opentelemetry/sdk-metrics from 1.24.0 to 1.24.1 (#4014) chore(deps-dev): bump azure-functions-core-tools (#4017) chore(deps-dev): bump undici from 6.15.0 to 6.16.1 (#4013) chore(deps-dev): bump fastify from 4.26.2 to 4.27.0 (#4012) chore(deps): bump pino from 8.17.1 to 8.21.0 (#4011) chore(deps): bump @opentelemetry/core from 1.24.0 to 1.24.1 (#4010) chore(deps-dev): bump mongodb from 6.6.0 to 6.6.1 (#4009) chore(deps-dev): bump eslint-plugin-n in the eslint group (#4008)
What
Use https://github.com/docker/metadata-action/tree/8e5442c4ef9f78752691e2d8f8d19755c6f78e81/?tab=readme-ov-file#semver to get the tag version and open-container labels.
Use sha commit for the GitHub action related to docker.
Test
See https://github.com/elastic/apm-agent-nodejs/actions/runs/8878357355, didn't run with
push
Checklist