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

ci: set only image name as lowercase, leave image tag untouched #20

Merged
merged 1 commit into from
Apr 27, 2022

Conversation

pchila
Copy link
Contributor

@pchila pchila commented Apr 8, 2022

Change image name to lowercase but leave the optional tag untouched

Signed-off-by: Paolo Chila [email protected]

@pchila pchila linked an issue Apr 8, 2022 that may be closed by this pull request
@christian-kreuzberger-dtx
Copy link
Member

@Raffy23 what's your take on this?

IMO we are now fixing the fix for the fix of "uppercase names in Docker image names", which we seem to be preventing in keptn-service-template-go anyway:
image

image

image

I would prefer to not fix this issue, but revert to the original implementation (which was changed with this PR):
https://github.com/keptn/gh-automation/pull/15/files

@Raffy23
Copy link
Member

Raffy23 commented Apr 11, 2022

We can revert to the previous implementation, until we find a better way of normalizing tags. I'm currently not sure what kind of unintended behavior is introduced by this change (A registry with a port will probably not work anymore). But if we do, we also have to document somewhere that GitHub accounts with any uppercase letters can not use this action + any other action that depends on it ...

Maybe a regex like ^((.+\..+(:\d+)?)[^:]*):(.+)?$ would be better as it also matches the port if one occurs.

@christian-kreuzberger-dtx
Copy link
Member

Reverting to the old behavior of not checking the input would break configurations that use

        TAGS: |
            ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE }}:${{ env.VERSION }}
            ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE }}:${{ env.VERSION }}.${{ env.DATETIME }}

which would require us to change the README.

Also, I just looked at service-template, we will also break it there, because I only tested it with upper case service name, but not repository/organization owner :(

          TAGS: |
            ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE }}:${{ env.VERSION }}

I digged a little bit deeper, and found a Troubleshooting guide of build-push-action, which provides another example of fixing this:

- name: Sanitize repo slug
  uses: actions/github-script@v4
  id: repo_slug
  with:
    result-encoding: string
    script: return 'ghcr.io/${{ github.repository }}'.toLowerCase()

- name: Build and push
  uses: docker/build-push-action@v2
  with:
    context: .
    push: true
    tags: ${{ steps.repo_slug.outputs.result }}:latest

Nevertheless, I'm seeing many problems appear with uppercased names on GitHub repos vs. GHCR, therefore I'm willing to accept this PR for now (it doesn't make it worse, it improves the 99% case/golden path, it just doesn't solve all edge cases).

I will provide an issue in keptn-service-template-go to handle upper-case owner names better.

Copy link
Member

@christian-kreuzberger-dtx christian-kreuzberger-dtx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (see comment above)

@pchila pchila marked this pull request as ready for review April 27, 2022 14:54
@pchila pchila merged commit 20a1fc3 into main Apr 27, 2022
@christian-kreuzberger-dtx christian-kreuzberger-dtx deleted the fix/leave-tags-of-docker-images-untouched branch April 28, 2022 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docker-Build Action: normalize tags causes problems with upper-cased tags
3 participants