Skip to content
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

Align docker-meta with other agents #413

Open
jackshirazi opened this issue Sep 24, 2024 · 5 comments
Open

Align docker-meta with other agents #413

jackshirazi opened this issue Sep 24, 2024 · 5 comments

Comments

@jackshirazi
Copy link
Contributor

labels, and type (raw vs semver)

@trentm
Copy link
Member

trentm commented Sep 24, 2024

Aligning on the labels seems easy.


Finding alignment on the with.tags config used with the docker/metadata-action action might be more painful.

  • I recall those docs being confusing.
  • Changing that config might change what tags are published, e.g. whether the publishing of pushes to main use the "edge" docker tag or something else.

@trentm
Copy link
Member

trentm commented Sep 24, 2024

docker/metadata-action "with.tags" configs currently in use

Java: https://github.com/elastic/elastic-otel-java/blob/main/.github/workflows/release-step-3.yml

      - 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=${{ env.RELEASE_VERSION }}
            type=raw,value=latest,enable=${{ contains(env.LATEST_TAG,env.RELEASE_VERSION) }}

.NET: https://github.com/elastic/elastic-otel-dotnet/blob/main/.github/workflows/release.yml#L63-L78

    - name: Extract metadata (tags, labels)
      id: docker-meta
      uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81  # v5.5.1
      with:
        images: ${{ env.DOCKER_IMAGE_NAME }}
        flavor: |
          latest=auto
        tags: |
          # "1.2.3" and "latest" Docker tags on push of git tag "v1.2.3"
          type=semver,pattern={{version}},value=${{ steps.bootstrap.outputs.agent-version }}
          # "edge" Docker tag on git push to default branch
          type=edge

Node.js: https://github.com/elastic/elastic-otel-node/pull/374/files#diff-87db21a973eed4fef5f32b267aa60fcee5cbdf03c67fafdc2a9b553bb0b15f34R51-R62

      - name: Extract metadata (tags, labels)
        id: docker-meta
        uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81  # v5.5.1
        with:
          images: ${{ env.DOCKER_IMAGE_NAME }}
          flavor: |
            latest=auto
          tags: |
            # "1.2.3" and "latest" Docker tags on push of git tag "v1.2.3"
            type=semver,pattern={{version}}
            # "edge" Docker tag on git push to default branch
            type=edge

Python: https://github.com/elastic/elastic-otel-python/pull/132/files#diff-87db21a973eed4fef5f32b267aa60fcee5cbdf03c67fafdc2a9b553bb0b15f34R87-R98

- 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}}

@trentm
Copy link
Member

trentm commented Sep 24, 2024

In elastic/apm-agent-dotnet#2399 this change was made to fix an issue where (I think? I haven't read the full issue) the "latest" Docker image tag wasn't getting updated using type=raw:

diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index af776a75..a8ad00f3 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -60,7 +60,7 @@ jobs:
           latest=auto
         tags: |
           # "1.2.3" and "latest" Docker tags on push of git tag "v1.2.3"
-          type=raw,value=${{ steps.bootstrap.outputs.agent-version }}
+          type=semver,pattern={{version}},value=${{ steps.bootstrap.outputs.agent-version }}
           # "edge" Docker tag on git push to default branch
           type=edge

@trentm
Copy link
Member

trentm commented Sep 24, 2024

From poking around at published images of docker.elastic.co/observability/apm-agent-${lang} and docker.elastic.co/observability/elastic-otel-${lang} it basically looks to me like latest and ${version} tags are being published as wanted.

About what docker tag is used for pushes of Docker images built for every push to main:

  • Java: isn't building and pushing a Docker image for pushes to main, I don't think
  • Node.js: docker.elastic.co/observability/apm-agent-nodejs:edge (and :edge-wolfi)
  • Python: docker.elastic.co/observability/apm-agent-python:test-latest (and :test-latest-wolfi)
  • .NET: docker.elastic.co/observability/apm-agent-dotnet:edge (also some :1.29.1-canary.0.2-like thing that I don't see where it is coming from :)

The type=raw usage that apm-agent-dotnet.git had been using isn't an issue that Java and Python will hit because the latter two are using two type=raw config lines, one of which has value=latest to explicitly have a "latest" published tag.

@Mpdreamz
Copy link
Member

Fantastic writeup and research into the effect of our image tagging @trentm thanks for that! Happy to understand we're all good :)

1.29.1-canary.0.2 probably stems because we feed it our version number explicitly with value=....

For reference we use minver command line tool to version all our .NET/Rust artifacts based on tags automatically. For untagged commits its next minor and the prerelease includes the distance to the previous tag for uniqueness.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants