From 0b5ef401a0b7116422dd32ae6781b010b11f60a9 Mon Sep 17 00:00:00 2001 From: Mauro Ezequiel Moltrasio Date: Fri, 15 Mar 2024 12:14:28 +0100 Subject: [PATCH] Simplify builder tag definition a bit --- .github/workflows/collector-builder.yml | 39 ++++++++++++------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/.github/workflows/collector-builder.yml b/.github/workflows/collector-builder.yml index d8f74a536b..71fceccb06 100644 --- a/.github/workflows/collector-builder.yml +++ b/.github/workflows/collector-builder.yml @@ -11,7 +11,7 @@ on: outputs: collector-builder-tag: description: The builder tag used by the build - value: ${{ jobs.builder-setup-environment.outputs.collector-builder-tag }} + value: ${{ jobs.builder-needs-rebuilding.outputs.collector-builder-tag }} env: COLLECTOR_TAG: ${{ inputs.collector-tag }} @@ -24,6 +24,7 @@ jobs: runs-on: ubuntu-latest outputs: build-image: ${{ steps.changed.outputs.builder-changed }} + collector-builder-tag: ${{ steps.set-builder-tag.outputs.collector-builder-tag || 'master' }} steps: - uses: actions/checkout@v4 @@ -37,14 +38,14 @@ jobs: - builder/third_party/** - builder/Dockerfile - builder-setup-environment: - name: Setup environment - runs-on: ubuntu-latest - outputs: - collector-builder-tag: ${{ steps.builder-tag.outputs.collector-builder-tag }} - steps: - - name: Define builder tag - id: builder-tag + - name: Set builder tag + id: set-builder-tag + if: | + steps.changed.outputs.builder-changed || + contains(github.event.pull_request.labels.*.name, 'build-builder-image') || ( + github.event_name == 'push' && ( + github.ref_type == 'tag' || startsWith(github.ref_name, 'release-') + )) run: | COLLECTOR_BUILDER_TAG="${DEFAULT_BUILDER_TAG}" if [[ "${{ github.event_name }}" == 'pull_request' || \ @@ -61,7 +62,6 @@ jobs: timeout-minutes: 480 needs: - builder-needs-rebuilding - - builder-setup-environment if: | needs.builder-needs-rebuilding.outputs.build-image == 'true' || (github.event_name == 'push' && ( @@ -76,7 +76,7 @@ jobs: env: PLATFORM: linux/${{ matrix.arch }} BUILD_TYPE: ci - COLLECTOR_BUILDER_TAG: ${{ needs.builder-setup-environment.outputs.collector-builder-tag }} + COLLECTOR_BUILDER_TAG: ${{ needs.builder-needs-rebuilding.outputs.collector-builder-tag }} steps: - uses: actions/checkout@v4 @@ -122,7 +122,6 @@ jobs: timeout-minutes: 480 needs: - builder-needs-rebuilding - - builder-setup-environment if: | needs.builder-needs-rebuilding.outputs.build-image == 'true' || ( github.event_name == 'push' && ( @@ -139,7 +138,7 @@ jobs: env: PLATFORM: linux/${{ matrix.arch }} BUILD_TYPE: ci - COLLECTOR_BUILDER_TAG: ${{ needs.builder-setup-environment.outputs.collector-builder-tag }} + COLLECTOR_BUILDER_TAG: ${{ needs.builder-needs-rebuilding.outputs.collector-builder-tag }} steps: - uses: actions/checkout@v4 @@ -203,18 +202,18 @@ jobs: create-multiarch-manifest: needs: - - builder-setup-environment + - builder-needs-rebuilding - build-builder-image - build-builder-image-remote-vm name: Create Multiarch manifest runs-on: ubuntu-latest if: | github.event_name == 'push' || ( - needs.builder-setup-environment.outputs.collector-builder-tag != 'master' && - contains(github.event.pull_request.labels.*.name, 'run-multiarch-builds') + needs.builder-needs-rebuilding.outputs.collector-builder-tag != 'master' && + contains(github.event.pull_request.labels.*.name, 'run-multiarch-builds') ) env: - COLLECTOR_BUILDER_TAG: ${{ needs.builder-setup-environment.outputs.collector-builder-tag }} + COLLECTOR_BUILDER_TAG: ${{ needs.builder-needs-rebuilding.outputs.collector-builder-tag }} ARCHS: amd64 ppc64le s390x arm64 steps: @@ -248,16 +247,16 @@ jobs: retag-x86-image: needs: - - builder-setup-environment + - builder-needs-rebuilding - build-builder-image name: Retag x86 builder image runs-on: ubuntu-latest if: | github.event_name == 'pull_request' && - needs.builder-setup-environment.outputs.collector-builder-tag != 'master' && + needs.builder-needs-rebuilding.outputs.collector-builder-tag != 'master' && !contains(github.event.pull_request.labels.*.name, 'run-multiarch-builds') env: - COLLECTOR_BUILDER_TAG: ${{ needs.builder-setup-environment.outputs.collector-builder-tag }} + COLLECTOR_BUILDER_TAG: ${{ needs.builder-needs-rebuilding.outputs.collector-builder-tag }} steps: - name: Pull image to retag run: |