Start using matrix in reuseable workflows directly (#1822)

* Start using matrix in reuseable workflows directly

* Fix name
This commit is contained in:
Ayaz Salikhov
2022-11-01 15:43:09 +04:00
committed by GitHub
parent 509d2afd0c
commit 5168eb6548
3 changed files with 54 additions and 56 deletions

View File

@@ -6,8 +6,8 @@ env:
on:
workflow_call:
inputs:
images:
description: Stringified JSON object listing image names
image:
description: Image name
required: true
type: string
secrets:
@@ -20,10 +20,6 @@ jobs:
merge-tags:
runs-on: ubuntu-latest
strategy:
matrix:
image: ${{ fromJson(inputs.images) }}
steps:
- name: Checkout Repo ⚡️
uses: actions/checkout@v3
@@ -35,18 +31,18 @@ jobs:
- name: Download x86_64 tags file 📥
uses: actions/download-artifact@v3
with:
name: ${{ matrix.image }}-x86_64-tags
name: ${{ inputs.image }}-x86_64-tags
path: /tmp/tags/
- name: Download aarch64 tags file 📥
if: matrix.image != 'tensorflow-notebook'
if: inputs.image != 'tensorflow-notebook'
uses: actions/download-artifact@v3
with:
name: ${{ matrix.image }}-aarch64-tags
name: ${{ inputs.image }}-aarch64-tags
path: /tmp/tags/
- name: Create an empty aarch64 tags file for tensorflow-notebook 💩
if: matrix.image == 'tensorflow-notebook'
if: inputs.image == 'tensorflow-notebook'
run: touch /tmp/tags/aarch64-tensorflow-notebook.txt
shell: bash
@@ -68,5 +64,5 @@ jobs:
- name: Merge tags for the images 🔀
if: github.ref == 'refs/heads/main' || github.event_name == 'schedule'
run: python3 -m tagging.merge_tags --short-image-name ${{ matrix.image }} --tags-dir /tmp/tags/
run: python3 -m tagging.merge_tags --short-image-name ${{ inputs.image }} --tags-dir /tmp/tags/
shell: bash

View File

@@ -6,8 +6,8 @@ env:
on:
workflow_call:
inputs:
images:
description: Stringified JSON object listing image names
image:
description: Image name
required: true
type: string
platform:
@@ -24,10 +24,6 @@ jobs:
tag-manifest-push:
runs-on: ubuntu-latest
strategy:
matrix:
image: ${{ fromJson(inputs.images) }}
steps:
- name: Checkout Repo ⚡️
uses: actions/checkout@v3
@@ -38,7 +34,7 @@ jobs:
- name: Load image to Docker 📥
uses: ./.github/actions/load-image
with:
image: ${{ matrix.image }}
image: ${{ inputs.image }}
platform: ${{ inputs.platform }}
- name: Login to Docker Hub 🔐
@@ -51,12 +47,12 @@ jobs:
- name: Download tags file 📥
uses: actions/download-artifact@v3
with:
name: ${{ matrix.image }}-${{ inputs.platform }}-tags
name: ${{ inputs.image }}-${{ inputs.platform }}-tags
path: /tmp/tags/
- name: Apply tags to the loaded image 🏷
run: python3 -m tagging.apply_tags --short-image-name ${{ matrix.image }} --tags-dir /tmp/tags/ --platform ${{ inputs.platform }} --owner ${{ env.OWNER }}
run: python3 -m tagging.apply_tags --short-image-name ${{ inputs.image }} --tags-dir /tmp/tags/ --platform ${{ inputs.platform }} --owner ${{ env.OWNER }}
- name: Push Images to Docker Hub 📤
if: github.ref == 'refs/heads/main' || github.event_name == 'schedule'
run: docker push --all-tags ${{ env.OWNER }}/${{ matrix.image }}
run: docker push --all-tags ${{ env.OWNER }}/${{ inputs.image }}
shell: bash

View File

@@ -214,22 +214,22 @@ jobs:
aarch64-pyspark,
aarch64-all-spark,
]
strategy:
matrix:
image:
[
base-notebook,
minimal-notebook,
scipy-notebook,
r-notebook,
datascience-notebook,
pyspark-notebook,
all-spark-notebook,
]
uses: ./.github/workflows/docker-tag-manifest-push.yml
with:
platform: aarch64
# https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations
# The strategy property is not supported in any job that calls a reusable workflow
# Using the workaround: https://github.community/t/reusable-workflow-with-strategy-matrix/205676/2
images: >-
[
"base-notebook",
"minimal-notebook",
"scipy-notebook",
"r-notebook",
"datascience-notebook",
"pyspark-notebook",
"all-spark-notebook"
]
image: ${{ matrix.image }}
x86_64-images-tag-push:
secrets:
@@ -246,39 +246,45 @@ jobs:
x86_64-pyspark,
x86_64-all-spark,
]
strategy:
matrix:
image:
[
base-notebook,
minimal-notebook,
scipy-notebook,
r-notebook,
tensorflow-notebook,
datascience-notebook,
pyspark-notebook,
all-spark-notebook,
]
uses: ./.github/workflows/docker-tag-manifest-push.yml
with:
platform: x86_64
images: >-
[
"base-notebook",
"minimal-notebook",
"scipy-notebook",
"r-notebook",
"tensorflow-notebook",
"datascience-notebook",
"pyspark-notebook",
"all-spark-notebook"
]
image: ${{ matrix.image }}
merge-tags:
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
needs: [aarch64-images-tag-push, x86_64-images-tag-push]
strategy:
matrix:
image:
[
base-notebook,
minimal-notebook,
scipy-notebook,
r-notebook,
tensorflow-notebook,
datascience-notebook,
pyspark-notebook,
all-spark-notebook,
]
uses: ./.github/workflows/docker-merge-tags.yml
with:
images: >-
[
"base-notebook",
"minimal-notebook",
"scipy-notebook",
"r-notebook",
"tensorflow-notebook",
"datascience-notebook",
"pyspark-notebook",
"all-spark-notebook"
]
image: ${{ matrix.image }}
wiki-update:
permissions: