mirror of
https://github.com/fleetdm/fleet
synced 2026-04-21 21:47:20 +00:00
Updating actions/setup-go to v6.3.0 from a mix of different versions. This gets us faster CI runs, with improvements such as: - built in Go module cache AND Go build cache (separate cache no longer needed) - using go.mod resulting in fewer cache invalidations - faster Node 24 runtime - using go.dev download URL, which is more reliable
82 lines
2.6 KiB
YAML
82 lines
2.6 KiB
YAML
name: Deploy Loadtest - Shared
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
terraform_action:
|
|
description: Dry run only? No "terraform apply"
|
|
type: choice
|
|
options:
|
|
- plan
|
|
- apply
|
|
- destroy
|
|
default: plan
|
|
|
|
# This allows a subsequently queued workflow run to interrupt previous runs
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id}}
|
|
cancel-in-progress: true
|
|
|
|
defaults:
|
|
run:
|
|
# fail-fast using bash -eo pipefail. See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference
|
|
shell: bash
|
|
working-directory: infrastructure/loadtesting/terraform/infra
|
|
|
|
env:
|
|
AWS_REGION: us-east-2
|
|
AWS_IAM_ROLE: arn:aws:iam::917007347864:role/github-actions-role
|
|
TF_ACTIONS_WORKING_DIR: infrastructure/loadtesting/terraform/shared
|
|
|
|
permissions:
|
|
id-token: write
|
|
contents: read # This is required for actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
|
|
|
|
jobs:
|
|
deploy:
|
|
name: Deploy Fleet Loadtest Environment
|
|
runs-on: ubuntu-latest
|
|
continue-on-error: true
|
|
steps:
|
|
- name: Harden Runner
|
|
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
|
|
with:
|
|
egress-policy: audit
|
|
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
|
|
- id: fail-on-main
|
|
run: "false"
|
|
if: ${{ github.ref == 'main' }}
|
|
- uses: aws-actions/configure-aws-credentials@67fbcbb121271f7775d2e7715933280b06314838 # v1.7.0
|
|
with:
|
|
role-to-assume: ${{env.AWS_IAM_ROLE}}
|
|
aws-region: ${{ env.AWS_REGION }}
|
|
- name: Set up Go
|
|
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
|
|
with:
|
|
go-version-file: 'go.mod'
|
|
- uses: hashicorp/setup-terraform@633666f66e0061ca3b725c73b2ec20cd13a8fdd1 # v2.0.3
|
|
with:
|
|
terraform_version: 1.10.2
|
|
terraform_wrapper: false
|
|
- name: Terraform Init
|
|
id: init
|
|
run: terraform init
|
|
- name: Terraform fmt
|
|
id: fmt
|
|
run: terraform fmt -check
|
|
continue-on-error: true
|
|
- name: Terraform Validate
|
|
id: validate
|
|
run: terraform validate -no-color
|
|
- name: Terraform Plan
|
|
id: plan
|
|
run: terraform plan -no-color
|
|
continue-on-error: true
|
|
- name: Terraform Apply
|
|
if: inputs.terraform_action == 'apply'
|
|
id: apply
|
|
run: terraform apply -auto-approve
|
|
- name: Terraform Destroy
|
|
if: inputs.terraform_action == 'destroy'
|
|
id: destroy
|
|
run: terraform destroy -auto-approve
|