Do not hardcode owner of the image (#1769)

* Do not hardcode owner of the image

* Fix
This commit is contained in:
Ayaz Salikhov
2022-08-11 11:51:10 +04:00
committed by GitHub
parent b159a79118
commit 64c4cd717a
6 changed files with 32 additions and 11 deletions

View File

@@ -1,5 +1,8 @@
name: Download parent image, build new one, test it and upload to GitHub artifacts name: Download parent image, build new one, test it and upload to GitHub artifacts
env:
OWNER: ${{ github.repository_owner }}
on: on:
workflow_call: workflow_call:
inputs: inputs:
@@ -45,7 +48,7 @@ jobs:
platform: ${{ inputs.platform }} platform: ${{ inputs.platform }}
- name: Build image 🛠 - name: Build image 🛠
run: docker build --rm --force-rm --tag jupyter/${{ inputs.image }} ${{ inputs.image }}/ run: docker build --rm --force-rm --tag ${{ env.OWNER }}/${{ inputs.image }} ${{ inputs.image }}/
env: env:
DOCKER_BUILDKIT: 1 DOCKER_BUILDKIT: 1
# Full logs for CI build # Full logs for CI build
@@ -53,11 +56,11 @@ jobs:
shell: bash shell: bash
- name: Run tests ✅ - name: Run tests ✅
run: python3 -m tests.run_tests --short-image-name ${{ inputs.image }} run: python3 -m tests.run_tests --short-image-name ${{ inputs.image }} --owner ${{ env.OWNER }}
shell: bash shell: bash
- name: Save image as a tar for later use 💾 - name: Save image as a tar for later use 💾
run: docker save jupyter/${{ inputs.image }} -o /tmp/${{ inputs.image }}-${{ inputs.platform }}.tar run: docker save ${{ env.OWNER }}/${{ inputs.image }} -o /tmp/${{ inputs.image }}-${{ inputs.platform }}.tar
shell: bash shell: bash
- name: Upload image as artifact 💾 - name: Upload image as artifact 💾
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3

View File

@@ -1,5 +1,8 @@
name: Download Docker image from GitHub artifacts, tag and push it to DockerHub name: Download Docker image from GitHub artifacts, tag and push it to DockerHub
env:
OWNER: ${{ github.repository_owner }}
on: on:
workflow_call: workflow_call:
inputs: inputs:
@@ -54,12 +57,12 @@ jobs:
- name: Create tags 🏷 - name: Create tags 🏷
run: | run: |
python3 -m tagging.tag_image --short-image-name ${{ matrix.image }} python3 -m tagging.tag_image --short-image-name ${{ matrix.image }} --owner ${{ env.OWNER }}
docker image ls -a docker image ls -a
shell: bash shell: bash
- name: Write manifest and build history file 🏷 - name: Write manifest and build history file 🏷
run: python3 -m tagging.write_manifest --short-image-name ${{ matrix.image }} --hist-line-dir /tmp/hist_lines/ --manifest-dir /tmp/manifests/ run: python3 -m tagging.write_manifest --short-image-name ${{ matrix.image }} --hist-line-dir /tmp/hist_lines/ --manifest-dir /tmp/manifests/ --owner ${{ env.OWNER }}
shell: bash shell: bash
- name: Upload manifest file 💾 - name: Upload manifest file 💾
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
@@ -76,7 +79,7 @@ jobs:
- name: Remove aarch64 latest tag 🗑️ - name: Remove aarch64 latest tag 🗑️
if: ${{ inputs.platform != 'amd64' }} if: ${{ inputs.platform != 'amd64' }}
run: docker rmi jupyter/${{ matrix.image }} run: docker rmi ${{ env.OWNER }}/${{ matrix.image }}
shell: bash shell: bash
- name: Login to Docker Hub 🔐 - name: Login to Docker Hub 🔐
@@ -88,5 +91,5 @@ jobs:
- name: Push Images to Docker Hub 📤 - name: Push Images to Docker Hub 📤
if: github.ref == 'refs/heads/main' || github.event_name == 'schedule' if: github.ref == 'refs/heads/main' || github.event_name == 'schedule'
run: docker push --all-tags jupyter/${{ matrix.image }} run: docker push --all-tags ${{ env.OWNER }}/${{ matrix.image }}
shell: bash shell: bash

View File

@@ -1,5 +1,8 @@
name: Update dockerhub overviews name: Update dockerhub overviews
env:
OWNER: ${{ github.repository_owner }}
on: on:
push: push:
branches: branches:
@@ -36,7 +39,7 @@ jobs:
DOCKER_USER: ${{ secrets.DOCKERHUB_USERNAME }} DOCKER_USER: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKER_PASS: ${{ secrets.DOCKERHUB_TOKEN }} DOCKER_PASS: ${{ secrets.DOCKERHUB_TOKEN }}
with: with:
destination_container_repo: jupyter/base-notebook destination_container_repo: ${{ env.OWNER }}/base-notebook
provider: dockerhub provider: dockerhub
short_description: "Small base image for Jupyter Notebook stacks from https://github.com/jupyter/docker-stacks" short_description: "Small base image for Jupyter Notebook stacks from https://github.com/jupyter/docker-stacks"
readme_file: base-notebook/README.md readme_file: base-notebook/README.md

View File

@@ -50,7 +50,11 @@ if __name__ == "__main__":
required=True, required=True,
help="Short image name to apply tags for", help="Short image name to apply tags for",
) )
arg_parser.add_argument("--owner", default="jupyter", help="Owner of the image") arg_parser.add_argument(
"--owner",
required=True,
help="Owner of the image",
)
args = arg_parser.parse_args() args = arg_parser.parse_args()
tag_image(args.short_image_name, args.owner) tag_image(args.short_image_name, args.owner)

View File

@@ -120,7 +120,11 @@ if __name__ == "__main__":
type=Path, type=Path,
help="Directory to save manifest file", help="Directory to save manifest file",
) )
arg_parser.add_argument("--owner", default="jupyter", help="Owner of the image") arg_parser.add_argument(
"--owner",
required=True,
help="Owner of the image",
)
args = arg_parser.parse_args() args = arg_parser.parse_args()
LOGGER.info(f"Current build timestamp: {BUILD_TIMESTAMP}") LOGGER.info(f"Current build timestamp: {BUILD_TIMESTAMP}")

View File

@@ -41,7 +41,11 @@ if __name__ == "__main__":
required=True, required=True,
help="Short image name to run test on", help="Short image name to run test on",
) )
arg_parser.add_argument("--owner", default="jupyter", help="Owner of the image") arg_parser.add_argument(
"--owner",
required=True,
help="Owner of the image",
)
args = arg_parser.parse_args() args = arg_parser.parse_args()