Skip to content

Commit

Permalink
Refactor slack deploy notifications with webhooks
Browse files Browse the repository at this point in the history
  • Loading branch information
VirginiaDooley committed May 2, 2024
1 parent 24ec20b commit cd905b2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
19 changes: 9 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ jobs:
AppSentryDsn='$SENTRY_DSN' \
AppSecretKey='$SECRET_KEY' \
AppSlackFeedbackWebhookUrl='$SLACK_FEEDBACK_WEBHOOK_URL' \
AppSlackDeployWebhookUrl='$SLACK_DEPLOY_WEBHOOK_URL' \
AppDcEnvironment='$DC_ENVIRONMENT' \
AppYnrApiKey='$YNR_API_KEY' \
VpcIdParameter=<<parameters.vpc-id>> \
Expand Down Expand Up @@ -200,10 +201,6 @@ jobs:
command: |
. .venv/bin/activate
make lambda-migrate
# In the event the deployment has failed, alert the dev team
- slack/notify:
event: fail
template: basic_fail_1
code_deploy:
docker:
Expand Down Expand Up @@ -248,12 +245,14 @@ jobs:
DESIRED_CAPACITY=<<parameters.desired-capacity>> \
python deploy/update_auto_scaling_group.py
no_output_timeout: 15m # TODO reduce/discuss what is suitable?
# In the event the deployment has failed, alert the dev team
- slack/notify:
event: fail
template: basic_fail_1
channel: $SLACK_DEFAULT_CHANNEL

- run:
name: Send failure notification
command: |
if [ "$CIRCLE_JOB" = "code_deploy" ]; then
curl -X POST -H 'Content-type: application/json' --data '{"text":"The job has failed."}' {{SLACK_WEBHOOK_URL }}
fi
when: on_fail


workflows:
main:
Expand Down
1 change: 1 addition & 0 deletions docs/parameterstore.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ AWS parameter store is used to store secrets and values that we then use to expo
- `SECRET_KEY` - should be a long and random string. [A handy way of using Django to generate one can be found in this blog post](https://humberto.io/blog/tldr-generate-django-secret-key/).
- `SENTRY_DSN`
- `SLACK_FEEDBACK_WEBHOOK_URL`
- `SLACK_DEPLOY_WEBHOOK_URL`
- `WDIV_API_KEY`
- `FIREHOSE_ACCOUNT_ARN`
- `AKISMET_API_KEY`
Expand Down
1 change: 1 addition & 0 deletions sam-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ Resources:
SECRET_KEY: !Ref AppSecretKey
DC_ENVIRONMENT: !Ref AppDcEnvironment
SLACK_FEEDBACK_WEBHOOK_URL: !Ref AppSlackFeedbackWebhookUrl
SLACK_DEPLOY_WEBHOOK_URL: !Ref AppSlackFeedbackWebhookUrl
YNR_API_KEY: !Ref AppYnrApiKey
FEEDBACK_DB_ENABLED: !Ref AppFeedbackDbEnabled
FEEDBACK_DB_PASSWORD: !Ref AppFeedbackDbPassword
Expand Down
2 changes: 1 addition & 1 deletion wcivf/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def repo_root(*x):

WDIV_API_KEY = os.environ.get("WDIV_API_KEY")
SLACK_FEEDBACK_WEBHOOK_URL = os.environ.get("SLACK_FEEDBACK_WEBHOOK_URL") # noqa

SLACK_DEPLOY_WEBHOOK_URL = os.environ.get("SLACK_DEPLOY_WEBHOOK_URL") # noqa
CHECK_HOST_DIRTY = False
DIRTY_FILE_PATH = "~/server_dirty"

Expand Down

0 comments on commit cd905b2

Please sign in to comment.