Skip to content
This repository was archived by the owner on Mar 1, 2023. It is now read-only.

Commit 6ecb722

Browse files
author
sysadmin-frontend-binary
authored
Merge pull request #1961 from Mahboobeh-binary/add-slack-notification
Add slack notification
2 parents 4edae28 + 0a8e0dd commit 6ecb722

File tree

1 file changed

+49
-18
lines changed

1 file changed

+49
-18
lines changed

.circleci/config.yml

+49-18
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
version: 2.1
22
orbs:
33
k8s: circleci/[email protected]
4+
slack: circleci/[email protected]
45
commands:
56
git_checkout_from_cache:
67
description: "Git checkout and save cache"
@@ -47,7 +48,7 @@ commands:
4748
key: bundle-v1-{{ checksum "Gemfile" }}
4849
paths:
4950
- "modules"
50-
release:
51+
build:
5152
description: "Build Jekyll site"
5253
steps:
5354
- restore_cache:
@@ -63,7 +64,7 @@ commands:
6364
key: _site-v1-{{ .Revision }}
6465
paths:
6566
- _site
66-
deploy_gh_pages:
67+
deploy:
6768
description: "Deploy to static branches"
6869
parameters:
6970
target_branch:
@@ -74,7 +75,7 @@ commands:
7475
at: _site
7576
- run:
7677
name: Tag build
77-
command: echo "<< parameters.target_branch >> $(date)" > _site/version
78+
command: echo "<< parameters.target_branch >> $(date -u +'%Y-%m-%dT%H:%M:%SZ')" > _site/version
7879
- run:
7980
name: Install and configure dependencies
8081
command: |
@@ -91,17 +92,14 @@ commands:
9192
- run:
9293
name: Deploy docs to gh-pages branch
9394
command: /home/circleci/.npm-packages/bin/gh-pages -d _site --branch << parameters.target_branch >> --message '[skip ci]'
94-
docker_build:
95+
docker_build_push:
9596
description: "Build Docker image"
9697
steps:
9798
- setup_remote_docker
9899
- run:
99100
name: Building docker image
100101
command: |
101102
docker build -t ${DOCKHUB_ORGANISATION}/binary-static-academy:${CIRCLE_SHA1} -t ${DOCKHUB_ORGANISATION}/binary-static-academy:latest .
102-
docker_push:
103-
description: "Push image to docker hub"
104-
steps:
105103
- run:
106104
name: Pushing Image to docker hub
107105
command: |
@@ -130,31 +128,58 @@ commands:
130128
kubectl --server=${KUBE_SERVER} --certificate-authority=ca.crt --token=$SERVICEACCOUNT_TOKEN set image deployment/academy-binary-com academy-binary-com=${DOCKHUB_ORGANISATION}/binary-static-academy:${CIRCLE_SHA1}
131129
fi
132130
done
133-
131+
notify_slack:
132+
description: "Notify slack"
133+
steps:
134+
- slack/status:
135+
include_project_field: false
136+
failure_message: "Release failed for Academy with version *$(cat _site/version)*"
137+
success_message: "Release succeeded for Academy with version *$(cat _site/version)*"
138+
webhook: ${SLACK_WEBHOOK}
134139
jobs:
135-
release_production:
140+
build:
136141
docker:
137142
- image: circleci/ruby:2.6.5
138143
steps:
139144
- git_checkout_from_cache
140145
- bundle_install
141-
- release
142-
- docker_build
143-
- docker_push
144-
- k8s_deploy
145-
- deploy_gh_pages:
146-
target_branch: "production"
146+
- build
147147
release_staging:
148148
docker:
149149
- image: circleci/ruby:2.6.5
150150
steps:
151151
- git_checkout_from_cache
152152
- bundle_install
153-
- release
154-
- deploy_gh_pages:
153+
- build
154+
- deploy:
155155
target_branch: "staging"
156-
156+
- notify_slack
157+
release_production:
158+
docker:
159+
- image: circleci/ruby:2.6.5
160+
steps:
161+
- git_checkout_from_cache
162+
- bundle_install
163+
- build
164+
- deploy:
165+
target_branch: "production"
166+
- notify_slack
167+
release_aws_production:
168+
docker:
169+
- image: circleci/ruby:2.6.5
170+
steps:
171+
- git_checkout_from_cache
172+
- bundle_install
173+
- build
174+
- docker_build_push
175+
- k8s_deploy
157176
workflows:
177+
build:
178+
jobs:
179+
- build:
180+
filters:
181+
branches:
182+
ignore: /^master$/
158183
release:
159184
jobs:
160185
- release_staging:
@@ -167,4 +192,10 @@ workflows:
167192
ignore: /.*/
168193
tags:
169194
only: /^production.*/
195+
- release_aws_production:
196+
filters:
197+
branches:
198+
ignore: /.*/
199+
tags:
200+
only: /^production.*/
170201
context: binary-frontend-artifact-upload

0 commit comments

Comments
 (0)