Skip to content
This repository has been archived by the owner on Oct 28, 2024. It is now read-only.

FS-3780 Confirm env in copilot #396

Closed
wants to merge 1 commit into from
Closed
Changes from all 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
56 changes: 3 additions & 53 deletions .github/workflows/dluhc-build-and-deploy-with-forms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ on:
- test
- uat
default: test
copilot:
description: Whether to deploy to AWS?
type: boolean
required: false
default: false


env:
DOCKER_REGISTRY: ghcr.io
Expand Down Expand Up @@ -62,7 +56,6 @@ jobs:
COMMIT_SHA=:${{ github.sha }}

deploy-and-test-dev:
if: ${{ github.event.inputs.copilot != 'true' }}
needs: docker-build
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -105,7 +98,7 @@ jobs:

run-shared-tests_dev:
needs: deploy-and-test-dev
if: ${{ github.actor != 'dependabot[bot]'}} && ${{ github.event.inputs.copilot != 'true' }}
if: ${{ github.actor != 'dependabot[bot]'}} }}
uses: communitiesuk/funding-service-design-workflows/.github/workflows/run-shared-tests.yml@main
with:
perf_test_target_url_application_store: https://funding-service-design-application-store-dev.london.cloudapps.digital
Expand All @@ -122,7 +115,7 @@ jobs:

deploy-to-test:
needs: deploy-and-test-dev
if: github.ref == 'refs/heads/main' && ${{ github.event.inputs.copilot != 'true' }}
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: checkout code
Expand All @@ -141,7 +134,7 @@ jobs:

run-shared-tests_test:
needs: deploy-to-test
if: ${{ github.actor != 'dependabot[bot]' }} && ${{ github.event.inputs.copilot != 'true' }}
if: ${{ github.actor != 'dependabot[bot]' }}
uses: communitiesuk/funding-service-design-workflows/.github/workflows/run-shared-tests.yml@main
with:
perf_test_target_url_application_store: https://funding-service-design-application-store-test.london.cloudapps.digital
Expand All @@ -155,46 +148,3 @@ jobs:
run_e2e_tests: true
secrets:
E2E_PAT: ${{secrets.E2E_PAT}}

deploy-aws:
if: ${{ github.event.inputs.copilot != 'false' }}
needs: docker-build
concurrency: deploy-${{ inputs.environment || 'test' }}
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
runs-on: ubuntu-latest
environment: ${{ inputs.environment || 'test' }}
steps:
- name: Git clone the repository
uses: actions/checkout@v3

- name: Get current date
id: currentdatetime
run: echo "datetime=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT

- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT }}:role/GithubCopilotDeploy
role-session-name: FORMS_COPILOT_${{ steps.currentdatetime.outputs.datetime }}
aws-region: eu-west-2

- name: Install AWS Copilot CLI
run: |
curl -Lo aws-copilot https://github.com/aws/copilot-cli/releases/latest/download/copilot-linux && chmod +x aws-copilot && sudo mv aws-copilot /usr/local/bin/copilot

- name: Inject Git SHA into manifest
run: |
yq -i '.variables.GITHUB_SHA = "${{ github.sha }}"' copilot/fsd-form-runner/manifest.yml

- name: Inject replacement image into manifest
run: |
yq -i '.image.location = "${{env.IMAGE_REPO_PATH}}/${{env.IMAGE_NAME}}:sha-${{ github.sha }}"' copilot/fsd-form-runner/manifest.yml

# - name: Run database migrations
# run: scripts/migration-task-script.py ${{ inputs.environment || 'test' }}

- name: Copilot deploy
run: |
copilot deploy --env ${{ inputs.environment || 'test' }}
Loading