Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: korjaa tuotannon asennuskomennot, jotta muisti ei loppuisi kesken #553

Merged
merged 1 commit into from
Jan 26, 2023
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions deployment/bin/checkoutBranch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

# CodeBuildissa git on "detached head"-tilassa, jolloin semantic-release ei osaa tehdä release noteseja oikein, eikä osaa lisätä versiotagia
if [ "$ENVIRONMENT" = "test" ] || [ "$ENVIRONMENT" = "training" ] || [ "$ENVIRONMENT" = "prod" ]; then
git checkout "$ENVIRONMENT"
fi
3 changes: 2 additions & 1 deletion deployment/lib/buildspec/buildspec-feature.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ phases:
- aws ecr get-login-password --region eu-west-1 | docker login --username AWS --password-stdin 283563576583.dkr.ecr.eu-west-1.amazonaws.com
- nohup /usr/bin/dockerd --host=unix:///var/run/docker.sock --host=tcp://127.0.0.1:2375 --storage-driver=overlay2 &
- timeout 15 sh -c "until docker info; do echo .; sleep 1; done"
- nohup docker pull 283563576583.dkr.ecr.eu-west-1.amazonaws.com/localstack:1.3
- nohup docker pull 283563576583.dkr.ecr.eu-west-1.amazonaws.com/localstack:1.3 &

- mv /packages/tools/velho/.gradle /tools/velho/
- mv /packages/tools/velho/buildSrc/.gradle /tools/velho/buildSrc/

- touch .env.test
- npm ci
- fg || true
- npm run buildimage:generate
build:
commands:
Expand Down
9 changes: 2 additions & 7 deletions deployment/lib/buildspec/buildspec-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,14 @@ env:
phases:
install:
commands:
- ACCOUNT_ID=$(aws sts get-caller-identity --output text --query Account)
- aws ecr get-login-password --region eu-west-1 | docker login --username AWS --password-stdin "$ACCOUNT_ID.dkr.ecr.eu-west-1.amazonaws.com"

- nohup /usr/bin/dockerd --host=unix:///var/run/docker.sock --host=tcp://127.0.0.1:2375 --storage-driver=overlay2 &
- timeout 15 sh -c "until docker info; do echo .; sleep 1; done"
- nohup docker pull "$ACCOUNT_ID.dkr.ecr.eu-west-1.amazonaws.com/localstack:1.3"

- mv /packages/tools/velho/.gradle /tools/velho/
- mv /packages/tools/velho/buildSrc/.gradle /tools/velho/buildSrc/

- ./deployment/bin/checkoutBranch.sh
- touch .env.test
- npm ci
- npm run buildimage:generate
- ./tools/velho/gradlew --stop
build:
commands:
- npm run get-next-version
Expand Down
1 change: 1 addition & 0 deletions deployment/lib/buildspec/buildspec-training.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ phases:
- mv /packages/tools/velho/.gradle /tools/velho/
- mv /packages/tools/velho/buildSrc/.gradle /tools/velho/buildSrc/

- ./deployment/bin/checkoutBranch.sh
- touch .env.test
- npm ci
- npm run buildimage:generate
Expand Down
6 changes: 3 additions & 3 deletions deployment/lib/buildspec/buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ phases:
- aws ecr get-login-password --region eu-west-1 | docker login --username AWS --password-stdin 283563576583.dkr.ecr.eu-west-1.amazonaws.com
- nohup /usr/bin/dockerd --host=unix:///var/run/docker.sock --host=tcp://127.0.0.1:2375 --storage-driver=overlay2 &
- timeout 15 sh -c "until docker info; do echo .; sleep 1; done"
- nohup docker pull 283563576583.dkr.ecr.eu-west-1.amazonaws.com/localstack:1.3
- nohup docker pull 283563576583.dkr.ecr.eu-west-1.amazonaws.com/localstack:1.3 &

- mv /packages/tools/velho/.gradle /tools/velho/
- mv /packages/tools/velho/buildSrc/.gradle /tools/velho/buildSrc/

- ./deployment/bin/checkoutBranch.sh
- touch .env.test
- npm ci
- fg || true
- npm run buildimage:generate
build:
commands:
Expand All @@ -33,7 +35,6 @@ phases:
- npm run test
- npm run localstack:stop &
- npm run sonar
- npm run maintenancemode set
- npm run deploy:database
- npm run deploy:backend
- npm run deploy:frontend
Expand All @@ -46,7 +47,6 @@ phases:
post_build:
on-failure: ABORT
commands:
- npm run maintenancemode clear
- ./deployment/bin/reportBuildStatus.sh -t "$ROCKET_CHAT_TOKEN" -u "$ROCKET_CHAT_USER_ID" -r "$CODEBUILD_BUILD_SUCCEEDING" -m "$ENVIRONMENT build" -d "CodeBuild $CODEBUILD_BUILD_URL"
cache:
paths:
Expand Down
4 changes: 2 additions & 2 deletions deployment/lib/hassu-pipelines.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ export class HassuPipelineStack extends Stack {
"lambda:ListFunctions",
"lambda:InvokeFunction",
"lambda:GetFunction",
"waf:ListRegexPatternSets",
"waf:UpdateRegexPatternSet",
"wafv2:ListRegexPatternSets",
"wafv2:UpdateRegexPatternSet",
],
resources: ["*"],
})
Expand Down
10 changes: 9 additions & 1 deletion deployment/lib/hassu-waf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export class FrontendWafStack extends Stack {
}
}

const managedRules = [
const managedRules: CfnWebACL.RuleProperty[] = [
{
name: "AWS-AWSManagedRulesAdminProtectionRuleSet",
priority: 0,
Expand Down Expand Up @@ -152,6 +152,14 @@ const managedRules = [
managedRuleGroupStatement: {
vendorName: "AWS",
name: "AWSManagedRulesCommonRuleSet",
ruleActionOverrides: [
{
name: "SizeRestrictions_BODY",
actionToUse: {
allow: {},
},
},
],
},
},
overrideAction: {
Expand Down