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

Update docker image tags #94

Closed
dzarras opened this issue Feb 13, 2024 · 3 comments
Closed

Update docker image tags #94

dzarras opened this issue Feb 13, 2024 · 3 comments
Assignees
Labels
feature New feature or request information Further information is requested

Comments

@dzarras
Copy link
Contributor

dzarras commented Feb 13, 2024

Currently publish-to-container-registry.yml workflow uses the following tags:

  1. type=semver,pattern=v{{version}}
  2. type=edge

From the documentation type=edge we read the following:

An edge tag reflects the last commit of the active branch on your Git repository. I usually prefer to use edge as a Docker tag for a better distinction or common pattern. This is also used by official images like Alpine.

My understanding is that the edge tag always points to the latest Docker image that has been created, regardless of the branch that was used to create it. i.e.:

  1. Trigger Docker image creation using main branch. edge tag points to this Docker image.
  2. Trigger Docker image creation using release/0.1.0. edge tag now points to this Docker image.

This can lead to unpredictable behavior in case we restart an already deployed service that uses the edge tag.

We should remove the type=edge tag and instead introduce a new tag type=ref,event=branch which produces predictable tags. The documentation can be found here

By using type=ref,event=branch instead of type=edge the following will happen:

  1. Trigger Docker image creation using main branch. main tag points to this Docker image.
  2. Trigger Docker image creation using release/0.1.0. release/0.1.0 tag points to this Docker image.
  3. We no longer have an edge tag that is always updated to point to the latest Docker image generated regardless of the branch that was used to create it.

If we opt to use the above, we must apply this change both to main and release/0.1.0 branches.

@dzarras dzarras added information Further information is requested feature New feature or request labels Feb 13, 2024
@dzarras dzarras self-assigned this Feb 13, 2024
@dzarras
Copy link
Contributor Author

dzarras commented Feb 13, 2024

@babisRoutis, @vafeini could you please check this and let me know what you think?

@babisRoutis
Copy link
Contributor

babisRoutis commented Feb 13, 2024

@dzarras
In the verifier we end up with the following workflow

     - name: Extract Docker metadata
        id: meta
        uses: docker/metadata-action@v5.0.0
        with:
          images: |
            ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
          tags: |
            type=semver,pattern=v{{version}}
            type=edge
            type=ref,event=branch

We kept edge to build the latest from main I think (something like the latest snaphsot)

In addition we updated also the gradle build to pass the correct arguments

Can we do the same here?

@dzarras
Copy link
Contributor Author

dzarras commented Feb 13, 2024

@babisRoutis Please check #95 build.gradle.kts is already aligned.

The same change must be applied to release/0.1.0. Should I create a new Pull Request that targets this branch and cherry-picks this commit?

@dzarras dzarras closed this as completed Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request information Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants