Skip to content
Snippets Groups Projects
Commit 92c10c3b authored by Ole Langbehn's avatar Ole Langbehn
Browse files

Merge branch 'main' into production

parents 9e98e12e 3dd560a1
No related branches found
No related tags found
No related merge requests found
...@@ -16,4 +16,5 @@ node_modules/ ...@@ -16,4 +16,5 @@ node_modules/
**/.yarn/install-state.gz **/.yarn/install-state.gz
**/.pnp.js **/.pnp.js
.idea .idea
\ No newline at end of file terraform*.log
...@@ -60,6 +60,13 @@ deploy:review:stop: ...@@ -60,6 +60,13 @@ deploy:review:stop:
needs: needs:
- "apps:build" # all the /dist folders, so that terraform can archive stuff - "apps:build" # all the /dist folders, so that terraform can archive stuff
- "deploy:review:infra" # the terraform hcl sources - "deploy:review:infra" # the terraform hcl sources
artifacts:
paths:
- "terraform/environments/crash.log" # optional, only available in case of a crash/panic
- "terraform/environments/terraform-*.log" # separate log for every step/command
name: "${CI_JOB_NAME}_${CI_JOB_ID}"
when: on_failure
expire_in: 1 week
script: script:
- terraform/environments/scripts/destroy-env.sh $CI_ENVIRONMENT_NAME - terraform/environments/scripts/destroy-env.sh $CI_ENVIRONMENT_NAME
when: manual when: manual
......
{ {
"name": "@holi/moderation-backend", "name": "@holi/moderation-backend",
"version": "0.0.1", "version": "0.1.0",
"description": "", "description": "",
"author": "", "author": "",
"private": true, "private": true,
......
{ {
"name": "@holi/moderation-event-listener", "name": "@holi/moderation-event-listener",
"main": "dist/index.js", "main": "dist/index.js",
"version": "0.1.0",
"packageManager": "yarn@4.4.1", "packageManager": "yarn@4.4.1",
"dependencies": { "dependencies": {
"@google-cloud/functions-framework": "3.4.2", "@google-cloud/functions-framework": "3.4.2",
......
#!/usr/bin/env sh #!/usr/bin/env bash
# exit when any command fails # exit when any command fails
set -ex set -ex
...@@ -6,11 +6,36 @@ set -ex ...@@ -6,11 +6,36 @@ set -ex
# enable debug output in terraform # enable debug output in terraform
export TF_LOG=DEBUG export TF_LOG=DEBUG
cd terraform/environments # retry logic for destroy: sometimes, a full workspace destroy does not work. This can be due to e.g.:
# * implicit dependencies between terraform resources not declared with depends_on,
# * unclean shutdown of resources, e.g. service does not close db connections, db still sees clients connected,
# * GCP stuff not allowing our resources to be deleted.
# Most of the time, retrying a destroy fixes these causes.
retry() {
for i in {1..3}; do
set +e
"$@"
retval=$?
set -e
if [ "$retval" -ne "0" ]; then
if [ "$i" -lt "3" ]; then
echo "command '$*' failed in try $i, retrying after 60 seconds"
sleep 60 # let things settle a bit
else
echo "command '$*' failed in try $i, giving up"
exit $retval
fi
else
break # success
fi
done
}
cd "$(dirname "$0")"/..
TF_LOG_PATH=terraform-init.log terraform init TF_LOG_PATH=terraform-init.log terraform init
TF_LOG_PATH=terraform-version.log terraform version TF_LOG_PATH=terraform-version.log terraform version
TF_LOG_PATH=terraform-workspace.log terraform workspace select -or-create=true "$1" TF_LOG_PATH=terraform-workspace.log terraform workspace select -or-create=true "$1"
TF_LOG_PATH=terraform-destroy.log terraform destroy -auto-approve -var="backend_image_tag=dummy" -var "frontend_image_tag=dumm" -var "federator_image_tag=dummy" TF_LOG_PATH=terraform-destroy.log retry terraform destroy -auto-approve -var="backend_image_tag=dummy" -var "frontend_image_tag=dummy" -var "federator_image_tag=dummy"
TF_LOG_PATH=terraform-ws-default.log terraform workspace select default TF_LOG_PATH=terraform-ws-default.log terraform workspace select default
TF_LOG_PATH=terraform-ws-delete.log terraform workspace delete "$1" TF_LOG_PATH=terraform-ws-delete.log terraform workspace delete "$1"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment