ci: Add success jobs. make go-test-enterprise conditional. build-distros and go-tests trigger on push to main and release branches (#16905)

* Add go-tests-success job and make go-test-enterprise conditional

* fixing lint-32bit reference

* fixing reference to -go-test-troubleshoot

* add all jobs that fan out.

* fixing success job to need set up

* add echo to success job

* adding success jobs to build-artifacts, build-distros, and frontend.

* changing the name of the job in verify ci to be consistent with other workflows

* enable go-tests, build-distros, and verify-ci to run on merge to main and release branches because they currently do not with just the pull_request trigger
This commit is contained in:
John Murret 2023-04-06 16:29:32 -06:00 committed by GitHub
parent 7b1a90cdbe
commit dacc1dcbf9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 149 additions and 4 deletions

View File

@ -95,3 +95,29 @@ jobs:
tags: |
hashicorpdev/${{ github.event.repository.name }}:${{ env.SHORT_SHA }}
hashicorpdev/${{ github.event.repository.name }}:latest
# This is job is required for branch protection as a required gihub check
# because GitHub actions show up as checks at the job level and not the
# workflow level. This is currently a feature request:
# https://github.com/orgs/community/discussions/12395
#
# This job must:
# - be placed after the fanout of a workflow so that everything fans back in
# to this job.
# - "need" any job that is part of the fan out / fan in
# - implement the if logic because we have conditional jobs
# (go-test-enteprise) that this job needs and this would potentially get
# skipped if a previous job got skipped. So we use the if clause to make
# sure it does not get skipped.
build-artifacts-success:
needs:
- setup
- dev-build-push
runs-on: ${{ fromJSON(needs.setup.outputs.compute-small) }}
if: |
(always() && ! cancelled()) &&
!contains(needs.*.result, 'failure') &&
!contains(needs.*.result, 'cancelled')
steps:
- run: echo "build-artifacts succeeded"

View File

@ -2,7 +2,13 @@
# It is aimed at checking new commits don't introduce any breaking build changes.
name: build-distros
on: [pull_request]
on:
pull_request:
push:
branches:
# Push events on the main branch
- main
- release/**
permissions:
contents: read
@ -106,3 +112,32 @@ jobs:
- run: CC=arm-linux-gnueabi-gcc GOARCH=arm GOARM=5 go build
- run: CC=arm-linux-gnueabihf-gcc GOARCH=arm GOARM=6 go build
- run: CC=aarch64-linux-gnu-gcc GOARCH=arm64 go build
# This is job is required for branch protection as a required gihub check
# because GitHub actions show up as checks at the job level and not the
# workflow level. This is currently a feature request:
# https://github.com/orgs/community/discussions/12395
#
# This job must:
# - be placed after the fanout of a workflow so that everything fans back in
# to this job.
# - "need" any job that is part of the fan out / fan in
# - implement the if logic because we have conditional jobs
# (go-test-enteprise) that this job needs and this would potentially get
# skipped if a previous job got skipped. So we use the if clause to make
# sure it does not get skipped.
build-distros-success:
needs:
- setup
- check-go-mod
- build-386
- build-amd64
- build-arm
runs-on: ${{ fromJSON(needs.setup.outputs.compute-small) }}
if: |
(always() && ! cancelled()) &&
!contains(needs.*.result, 'failure') &&
!contains(needs.*.result, 'cancelled')
steps:
- run: echo "build-distros succeeded"

View File

@ -104,3 +104,31 @@ jobs:
- working-directory: ui/packages/consul-ui
run: make test-coverage-ci
# This is job is required for branch protection as a required gihub check
# because GitHub actions show up as checks at the job level and not the
# workflow level. This is currently a feature request:
# https://github.com/orgs/community/discussions/12395
#
# This job must:
# - be placed after the fanout of a workflow so that everything fans back in
# to this job.
# - "need" any job that is part of the fan out / fan in
# - implement the if logic because we have conditional jobs
# (go-test-enteprise) that this job needs and this would potentially get
# skipped if a previous job got skipped. So we use the if clause to make
# sure it does not get skipped.
frontend-success:
needs:
- setup
- workspace-tests
- node-tests
- ember-build-test
runs-on: ${{ fromJSON(needs.setup.outputs.compute-small) }}
if: |
(always() && ! cancelled()) &&
!contains(needs.*.result, 'failure') &&
!contains(needs.*.result, 'cancelled')
steps:
- run: echo "frontend succeeded"

View File

@ -10,6 +10,11 @@ on:
- 'backport/docs/**'
- 'backport/ui/**'
- 'backport/mktg-**'
push:
branches:
# Push events on the main branch
- main
- release/**
permissions:
contents: read
@ -227,6 +232,7 @@ jobs:
consul-license: ${{secrets.CONSUL_LICENSE}}
go-test-enterprise:
if: ${{ endsWith(github.repository, '-enterprise') }}
needs:
- setup
- dev-build
@ -361,3 +367,47 @@ jobs:
runs-on: ubuntu-latest
steps:
- run: "echo ok"
# This is job is required for branch protection as a required gihub check
# because GitHub actions show up as checks at the job level and not the
# workflow level. This is currently a feature request:
# https://github.com/orgs/community/discussions/12395
#
# This job must:
# - be placed after the fanout of a workflow so that everything fans back in
# to this job.
# - "need" any job that is part of the fan out / fan in
# - implement the if logic because we have conditional jobs
# (go-test-enteprise) that this job needs and this would potentially get
# skipped if a previous job got skipped. So we use the if clause to make
# sure it does not get skipped.
go-tests-success:
needs:
- setup
- check-generated-deep-copy
- check-generated-protobuf
- check-go-mod
- lint-consul-retry
- lint-container-test-deps
- lint-enums
- lint
- lint-32bit
# - go-test-arm64
- go-test-enterprise
- go-test-oss
- go-test-race
- go-test-envoyextensions
- go-test-troubleshoot
- go-test-api-1-19
- go-test-api-1-20
- go-test-sdk-1-19
- go-test-sdk-1-20
- go-test-32bit
runs-on: ${{ fromJSON(needs.setup.outputs.compute-small) }}
if: |
(always() && ! cancelled()) &&
!contains(needs.*.result, 'failure') &&
!contains(needs.*.result, 'cancelled')
steps:
- run: echo "go-tests succeeded"

View File

@ -8,10 +8,16 @@ name: verify-ci
permissions:
contents: read
on: [pull_request]
on:
pull_request:
push:
branches:
# Push events on the main branch
- main
- release/**
jobs:
noop:
verify-ci-success:
runs-on: ubuntu-latest
steps:
- run: echo "ok"
- run: echo "verify-ci succeeded"