adoroszlai commented on code in PR #30: URL: https://github.com/apache/ozone-docker-runner/pull/30#discussion_r1830587251
########## .github/workflows/push.yaml: ########## @@ -0,0 +1,58 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: push + +# This workflow builds (if necessary) and tags the Docker image. + +on: + push: + +permissions: + contents: read + packages: write + +jobs: + build: + uses: ./.github/workflows/build.yaml + + tag: + needs: build + if: ${{ github.ref_type == 'tag' }} + runs-on: ubuntu-latest + steps: + - name: Generate tags + uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81v5 + with: + images: | + ghcr.io/${{ github.repository_owner }}/ozone-runner + tags: | + type=ref,event=tag,latest=false + + - name: Login to GitHub Container Registry + uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 + with: + registry: ghcr.io Review Comment: `push.yaml` (then `tag.yaml`) defined the `DEFAULT_REGISTRY` variable initially, with a comment that it must be kept in sync between the two workflows. But usage in `build.yaml` and here is different: - `build.yaml` publishes to a single registry. - `push.yaml` will eventually publish to multiple registries. From this workflow's point of view, none of those are special. The source image is taken as an input from the other workflow, so it doesn't need to know which registry is the default. So I removed it. On third thought I think we should hard-code it everywhere. Here's why: `ghcr.io` is available for all forks, so the workflow works for everyone. On the other hand, Docker Hub is special in that one needs to register and create the repo for these images. Also, the secret for Docker Hub login must be set explicitly in the repo settings. So login and push to Docker Hub would not work out-of-the-box for someone who just forks `apache/ozone-docker-runner`. By the same logic, changing `DEFAULT_REGISTRY` to Docker Hub would break the workflow for such users. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@ozone.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@ozone.apache.org For additional commands, e-mail: issues-h...@ozone.apache.org