Skip to content

Commit

Permalink
Merge pull request #2 from Element84/hm/goose-deploy
Browse files Browse the repository at this point in the history
Fixing Dev Deploy
  • Loading branch information
hectormachin authored Oct 4, 2024
2 parents 54091c7 + 4074937 commit 677240f
Show file tree
Hide file tree
Showing 8 changed files with 262 additions and 134 deletions.
116 changes: 110 additions & 6 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,114 @@ on:

jobs:
deploy-dev:
uses: ./.github/workflows/deploy-wf.yaml
secrets: inherit
concurrency: dev
with:
stage: dev
url: https://console.goose.filmdrop.element84.com
permissions:
id-token: write
contents: read
runs-on: ubuntu-latest
env:
CI: true
STAC_SERVER_TAG: v3.7.0
CIRRUS_TAG: v1.0.0a0
fd-aws-tf-modules-version: v2.29.0
stage: dev
project-name: goose

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "18"
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: "1.7.5"

- name: Preparing Environment
id: prep_env
run: |
echo "Creating terraform backend file ..."
echo '' > config.s3.backend.tf
echo 'terraform {' >> config.s3.backend.tf
echo ' backend "s3" {' >> config.s3.backend.tf
echo ' encrypt = true' >> config.s3.backend.tf
echo " bucket = \"${{ secrets.TF_STATE_BUCKET }}\"" >> config.s3.backend.tf
echo " dynamodb_table = \"${{ secrets.TF_STATE_LOCK_TABLE }}\"" >> config.s3.backend.tf
echo " key = \"${{ env.project-name }}-${{ env.stage }}.tfstate\"" >> config.s3.backend.tf
echo " region = \"${{ secrets.AWS_REGION }}\"" >> config.s3.backend.tf
echo ' }' >> config.s3.backend.tf
echo '}' >> config.s3.backend.tf
cat config.s3.backend.tf
echo "Using FilmDrop Terraform ${{ env.fd-aws-tf-modules-version }} release..."
./scripts/retrieve_tf_modules.sh ${{ env.fd-aws-tf-modules-version }}
- name: Update stac-server lambdas
id: update_stac_lambdas
run: ./scripts/update-stac-server-lambdas.bash

- name: Update cirrus lambda dist
id: update_cirrus_lambda_dist
run: ./scripts/update-cirrus-lambda-dist.bash

- name: Configure Terraform Init Credentials
id: init_creds
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ secrets.AWS_REGION }}
role-to-assume: ${{ secrets.AWS_ROLE }}
role-session-name: GooseTFInit

- name: Terraform Init
id: tf_init
run: terraform init

- name: Terraform Validate
id: tf_validate
run: terraform validate

- name: Configure Terraform Plan Credentials
id: plan_creds
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ secrets.AWS_REGION }}
role-to-assume: ${{ secrets.AWS_ROLE }}
role-session-name: GooseTFPlan

- name: Terraform Plan
id: tf_plan
run: terraform plan -var-file="${{ inputs.stage }}.tfvars" -out ${{ inputs.stage }}.tfplan -lock=false

- name: Configure Terraform Apply Credentials
id: apply_creds
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ secrets.AWS_REGION }}
role-to-assume: ${{ secrets.AWS_ROLE }}
role-session-name: GooseTFApply

- name: Terraform Apply
id: tf_apply
run: terraform apply -lock=false -input=false ${{ inputs.stage }}.tfplan

- name: Post status to Slack channel
id: tf_apply_successs
if: steps.tf_apply.outcome == 'success'
continue-on-error: true
uses: slackapi/[email protected]
with:
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
slack-message: ":silly-goose: ${{ env.project-name }}-${{ inputs.stage }}-titiler ${{ github.ref_name }} terraform apply job has succeeded!\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

- name: Post status to Slack channel
id: tf_apply_failure
if: steps.tf_apply.outcome != 'success'
continue-on-error: true
uses: slackapi/[email protected]
with:
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
slack-message: ":goosebonk: ${{ env.project-name }}-${{ inputs.stage }}-titiler ${{ github.ref_name }} terraform apply has failed!\n:alert: make sure cleanup job deletes all AWS resources!\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
121 changes: 0 additions & 121 deletions .github/workflows/deploy-wf.yml

This file was deleted.

4 changes: 1 addition & 3 deletions .github/workflows/snyk-scan.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# This workflow sets up Snyk scans

name: Snyk Scan
name: 🛡️ Snyk Scan

on:
push:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Pre-commit CI
name: 📝 Validation

on:
push:
Expand Down Expand Up @@ -83,7 +83,7 @@ jobs:
with:
aws-region: ${{ secrets.AWS_REGION }}
role-to-assume: ${{ secrets.AWS_ROLE }}
role-session-name: GitHubReleaseInit
role-session-name: GooseValidate

- name: Terraform Init
id: tf_init
Expand Down
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @hectormachin
Loading

0 comments on commit 677240f

Please sign in to comment.