apm-agent-nodejs icon indicating copy to clipboard operation
apm-agent-nodejs copied to clipboard

ci: use docker/metadata-action to gather tags/labels

Open v1v opened this issue 1 year ago • 1 comments

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

Run docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0
  with:
    context: .
    push: false
    tags: docker.elastic.co/observability/apm-agent-nodejs:test-latest
    labels: org.opencontainers.image.created=[2](https://github.com/elastic/apm-agent-nodejs/actions/runs/8878357355/job/24373834641#step:9:2)024-04-29T12:16:2[3](https://github.com/elastic/apm-agent-nodejs/actions/runs/8878357355/job/24373834641#step:9:3).000Z
  org.opencontainers.image.description=Elastic APM Node.js Agent
  org.opencontainers.image.licenses=BSD-2-Clause
  org.opencontainers.image.revision=f9f28681ae69736728d1[5](https://github.com/elastic/apm-agent-nodejs/actions/runs/8878357355/job/24373834641#step:9:5)aaa93880fffba5f2e6d
  org.opencontainers.image.source=https://github.com/elastic/apm-agent-nodejs
  org.opencontainers.image.title=apm-agent-nodejs
  org.opencontainers.image.url=https://github.com/elastic/apm-agent-nodejs
  org.opencontainers.image.version=test-latest
    build-args: AGENT_DIR=/build/dist/nodejs

Checklist

  • [x] Implement code
  • [ ] Add tests
  • [ ] Update TypeScript typings
  • [ ] Update documentation
  • [ ] Add CHANGELOG.asciidoc entry
  • [ ] Commit message follows commit guidelines

v1v avatar Apr 29 '24 12:04 v1v

However, the current diff in this PR does not use type=ref,... at all, so I am confused.

I initially used but discovered that the type: ref uses the name of the tag and the tags in this particular case use the format v<version>, therefore the image name will contain v<version> rather than <version>

Those details were mentioned in a similar PR that I raised in the apm-agent-python:

  • https://github.com/elastic/apm-agent-python/pull/2033#discussion_r1583086509

v1v avatar Apr 29 '24 17:04 v1v