use script file to generate runners

pull/16761/head
John Murret 2023-03-27 12:09:14 -06:00
parent 2e7fc805c9
commit 6e65358f2a
2 changed files with 46 additions and 36 deletions

22
.github/scripts/get_runner_classes.sh vendored Executable file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env bash
#
# This script generates tag-sets that can be used as runs-on: values to select runners.
set -euo pipefail
case "$GITHUB_REPOSITORY" in
*-enterprise)
# shellcheck disable=SC2129
echo "compute-small=['self-hosted', 'linux', 'small']" >> "$GITHUB_OUTPUT"
echo "compute-medium=['self-hosted', 'linux', 'medium']" >> "$GITHUB_OUTPUT"
echo "compute-large=['self-hosted', 'linux', 'large']" >> "$GITHUB_OUTPUT"
echo "compute-xl=['self-hosted', 'ondemand', 'linux', 'type=m5.2xlarge']" >> "$GITHUB_OUTPUT"
;;
*)
# shellcheck disable=SC2129
echo "compute-small=['custom', 'linux', 'small']" >> "$GITHUB_OUTPUT"
echo "compute-medium=['custom', 'linux', 'medium']" >> "$GITHUB_OUTPUT"
echo "compute-large=['custom', 'linux', 'large']" >> "$GITHUB_OUTPUT"
echo "compute-xl=['custom', 'linux', 'xl']" >> "$GITHUB_OUTPUT"
;;
esac

View File

@ -30,11 +30,7 @@ jobs:
steps:
- id: setup-outputs
name: Setup outputs
run: |
echo 'compute-small=["custom", "linux", "small"]' >> $GITHUB_OUTPUT
echo 'compute-medium=["custom", "linux", "medium"]' >> $GITHUB_OUTPUT
echo 'compute-large=["custom", "linux", "large"]' >> $GITHUB_OUTPUT
echo 'compute-xl=["custom", "linux", "xl"]' >> $GITHUB_OUTPUT
run: .github/scripts/get_runner_classes.sh
check-go-mod:
needs:
@ -144,28 +140,30 @@ jobs:
- setup
uses: ./.github/workflows/reusable-dev-build.yml
# create a development build for arm64
dev-build-arm64:
needs:
- setup
uses: ./.github/workflows/reusable-dev-build.yml
with:
uploaded-binary-name: 'consul-bin-arm64'
# runs-on: ${{ needs.setup.outputs.compute-arm64 }}
# TODO(JM): - linux arm64 is not available in our self-hosted runners
# they are currently on the roadmap.
# # create a development build for arm64
# dev-build-arm64:
# needs:
# - setup
# uses: ./.github/workflows/reusable-dev-build.yml
# with:
# uploaded-binary-name: 'consul-bin-arm64'
# # runs-on: ${{ needs.setup.outputs.compute-arm64 }}
go-test-arm64:
# TODO(JM): Fix to run on arm64
needs:
- setup
- dev-build-arm64
uses: ./.github/workflows/reusable-unit-split.yml
with:
directory: .
go-version: "1.20"
uploaded-binary-name: 'consul-bin-arm64'
runner-count: 12
# runs-on: ${{ needs.setup.outputs.compute-arm64 }}
go-test-flags: 'if ! [[ "$GITHUB_REF_NAME" =~ ^main$|^release/ ]]; then export GO_TEST_FLAGS="-short"; fi'
# go-test-arm64:
# # TODO(JM): Fix to run on arm64
# needs:
# - setup
# - dev-build-arm64
# uses: ./.github/workflows/reusable-unit-split.yml
# with:
# directory: .
# go-version: "1.20"
# uploaded-binary-name: 'consul-bin-arm64'
# runner-count: 12
# # runs-on: ${{ needs.setup.outputs.compute-arm64 }}
# go-test-flags: 'if ! [[ "$GITHUB_REF_NAME" =~ ^main$|^release/ ]]; then export GO_TEST_FLAGS="-short"; fi'
go-test:
needs:
@ -176,16 +174,6 @@ jobs:
directory: .
go-version: "1.20"
runner-count: 12
# steps:
# TODO(JM) confirm where this comes from
# and whether it is ok to not get it from an image
# - run: mkdir -p ${{env.TEST_RESULTS}}
# # - name: Download consul
# # run: |
# # mkdir -p $HOME/bin
# # container_id=$(docker create ${{env.CONSUL_OSS_DOCKER_IMAGE}})
# # docker cp "$container_id:/bin/consul" $HOME/bin/consul
# # docker rm "$container_id"
go-test-race:
needs: