Skip to content

Commit

Permalink
Revert "Update"
Browse files Browse the repository at this point in the history
This reverts commit e2f4b33.
  • Loading branch information
13bfrancis committed Dec 19, 2024
1 parent 677f910 commit 2668576
Show file tree
Hide file tree
Showing 30 changed files with 1,542 additions and 993 deletions.
38 changes: 36 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# yaml-language-server: disable
name: Deploy

on:
Expand All @@ -7,7 +6,6 @@ on:
- "*"
- "!skipci*"

# yaml-language-server: $schema: https://json.schemastore.org/github-workflow.json
concurrency:
group: ${{ startsWith(github.ref_name, 'snyk-') && 'snyk' || github.ref_name }}-group

Expand Down Expand Up @@ -190,6 +188,42 @@ jobs:
uses: stelligent/[email protected]
with:
input_path: cftemplates
resources:
runs-on: ubuntu-20.04
needs:
- deploy
environment:
name: ${{ startsWith(github.ref_name, 'snyk-') && 'snyk' || github.ref_name }}
steps:
- name: Checkout
uses: actions/checkout@v3

- uses: ./.github/actions/setup

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_OIDC_ROLE_TO_ASSUME }}
aws-region: us-east-1
role-duration-seconds: 10800

- name: Get AWS Stage Resources
id: stage-resources
run: |
mkdir -p resources
resourceData=()
stackList=(`aws cloudformation describe-stacks --query "Stacks[?Tags[?Key=='STAGE' && Value=='$STAGE_NAME'] && Tags[?Key=='PROJECT' && Value=='$PROJECT']].StackName" --output text`)
for stack in "${stackList[@]}"; do
resources=$(aws cloudformation list-stack-resources --stack-name "$stack" --query "StackResourceSummaries[].{PhysicalResourceId:PhysicalResourceId, ResourceType:ResourceType, ResourceStatus:ResourceStatus, LogicalResourceId:LogicalResourceId, LastUpdatedTimestamp:LastUpdatedTimestamp}" --output json)
resourceData+=( $(echo "$resources" | jq -c --arg stack_name "$stack" '.[] + { StackName: $stack_name }') )
done
join_by() { local IFS="$1"; shift; echo "$*"; }
echo "["$(join_by "," "${resourceData[@]}")"]" > "resources/aws-resources.json"
- name: Archive stage resources
uses: actions/upload-artifact@v3
with:
name: aws-resources-${{ startsWith(github.ref_name, 'snyk-') && 'snyk' || github.ref_name }}
path: resources/aws-resources.json

release:
runs-on: ubuntu-20.04
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ node_modules
cdk.out
cdk.context.json
.turbo

.yarn_install
build_run
.build_run
DS_Store
Expand All @@ -22,4 +22,3 @@ DS_Store
# tests
coverage
__snapshots__
.repo_ignore
13 changes: 0 additions & 13 deletions .yamllint.yml

This file was deleted.

37 changes: 30 additions & 7 deletions bin/cli/src/commands/deploy.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
import { Argv } from "yargs";
import { checkIfAuthenticated, runCommand, project, region, writeUiEnvFile } from "../lib/";
import * as path from "path";
import {
checkIfAuthenticated,
runCommand,
project,
region,
writeUiEnvFile,
} from "../lib/";
import path from "path";
import { execSync } from "child_process";
import { CloudFrontClient, CreateInvalidationCommand } from "@aws-sdk/client-cloudfront";
import {
CloudFrontClient,
CreateInvalidationCommand,
} from "@aws-sdk/client-cloudfront";
import { GetParameterCommand, SSMClient } from "@aws-sdk/client-ssm";

export const deploy = {
Expand All @@ -13,7 +22,11 @@ export const deploy = {
},
handler: async (options: { stage: string; stack?: string }) => {
await checkIfAuthenticated();
await runCommand("cdk", ["deploy", "-c", `stage=${options.stage}`, "--all"], ".");
await runCommand(
"cdk",
["deploy", "-c", `stage=${options.stage}`, "--all"],
".",
);

await writeUiEnvFile(options.stage);

Expand Down Expand Up @@ -44,8 +57,16 @@ export const deploy = {
// There's a mime type issue when aws s3 syncing files up
// Empirically, this issue never presents itself if the bucket is cleared just before.
// Until we have a neat way of ensuring correct mime types, we'll remove all files from the bucket.
await runCommand("aws", ["s3", "rm", `s3://${s3BucketName}/`, "--recursive"], ".");
await runCommand("aws", ["s3", "sync", buildDir, `s3://${s3BucketName}/`], ".");
await runCommand(
"aws",
["s3", "rm", `s3://${s3BucketName}/`, "--recursive"],
".",
);
await runCommand(
"aws",
["s3", "sync", buildDir, `s3://${s3BucketName}/`],
".",
);

const cloudfrontClient = new CloudFrontClient({
region,
Expand All @@ -61,7 +82,9 @@ export const deploy = {
},
};

await cloudfrontClient.send(new CreateInvalidationCommand(invalidationParams));
await cloudfrontClient.send(
new CreateInvalidationCommand(invalidationParams),
);

console.log(
`Deployed UI to S3 bucket ${s3BucketName} and invalidated CloudFront distribution ${cloudfrontDistributionId}`,
Expand Down
Binary file modified bun.lockb
100755 → 100644
Binary file not shown.
1 change: 1 addition & 0 deletions lib/lambda/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"@aws-sdk/client-s3": "^3.600.0",
"@aws-sdk/client-sfn": "^3.600.0",
"@aws-sdk/s3-request-presigner": "^3.600.0",
"@haftahave/serverless-ses-template": "^6.1.0",
"base-64": "^1.0.0",
"cfn-response-async": "^1.0.0",
"mssql": "^11.0.0",
Expand Down
92 changes: 0 additions & 92 deletions lib/lambda/processEmails.test.ts

This file was deleted.

Loading

0 comments on commit 2668576

Please sign in to comment.