2022-07-11 19:30:36 +00:00
name : Deploy Dogfood Environment
2022-10-07 15:43:56 +00:00
2022-05-25 18:03:29 +00:00
on :
workflow_dispatch :
inputs :
2022-12-08 18:11:33 +00:00
DOCKER_IMAGE :
2023-04-25 18:22:59 +00:00
description: 'The full name of the docker image to be deployed. (e.g. fleetdm/fleet:v4.30.0). Note : do not use fleetdm/fleet:main directly. Use the short hash instead. If pull-rate limited, try using the quay.io/fleetdm/fleet mirror.'
2022-05-25 18:03:29 +00:00
required : true
2022-10-24 20:01:00 +00:00
# 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
2022-10-07 15:43:56 +00:00
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
2023-03-08 21:38:53 +00:00
working-directory : infrastructure/dogfood/terraform/aws-tf-module
2022-10-07 15:43:56 +00:00
2022-05-25 18:03:29 +00:00
env :
AWS_REGION : us-east-2
ECR_REPOSITORY : fleet-test
AWS_IAM_ROLE : arn:aws:iam::160035666661:role/github-actions-role
2023-03-08 21:38:53 +00:00
TF_ACTIONS_WORKING_DIR : infrastructure/dogfood/terraform/aws-tf-module
2022-05-25 18:03:29 +00:00
TF_WORKSPACE : fleet
2022-12-08 18:11:33 +00:00
TF_VAR_fleet_image : ${{ github.event.inputs.DOCKER_IMAGE || 'fleetdm/fleet:main' }}
2022-05-25 18:03:29 +00:00
TF_VAR_fleet_license : ${{ secrets.DOGFOOD_LICENSE_KEY }}
2023-03-16 21:56:46 +00:00
TF_VAR_slack_webhook : ${{ secrets.SLACK_G_HELP_P1_WEBHOOK_URL }}
2023-04-03 19:12:16 +00:00
TF_VAR_fleet_sentry_dsn : ${{ secrets.DOGFOOD_SENTRY_DSN }}
2023-04-24 15:25:57 +00:00
TF_VAR_elastic_url : ${{ secrets.ELASTIC_APM_SERVER_URL }}
TF_VAR_elastic_token : ${{ secrets.ELASTIC_APM_SECRET_TOKEN }}
2023-12-14 19:22:11 +00:00
TF_VAR_geolite2_license : ${{ secrets.MAXMIND_LICENSE }}
2022-05-25 18:03:29 +00:00
permissions :
id-token : write
2022-08-31 10:44:22 +00:00
contents : read # This is required for actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
2022-05-25 18:03:29 +00:00
jobs :
deploy :
name : Deploy Fleet Dogfood Environment
runs-on : ubuntu-latest
steps :
2022-08-31 10:44:22 +00:00
- uses : actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
2022-09-29 17:30:47 +00:00
- id : fail-on-main
run : "false"
if : ${{ github.ref == 'main' }}
2023-03-01 01:55:38 +00:00
- uses : aws-actions/configure-aws-credentials@67fbcbb121271f7775d2e7715933280b06314838 # v1.7.0
2022-05-25 18:03:29 +00:00
with :
role-to-assume : ${{env.AWS_IAM_ROLE}}
aws-region : ${{ env.AWS_REGION }}
2023-11-01 21:34:13 +00:00
- name : Set up Go
uses : actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with :
2023-12-13 16:57:12 +00:00
go-version : ${{ vars.GO_VERSION }}
2023-03-01 01:55:38 +00:00
- uses : hashicorp/setup-terraform@633666f66e0061ca3b725c73b2ec20cd13a8fdd1 # v2.0.3
2022-05-25 18:03:29 +00:00
with :
2023-11-01 21:34:13 +00:00
terraform_version : 1.6 .3
2022-05-25 18:03:29 +00:00
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
# first we'll scale everything down and create the new task definitions
2023-03-15 16:41:25 +00:00
- name : Terraform Apply
id : apply
2022-05-25 18:03:29 +00:00
run : terraform apply -auto-approve