From a16267b31d6c01a407d7e7e859c091e2ecd273ea Mon Sep 17 00:00:00 2001 From: Yifei Zhang Date: Mon, 23 Oct 2023 16:23:56 +1100 Subject: [PATCH] CLIP-1832: Yifei test Terraform installation. --- .github/workflows/yifei-test.yaml | 55 +++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/yifei-test.yaml diff --git a/.github/workflows/yifei-test.yaml b/.github/workflows/yifei-test.yaml new file mode 100644 index 00000000..ede79477 --- /dev/null +++ b/.github/workflows/yifei-test.yaml @@ -0,0 +1,55 @@ +name: Yifei Test Terraform installation +on: + push: + branches: + - main + paths-ignore: # https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#example-ignoring-paths + - 'docs/**' + - '.atlassian/**' + - 'test/unittest**' + pull_request_target: + types: [ labeled ] + workflow_dispatch: + +jobs: + test: + if: ${{ github.event.label.name == 'e2e' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' }} + name: Yifei Test Terraform installation + runs-on: ubuntu-latest + permissions: + id-token: write + contents: read + env: + AWS_DEFAULT_REGION: us-east-1 + SLACK_WEBHOOK_URL_ALERTS: ${{ secrets.SLACK_WEBHOOK_URL_ALERTS }} + SLACK_WEBHOOK_URL_NOTIFICATIONS: ${{ secrets.SLACK_WEBHOOK_URL_NOTIFICATIONS }} + AWS_ADDITIONAL_ROLE: ${{ secrets.AWS_ADDITIONAL_ROLE }} + TF_VAR_bamboo_license: ${{ secrets.TF_VAR_BAMBOO_LICENSE }} + TF_VAR_confluence_license: ${{ secrets.TF_VAR_CONFLUENCE_LICENSE }} + TF_VAR_bitbucket_license: ${{ secrets.TF_VAR_BITBUCKET_LICENSE }} + TF_VAR_crowd_license: ${{ secrets.TF_VAR_CROWD_LICENSE }} + TF_VAR_bamboo_admin_password: ${{ secrets.TF_VAR_BAMBOO_ADMIN_PASSWORD }} + TF_VAR_crowd_admin_password: ${{ secrets.TF_VAR_CROWD_ADMIN_PASSWORD }} + TF_VAR_bitbucket_admin_password: ${{ secrets.TF_VAR_BITBUCKET_ADMIN_PASSWORD }} + TF_VAR_kinesis_log_producers_role_arns: ${{ secrets.TF_VAR_KINESIS_LOG_PRODUCERS_ROLE_ARNS }} + TF_VAR_osquery_fleet_enrollment_secret_name: ${{ secrets.TF_VAR_OSQUERY_FLEET_ENROLLMENT_SECRET_NAME }} + TF_VAR_osquery_fleet_enrollment_host: ${{ secrets.TF_VAR_OSQUERY_FLEET_ENROLLMENT_HOST }} + USE_DOMAIN: "false" + + steps: + - name: Checkout + uses: actions/checkout@v3.1.0 + with: + ref: ${{ github.event.pull_request.head.sha }} + + - name: Install the latest Terraform + run: | + # check existing version + terraform -version + # download the latest + URL=$(curl -fsSL https://api.releases.hashicorp.com/v1/releases/terraform/latest | jq -r '.builds[] | select((.arch=="amd64") and (.os=="linux")).url') + curl -s -o /tmp/terraform.zip ${URL} + echo y | unzip /tmp/terraform.zip -d /usr/local/bin/ + rm /tmp/terraform.zip + # check the latest version + terraform -version