Skip to content

Commit

Permalink
Simplify builder tag definition a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
Molter73 committed Mar 15, 2024
1 parent 93a9dc7 commit 0b5ef40
Showing 1 changed file with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions .github/workflows/collector-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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
Expand All @@ -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' || \
Expand All @@ -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' && (
Expand All @@ -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
Expand Down Expand Up @@ -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' && (
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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: |
Expand Down

0 comments on commit 0b5ef40

Please sign in to comment.