Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/dashboard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: 65-dashboard
run-name: "[${{ github.event_name == 'push' && 'APPLY' || 'PLAN' }}] 65-dashboard → ${{ github.event_name == 'push' && github.ref_name || github.head_ref }}"

on:
push:
branches:
- main
paths:
- "ops/services/65-dashboard/**"
pull_request:
branches:
- main
paths:
- "ops/services/65-dashboard/**"

concurrency:
group: tofu-plan-or-apply

permissions:
contents: read
id-token: write

env:
TENV_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Comment thread
gfreeman-navapbc marked this conversation as resolved.
Outdated

jobs:
setup:
permissions:
contents: read
id-token: write
runs-on: codebuild-ab2d-prod-${{ github.run_id }}-${{ github.run_attempt }}
Comment thread
gfreeman-navapbc marked this conversation as resolved.
Outdated
outputs:
apply: ${{ steps.check.outputs.apply }}
branch: ${{ steps.check.outputs.branch }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.3.0
- id: check
run: |
echo "apply=${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}" >> $GITHUB_OUTPUT
echo "branch=${{ github.head_ref || github.ref }}" >> $GITHUB_OUTPUT

prod:
needs: setup
uses: ./.github/workflows/tofu-run.yml
with:
service: "65-dashboard"
environment: "prod"
apply: ${{ needs.setup.outputs.apply }}
branch: ${{ needs.setup.outputs.branch }}
secrets: inherit
77 changes: 77 additions & 0 deletions .github/workflows/monitors.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: 60-monitors
run-name: "[${{ github.event_name == 'push' && 'APPLY' || 'PLAN' }}] 60-monitors → ${{ github.event_name == 'push' && github.ref_name || github.head_ref }}"

on:
push:
branches:
- main
paths:
- "ops/services/60-monitors/**"
pull_request:
branches:
- main
paths:
- "ops/services/60-monitors/**"

concurrency:
group: tofu-plan-or-apply

permissions:
contents: read
id-token: write

env:
TENV_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Comment thread
gfreeman-navapbc marked this conversation as resolved.
Outdated

jobs:
setup:
runs-on: codebuild-ab2d-non-prod-${{ github.run_id }}-${{ github.run_attempt }}
outputs:
apply: ${{ steps.check.outputs.apply }}
branch: ${{ steps.check.outputs.branch }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.3.0
- id: check
run: |
echo "apply=${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}" >> $GITHUB_OUTPUT
echo "branch=${{ github.head_ref || github.ref }}" >> $GITHUB_OUTPUT

dev:
needs: setup
uses: ./.github/workflows/tofu-run.yml
with:
service: "60-monitors"
environment: "dev"
apply: ${{ needs.setup.outputs.apply }}
branch: ${{ needs.setup.outputs.branch }}
secrets: inherit

test:
needs: [setup, dev]
uses: ./.github/workflows/tofu-run.yml
with:
service: "60-monitors"
environment: "test"
apply: ${{ needs.setup.outputs.apply }}
branch: ${{ needs.setup.outputs.branch }}
secrets: inherit

sandbox:
needs: [setup, test]
uses: ./.github/workflows/tofu-run.yml
with:
service: "60-monitors"
environment: "sandbox"
apply: ${{ needs.setup.outputs.apply }}
branch: ${{ needs.setup.outputs.branch }}
secrets: inherit

prod:
needs: [setup, sandbox]
uses: ./.github/workflows/tofu-run.yml
with:
service: "60-monitors"
environment: "prod"
apply: ${{ needs.setup.outputs.apply }}
branch: ${{ needs.setup.outputs.branch }}
secrets: inherit
52 changes: 52 additions & 0 deletions .github/workflows/tofu-run.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: tofu-run

on:
workflow_call:
inputs:
service:
required: true
type: string
environment:
required: true
type: string
apply:
required: true
type: string
branch:
required: true
type: string

jobs:
tofu:
permissions:
contents: read
id-token: write
runs-on: codebuild-ab2d-${{ contains(fromJSON('["dev", "test"]'), inputs.environment) && 'non-prod' || 'prod' }}-${{ github.run_id }}-${{ github.run_attempt }}
env:
APP: ab2d
ENV: ${{ inputs.environment }}
defaults:
run:
working-directory: ops/services/${{ inputs.service }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.3.0
with:
ref: ${{ inputs.branch }}
- uses: sigstore/cosign-installer@cad07c2e89fa2edd6e2d7bab4c1aa38e53f76003 # v4.1.1
- uses: cmsgov/cdap/actions/setup-tenv@f4c14d47cc20e7f6de9112d7155af1213c9bca5a
- uses: cmsgov/cdap/actions/setup-sops@f4c14d47cc20e7f6de9112d7155af1213c9bca5a
- uses: cmsgov/cdap/actions/setup-yq@f4c14d47cc20e7f6de9112d7155af1213c9bca5a
- uses: aws-actions/configure-aws-credentials@ec61189d14ec14c8efccab744f656cffd0e33f37 # v6.1.0
with:
role-to-assume: arn:aws:iam::${{ contains(fromJSON('["dev", "test"]'), inputs.environment) && secrets.NON_PROD_ACCOUNT || secrets.PROD_ACCOUNT }}:role/delegatedadmin/developer/ab2d-${{ inputs.environment }}-github-actions
aws-region: ${{ vars.AWS_REGION }}

- name: tofu plan
run: |
tofu init -var=parent_env=$ENV -reconfigure
tofu workspace select -var=parent_env=$ENV -or-create=true $ENV
tofu plan -no-color -input=false -out=tfplan

- name: tofu apply
if: inputs.apply == 'true'
run: tofu apply -no-color -input=false tfplan
1 change: 0 additions & 1 deletion ops/services/60-monitors/variables.tf

This file was deleted.

Empty file.
Loading