mirror of
https://github.com/openziti/ziti.git
synced 2026-10-27 05:57:06 +00:00
2d6573eb30
- adds a scheduled sweeper that terminates CI fablab instances (Name gh-*) launched more than 7 hours ago in every enabled region and deletes their VPCs; EC2 records no VPC creation time, so it ages each VPC from a tag it writes on first sight, and it reports every find as a workflow warning - adds a stop-fablab action that interrupts the fablab command and terraform a cancelled step left running, and waits for terraform to save its state; the smoketest, validation, upgrade and backward compatibility jobs run it before they archive or tear down their environment - moves the housekeeper's VPC teardown into a file the sweeper shares, and waits on instances already shutting down before deleting the subnet they hold - fixes the HA smoketest teardown's skip condition, which named a job that doesn't exist
109 lines
3.5 KiB
YAML
109 lines
3.5 KiB
YAML
on:
|
|
workflow_call:
|
|
inputs:
|
|
test:
|
|
description: The test to run
|
|
type: string
|
|
required: true
|
|
duration:
|
|
description: How long to run the test for
|
|
type: string
|
|
required: false
|
|
default: '2h'
|
|
|
|
# cancel older, redundant runs of same workflow on same branch
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{github.event_name}}-${{ github.head_ref || github.ref_name }}-${{ inputs.test }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
GOFLAGS: "-trimpath"
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
AWS_DEFAULT_REGION: "us-east-2"
|
|
gh_ci_key: ${{ secrets.GH_CI_KEY }}
|
|
BUILD_NUMBER: ${{ format('{0}-{1}-{2}', github.run_id, github.run_number, github.run_attempt) }}
|
|
TEST_TYPE: ${{ inputs.test }}
|
|
TEST_DURATION: ${{ inputs.duration }}
|
|
|
|
jobs:
|
|
validation-test:
|
|
name: ${{ inputs.test }} validation
|
|
# not applicable to forks. shouldn't run on release build
|
|
if: github.repository_owner == 'openziti'
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- name: Git Checkout
|
|
uses: actions/checkout@v7
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Install Go
|
|
uses: ./.github/actions/setup-go
|
|
|
|
- name: Install Ziti CI
|
|
uses: openziti/ziti-ci@v1
|
|
|
|
- name: Install Terraform CLI
|
|
uses: hashicorp/setup-terraform@v4
|
|
with:
|
|
terraform_version: ~1.5
|
|
|
|
- name: Build and Test
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
ziti_ci_gpg_key: ${{ secrets.ZITI_CI_GPG_KEY }}
|
|
ziti_ci_gpg_key_id: ${{ secrets.ZITI_CI_GPG_KEY_ID }}
|
|
shell: bash
|
|
run: |
|
|
$(go env GOPATH)/bin/ziti-ci configure-git
|
|
$(go env GOPATH)/bin/ziti-ci generate-build-info common/version/info_generated.go version
|
|
pushd zititest && go mod tidy && go install -tags all ./... && popd
|
|
go install -tags=all,tests ./...
|
|
|
|
- name: Create Test Environment
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
shell: bash
|
|
run: |
|
|
echo "ZITI_ROOT=$(go env GOPATH)/bin" >> "$GITHUB_ENV"
|
|
$(go env GOPATH)/bin/${TEST_TYPE} create -d ${TEST_TYPE}-${GITHUB_RUN_NUMBER} -n ${TEST_TYPE}-${GITHUB_RUN_NUMBER} -l environment=gh-fablab-${TEST_TYPE},ziti_version=$($(go env GOPATH)/bin/ziti-ci -q get-current-version)
|
|
$(go env GOPATH)/bin/${TEST_TYPE} up
|
|
$(go env GOPATH)/bin/${TEST_TYPE} exec validateUp
|
|
|
|
- name: Run Validation Loop
|
|
shell: bash
|
|
timeout-minutes: 380
|
|
run: |
|
|
echo "ZITI_ROOT=$(go env GOPATH)/bin" >> "$GITHUB_ENV"
|
|
$(go env GOPATH)/bin/${TEST_TYPE} exec-loop ${TEST_DURATION} testIteration
|
|
|
|
- name: Stop Fablab
|
|
# a cancelled step leaves fablab and terraform running, and teardown needs terraform's final state
|
|
if: always()
|
|
timeout-minutes: 15
|
|
uses: ./.github/actions/stop-fablab
|
|
with:
|
|
model: ${{ env.TEST_TYPE }}
|
|
|
|
- name: Create Logs Archive
|
|
if: always()
|
|
run: |
|
|
$(go env GOPATH)/bin/${TEST_TYPE} get files '*' "./logs/{{ .Id }}/" ./logs
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v7
|
|
if: always()
|
|
with:
|
|
name: ${{ env.TEST_TYPE }}-logs-${{ github.run_id }}
|
|
path: logs/
|
|
compression-level: 7
|
|
retention-days: 5
|
|
|
|
- name: Tear down Test Environment
|
|
timeout-minutes: 30
|
|
if: always()
|
|
shell: bash
|
|
run: |
|
|
$(go env GOPATH)/bin/${TEST_TYPE} dispose
|