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

Allow prefix to be a whitespace/comma separated list of prefixes #326

Conversation

consideRatio
Copy link
Member

@consideRatio consideRatio commented Nov 23, 2023

This project enables pushing the same image to multiple tags, and with this feature it can enable pushing the same image to multiple destinations with multiple tags.

A use case for this is if we want to push to both Docker Hub and Quay.io for example, then prefix could be "user/repo,quay.io/user/repo".

I'd like us to not drop docker hub entirely and instead push to quay.io alongside dockerhub if its easy enough, and this makes it easy enough I think. I imagine it makes this small change possible in jupyterhub/configurable-http-proxy's publish workflow for example.

       - name: Setup push rights to Docker Hub
         if: startsWith(github.ref, 'refs/tags/')
         run: |
           docker login -u "${{ secrets.QUAY_USERNAME }}" -p "${{ secrets.QUAY_PASSWORD }}" quay.io
+          docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" -p "${{ secrets.DOCKERHUB_PASSWORD }}" docker.io
 
       - name: Get list of tags
         id: gettags
         uses: jupyterhub/action-major-minor-tag-calculator@v2
         with:
           githubToken: ${{ secrets.GITHUB_TOKEN }}
-          prefix: "quay.io/jupyterhub/configurable-http-proxy:"
+          prefix: "quay.io/jupyterhub/configurable-http-proxy: jupyterhub/configurable-http-proxy:"
           defaultTag: quay.io/jupyterhub/configurable-http-proxy:noref
 
       - name: Build and push
         uses: docker/build-push-action@v5
         with:
           platforms: linux/amd64,linux/arm64
           push: ${{ startsWith(github.ref, 'refs/tags/') }}
           # tags parameter must be a string input so convert `gettags` JSON
           # array into a comma separated list of tags
           tags: ${{ join(fromJson(steps.gettags.outputs.tags)) }}

@consideRatio consideRatio added the enhancement New feature or request label Nov 23, 2023
README.md Outdated Show resolved Hide resolved
This project enables pushing the same image to multiple tags, and with
this feature it can enable pushing the same image to multiple
destinations with multiple tags.

A use case for this is if we want to push to both Docker Hub and Quay.io
for example, then prefix could be `"user/repo,quay.io/user/repo"`.
@consideRatio consideRatio force-pushed the pr/allow-prefix-to-have-multiple-values branch from 9906027 to 975bd35 Compare November 23, 2023 19:00
Copy link
Member

@manics manics left a comment

Choose a reason for hiding this comment

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

LGTM

@consideRatio consideRatio merged commit 4724e1e into jupyterhub:main Nov 24, 2023
1 of 2 checks passed
@consideRatio
Copy link
Member Author

Wiee!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants