Skip to content

Commit 64c4cd7

Browse files
authored
Do not hardcode owner of the image (#1769)
* Do not hardcode owner of the image * Fix
1 parent b159a79 commit 64c4cd7

File tree

6 files changed

+32
-11
lines changed

6 files changed

+32
-11
lines changed

.github/workflows/docker-build-test-upload.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Download parent image, build new one, test it and upload to GitHub artifacts
22

3+
env:
4+
OWNER: ${{ github.repository_owner }}
5+
36
on:
47
workflow_call:
58
inputs:
@@ -45,19 +48,19 @@ jobs:
4548
platform: ${{ inputs.platform }}
4649

4750
- name: Build image 🛠
48-
run: docker build --rm --force-rm --tag jupyter/${{ inputs.image }} ${{ inputs.image }}/
51+
run: docker build --rm --force-rm --tag ${{ env.OWNER }}/${{ inputs.image }} ${{ inputs.image }}/
4952
env:
5053
DOCKER_BUILDKIT: 1
5154
# Full logs for CI build
5255
BUILDKIT_PROGRESS: plain
5356
shell: bash
5457

5558
- name: Run tests ✅
56-
run: python3 -m tests.run_tests --short-image-name ${{ inputs.image }}
59+
run: python3 -m tests.run_tests --short-image-name ${{ inputs.image }} --owner ${{ env.OWNER }}
5760
shell: bash
5861

5962
- name: Save image as a tar for later use 💾
60-
run: docker save jupyter/${{ inputs.image }} -o /tmp/${{ inputs.image }}-${{ inputs.platform }}.tar
63+
run: docker save ${{ env.OWNER }}/${{ inputs.image }} -o /tmp/${{ inputs.image }}-${{ inputs.platform }}.tar
6164
shell: bash
6265
- name: Upload image as artifact 💾
6366
uses: actions/upload-artifact@v3

.github/workflows/docker-tag-manifest-push.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Download Docker image from GitHub artifacts, tag and push it to DockerHub
22

3+
env:
4+
OWNER: ${{ github.repository_owner }}
5+
36
on:
47
workflow_call:
58
inputs:
@@ -54,12 +57,12 @@ jobs:
5457

5558
- name: Create tags 🏷
5659
run: |
57-
python3 -m tagging.tag_image --short-image-name ${{ matrix.image }}
60+
python3 -m tagging.tag_image --short-image-name ${{ matrix.image }} --owner ${{ env.OWNER }}
5861
docker image ls -a
5962
shell: bash
6063

6164
- name: Write manifest and build history file 🏷
62-
run: python3 -m tagging.write_manifest --short-image-name ${{ matrix.image }} --hist-line-dir /tmp/hist_lines/ --manifest-dir /tmp/manifests/
65+
run: python3 -m tagging.write_manifest --short-image-name ${{ matrix.image }} --hist-line-dir /tmp/hist_lines/ --manifest-dir /tmp/manifests/ --owner ${{ env.OWNER }}
6366
shell: bash
6467
- name: Upload manifest file 💾
6568
uses: actions/upload-artifact@v3
@@ -76,7 +79,7 @@ jobs:
7679

7780
- name: Remove aarch64 latest tag 🗑️
7881
if: ${{ inputs.platform != 'amd64' }}
79-
run: docker rmi jupyter/${{ matrix.image }}
82+
run: docker rmi ${{ env.OWNER }}/${{ matrix.image }}
8083
shell: bash
8184

8285
- name: Login to Docker Hub 🔐
@@ -88,5 +91,5 @@ jobs:
8891

8992
- name: Push Images to Docker Hub 📤
9093
if: github.ref == 'refs/heads/main' || github.event_name == 'schedule'
91-
run: docker push --all-tags jupyter/${{ matrix.image }}
94+
run: docker push --all-tags ${{ env.OWNER }}/${{ matrix.image }}
9295
shell: bash

.github/workflows/hub-overview.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Update dockerhub overviews
22

3+
env:
4+
OWNER: ${{ github.repository_owner }}
5+
36
on:
47
push:
58
branches:
@@ -36,7 +39,7 @@ jobs:
3639
DOCKER_USER: ${{ secrets.DOCKERHUB_USERNAME }}
3740
DOCKER_PASS: ${{ secrets.DOCKERHUB_TOKEN }}
3841
with:
39-
destination_container_repo: jupyter/base-notebook
42+
destination_container_repo: ${{ env.OWNER }}/base-notebook
4043
provider: dockerhub
4144
short_description: "Small base image for Jupyter Notebook stacks from https://github.com/jupyter/docker-stacks"
4245
readme_file: base-notebook/README.md

tagging/tag_image.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@ def tag_image(short_image_name: str, owner: str) -> None:
5050
required=True,
5151
help="Short image name to apply tags for",
5252
)
53-
arg_parser.add_argument("--owner", default="jupyter", help="Owner of the image")
53+
arg_parser.add_argument(
54+
"--owner",
55+
required=True,
56+
help="Owner of the image",
57+
)
5458
args = arg_parser.parse_args()
5559

5660
tag_image(args.short_image_name, args.owner)

tagging/write_manifest.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,11 @@ def write_manifest(
120120
type=Path,
121121
help="Directory to save manifest file",
122122
)
123-
arg_parser.add_argument("--owner", default="jupyter", help="Owner of the image")
123+
arg_parser.add_argument(
124+
"--owner",
125+
required=True,
126+
help="Owner of the image",
127+
)
124128
args = arg_parser.parse_args()
125129

126130
LOGGER.info(f"Current build timestamp: {BUILD_TIMESTAMP}")

tests/run_tests.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ def test_image(short_image_name: str, owner: str) -> None:
4141
required=True,
4242
help="Short image name to run test on",
4343
)
44-
arg_parser.add_argument("--owner", default="jupyter", help="Owner of the image")
44+
arg_parser.add_argument(
45+
"--owner",
46+
required=True,
47+
help="Owner of the image",
48+
)
4549

4650
args = arg_parser.parse_args()
4751

0 commit comments

Comments
 (0)