Skip to content

Commit b89b5ec

Browse files
authored
[FAST_BUILD] Apply and merge tags in the same place (#2274)
* Apply and merge tags in the same place * Multiple fixes * Refactor merge_tags.py * Small fixes * Download aarch64 first * Revert a change back * Show docker images
1 parent abd7d12 commit b89b5ec

File tree

7 files changed

+152
-239
lines changed

7 files changed

+152
-239
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Apply single platform tags
2+
description: Download the image tar, load it to Docker and apply tags to it
3+
4+
inputs:
5+
image:
6+
description: Image name
7+
required: true
8+
platform:
9+
description: Image platform
10+
required: true
11+
variant:
12+
description: Variant tag prefix
13+
required: true
14+
15+
runs:
16+
using: composite
17+
steps:
18+
- name: Load image to Docker 📥
19+
uses: ./.github/actions/load-image
20+
with:
21+
image: ${{ inputs.image }}
22+
platform: ${{ inputs.platform }}
23+
variant: ${{ inputs.variant }}
24+
25+
- name: Download tags file 📥
26+
uses: actions/download-artifact@v4
27+
with:
28+
name: ${{ inputs.image }}-${{ inputs.platform }}-${{ inputs.variant }}-tags
29+
path: /tmp/jupyter/tags/
30+
31+
- name: Apply tags to the loaded image 🏷
32+
run: |
33+
python3 -m tagging.apps.apply_tags \
34+
--registry ${{ env.REGISTRY }} \
35+
--owner ${{ env.OWNER }} \
36+
--image ${{ inputs.image }} \
37+
--variant ${{ inputs.variant }} \
38+
--platform ${{ inputs.platform }} \
39+
--tags-dir /tmp/jupyter/tags/
40+
shell: bash
41+
42+
# This step is needed to prevent pushing non-multi-arch "latest" tag
43+
- name: Remove the "latest" tag from the image 🗑️
44+
run: docker image rmi ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ inputs.image }}:latest
45+
shell: bash
46+
47+
- name: Show Docker images 📦
48+
run: docker image ls --all
49+
shell: bash

.github/actions/load-image/action.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ runs:
2020
with:
2121
name: ${{ inputs.image }}-${{ inputs.platform }}-${{ inputs.variant }}
2222
path: /tmp/jupyter/images/
23+
2324
- name: Load downloaded image to docker 📥
2425
run: |
2526
zstd \
@@ -28,5 +29,8 @@ runs:
2829
--rm \
2930
/tmp/jupyter/images/${{ inputs.image }}-${{ inputs.platform }}-${{ inputs.variant }}.tar.zst \
3031
| docker load
31-
docker image ls --all
32+
shell: bash
33+
34+
- name: Show Docker images 📦
35+
run: docker image ls --all
3236
shell: bash

.github/dependabot.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ updates:
99
directory: /
1010
schedule:
1111
interval: weekly
12+
- package-ecosystem: github-actions
13+
directory: .github/actions/apply-single-tags/
14+
schedule:
15+
interval: weekly
1216
- package-ecosystem: github-actions
1317
directory: .github/actions/create-dev-env/
1418
schedule:

.github/workflows/docker-merge-tags.yml

Lines changed: 0 additions & 69 deletions
This file was deleted.

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

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ on:
1212
description: Image name
1313
required: true
1414
type: string
15-
platform:
16-
description: Image platform
17-
required: true
18-
type: string
1915
variant:
2016
description: Variant tag prefix
2117
required: true
@@ -40,12 +36,21 @@ jobs:
4036
uses: actions/checkout@v4
4137
- name: Create dev environment 📦
4238
uses: ./.github/actions/create-dev-env
43-
- name: Load image to Docker 📥
44-
uses: ./.github/actions/load-image
39+
40+
- name: Download aarch64 image tar and apply tags 🏷
41+
uses: ./.github/actions/apply-single-tags
4542
with:
4643
image: ${{ inputs.image }}
47-
platform: ${{ inputs.platform }}
4844
variant: ${{ inputs.variant }}
45+
platform: aarch64
46+
if: ${{ !contains(inputs.variant, 'cuda') }}
47+
48+
- name: Download x86_64 image tar and apply tags 🏷
49+
uses: ./.github/actions/apply-single-tags
50+
with:
51+
image: ${{ inputs.image }}
52+
variant: ${{ inputs.variant }}
53+
platform: x86_64
4954

5055
- name: Login to Registry 🔐
5156
if: env.PUSH_TO_REGISTRY == 'true'
@@ -55,27 +60,21 @@ jobs:
5560
username: ${{ secrets.REGISTRY_USERNAME }}
5661
password: ${{ secrets.REGISTRY_TOKEN }}
5762

58-
- name: Download tags file 📥
59-
uses: actions/download-artifact@v4
60-
with:
61-
name: ${{ inputs.image }}-${{ inputs.platform }}-${{ inputs.variant }}-tags
62-
path: /tmp/jupyter/tags/
63-
- name: Apply tags to the loaded image 🏷
64-
run: |
65-
python3 -m tagging.apps.apply_tags \
66-
--registry ${{ env.REGISTRY }} \
67-
--owner ${{ env.OWNER }} \
68-
--image ${{ inputs.image }} \
69-
--variant ${{ inputs.variant }} \
70-
--platform ${{ inputs.platform }} \
71-
--tags-dir /tmp/jupyter/tags/
72-
# This step is needed to prevent pushing non-multi-arch "latest" tag
73-
- name: Remove the "latest" tag from the image 🗑️
74-
run: docker image rmi ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ inputs.image }}:latest
75-
76-
- name: Push Images to Registry 📤
63+
- name: Push single platform images to Registry 📤
7764
if: env.PUSH_TO_REGISTRY == 'true'
7865
run: |
7966
docker push --all-tags ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ inputs.image }} || \
8067
docker push --all-tags ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ inputs.image }}
8168
shell: bash
69+
70+
- name: Merge tags for the images 🔀
71+
run: |
72+
python3 -m tagging.apps.merge_tags \
73+
--image ${{ inputs.image }} \
74+
--variant ${{ inputs.variant }} \
75+
--tags-dir /tmp/jupyter/tags/ || \
76+
python3 -m tagging.apps.merge_tags \
77+
--image ${{ inputs.image }} \
78+
--variant ${{ inputs.variant }} \
79+
--tags-dir /tmp/jupyter/tags/
80+
shell: bash

0 commit comments

Comments
 (0)