From 5cd9587649d06db098c66226271517f21538e3ce Mon Sep 17 00:00:00 2001 From: Thomas Labarussias Date: Fri, 27 Oct 2023 00:31:29 +0200 Subject: [PATCH] clean up workflows to have successive steps Signed-off-by: Thomas Labarussias --- .../{build-image.yml => build-images.yml} | 9 ++++----- .github/workflows/lint.yml | 10 +++------- .github/workflows/pull-request.yaml | 14 ++++++++++++++ .github/workflows/push-main.yml | 11 +++++++++-- .github/workflows/release.yml | 8 ++++++++ .github/workflows/{test.yml => tests.yml} | 7 ++----- docs/outputs/pagerduty.md | 2 +- 7 files changed, 41 insertions(+), 20 deletions(-) rename .github/workflows/{build-image.yml => build-images.yml} (93%) create mode 100644 .github/workflows/pull-request.yaml rename .github/workflows/{test.yml => tests.yml} (86%) diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-images.yml similarity index 93% rename from .github/workflows/build-image.yml rename to .github/workflows/build-images.yml index fabbedc2f..068803364 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-images.yml @@ -1,13 +1,12 @@ -name: build-ci-images +name: build-images on: - pull_request: + workflow_call: jobs: - build-image: - + build-images: + name: Build the images runs-on: ubuntu-latest - steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 05856cc5e..65dcdfb77 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,17 +1,13 @@ name: lint on: - workflow_dispatch: - push: - branches: - - master - pull_request: + workflow_call: permissions: read-all jobs: - golangci: - name: lint + lint: + name: Lint runs-on: ubuntu-latest steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 diff --git a/.github/workflows/pull-request.yaml b/.github/workflows/pull-request.yaml new file mode 100644 index 000000000..48776e832 --- /dev/null +++ b/.github/workflows/pull-request.yaml @@ -0,0 +1,14 @@ +name: pull-request + +on: + pull_request: + +jobs: + lint: + uses: ./.github/workflows/lint.yml + tests: + needs: lint + uses: ./.github/workflows/tests.yml + build-images: + needs: [lint, tests] + uses: ./.github/workflows/build-images.yml diff --git a/.github/workflows/push-main.yml b/.github/workflows/push-main.yml index b576b9f3e..5f938c015 100644 --- a/.github/workflows/push-main.yml +++ b/.github/workflows/push-main.yml @@ -1,4 +1,4 @@ -name: push-ci-images +name: push-main on: workflow_dispatch: @@ -7,7 +7,14 @@ on: - master jobs: - build-push-image: + lint: + uses: ./.github/workflows/lint.yml + tests: + needs: lint + uses: ./.github/workflows/tests.yml + + build-push-images: + name: Build and Push latest images permissions: contents: read id-token: write diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3050312df..1cd521555 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,7 +12,14 @@ permissions: id-token: write # needed for keyless signing jobs: + lint: + uses: ./.github/workflows/lint.yml + tests: + needs: lint + uses: ./.github/workflows/tests.yml + release: + name: Create a release outputs: hashes: ${{ steps.hash.outputs.hashes }} tag_name: ${{ steps.tag.outputs.tag_name }} @@ -87,6 +94,7 @@ jobs: echo "hashes=$(cat $checksum_file | base64 -w0)" >> "$GITHUB_OUTPUT" provenance: + name: Set up the provenance needs: [release] permissions: actions: read # To read the workflow path. diff --git a/.github/workflows/test.yml b/.github/workflows/tests.yml similarity index 86% rename from .github/workflows/test.yml rename to .github/workflows/tests.yml index 18ba1529b..b2cbdf7ee 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/tests.yml @@ -1,13 +1,10 @@ name: tests on: - push: - branches: - - master - pull_request: + workflow_call: jobs: - unit-tests: + tests: name: Run unit tests permissions: contents: read diff --git a/docs/outputs/pagerduty.md b/docs/outputs/pagerduty.md index fbca74b1b..e93294221 100644 --- a/docs/outputs/pagerduty.md +++ b/docs/outputs/pagerduty.md @@ -16,7 +16,7 @@ | Setting | Env var | Default value | Description | | --------------------------- | --------------------------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------- | -| `pagerduty.routingkey` | `PAGERDUTY_APIKEY` | | Pagerduty Routing Key, if not empty, Pagerduty output is **enabled** | +| `pagerduty.routingkey` | `PAGERDUTY_ROUTINGKEY` | | Pagerduty Routing Key, if not empty, Pagerduty output is **enabled** | | `pagerduty.region` | `PAGERDUTY_REGION` | `us` | Pagerduty Region (`us`, `eu`) | | `pagerduty.minimumpriority` | `PAGERDUTY_MINIMUMPRIORITY` | `""` (= `debug`) | Minimum priority of event for using this output, order is `emergency,alert,critical,error,warning,notice,informational,debug or ""` |