From 65f49046511083080530b5dd8cfc47205e64630b Mon Sep 17 00:00:00 2001 From: Hedingber Date: Wed, 13 Jul 2022 11:34:56 +0300 Subject: [PATCH] [CI] Enable to skip images in Build workflow (#2126) --- .github/workflows/build-workflow-matrix.json | 23 +++++++++++++++++ .github/workflows/build.yaml | 26 +++++++++++++------- .github/workflows/release.yaml | 2 +- 3 files changed, 41 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/build-workflow-matrix.json diff --git a/.github/workflows/build-workflow-matrix.json b/.github/workflows/build-workflow-matrix.json new file mode 100644 index 00000000000..c85366c9f55 --- /dev/null +++ b/.github/workflows/build-workflow-matrix.json @@ -0,0 +1,23 @@ +[ + { + "image-name":"mlrun" + }, + { + "image-name":"api" + }, + { + "image-name":"base" + }, + { + "image-name":"models" + }, + { + "image-name":"models-gpu" + }, + { + "image-name":"jupyter" + }, + { + "image-name":"test" + } +] diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 80bebe419c1..b3e12327d2e 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -21,24 +21,32 @@ on: description: 'The version to build, without prefix v (e.g. 1.1.0), if not provided version will be -' required: false default: '' + skip_images: + description: 'Comma separated list of images to skip building, example with all possible images: mlrun,api,base,models,models-gpu,jupyter,test' + required: false + default: '' jobs: + matrix_prep: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - uses: actions/checkout@v2 + - id: set-matrix + run: | + skipImages=,${{ github.event.inputs.skip_images }}, + matrix=$(jq --arg skipImages "$skipImages" 'map(. | select(",\(."image-name")," | inside($skipImages)|not))' ./.github/workflows/build-workflow-matrix.json) + echo ::set-output name=matrix::{\"include\":$(echo $matrix)} build-images: name: Build and push image - ${{ matrix.image-name }} runs-on: ubuntu-latest + needs: matrix_prep # let's not run this on every fork, change to your fork when developing if: github.repository == 'mlrun/mlrun' || github.event_name == 'workflow_dispatch' strategy: - matrix: - image-name: - - mlrun - - api - - base - - models - - models-gpu - - jupyter - - test + matrix: ${{fromJson(needs.matrix_prep.outputs.matrix)}} steps: - uses: actions/checkout@v2 - name: Install curl and jq diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index d0cd721c216..c604692e176 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -58,7 +58,7 @@ jobs: MLRUN_VERSION=${{ github.event.inputs.version }} make publish-package create-releases: - name: Create release & tag + name: Create release & tag v${{ github.event.inputs.version }} runs-on: ubuntu-latest needs: publish-to-pypi steps: