-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add slack notifications on ci dployment (#168)
- Loading branch information
1 parent
dcdcbdd
commit ee2bc07
Showing
2 changed files
with
139 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,7 @@ permissions: | |
contents: read | ||
|
||
jobs: | ||
deploy-static-site: | ||
deploy-cms: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
|
@@ -96,3 +96,72 @@ jobs: | |
kubectl config set-context --current --namespace=argocd | ||
argocd app set site-instit-${{ inputs.environment }} --core --plugin-env "ARGS=--set deployment.image.tag=${{ inputs.image_tag }}" | ||
argocd app wait site-instit-${{ inputs.environment }} --core --sync --health --timeout 180 | ||
notification: | ||
name: "Notification" | ||
runs-on: ubuntu-latest | ||
needs: [deploy-cms] | ||
if: ${{ always() }} | ||
steps: | ||
- name: "Authentification to Google" | ||
uses: 'google-github-actions/auth@v2' | ||
with: | ||
workload_identity_provider: ${{ secrets.SECRETS_WORKLOAD_IDENTITY_PROVIDER }} | ||
service_account: ${{ secrets.SECRETS_SERVICE_ACCOUNT }} | ||
- name: "Get Secret" | ||
id: 'secrets' | ||
uses: 'google-github-actions/get-secretmanager-secrets@v2' | ||
with: | ||
secrets: |- | ||
SLACK_BOT_TOKEN:passculture-metier-ehp/passculture-ci-slack-bot-token | ||
- name: "Post to a Slack channel on success" | ||
if: ${{ always() && contains(needs.deploy-cms.result, 'success') }} | ||
uses: slackapi/[email protected] | ||
with: | ||
# channel #alertes-deploiement-site-instit | ||
channel-id: "C06EKUL552T" | ||
payload: | | ||
{ | ||
"attachments": [ | ||
{ | ||
"mrkdwn_in": ["text"], | ||
"color": "#36A64F", | ||
"author_name": "${{github.actor}}", | ||
"author_link": "https://github.com/${{github.actor}}", | ||
"author_icon": "https://github.com/${{github.actor}}.png", | ||
"title": "CMS Site instit", | ||
"title_link": "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}", | ||
"text": "Le CMS du site instit vient d'être déployé en ${{ inputs.environment }} :white_check_mark:" | ||
} | ||
], | ||
"unfurl_links": false, | ||
"unfurl_media": false | ||
} | ||
env: | ||
SLACK_BOT_TOKEN: ${{ steps.secrets.outputs.SLACK_BOT_TOKEN }} | ||
- name: "Post to a Slack channel on failure" | ||
if: ${{ always() && contains(needs.deploy-cms.result, 'failure') }} | ||
uses: slackapi/[email protected] | ||
with: | ||
# channel #alertes-deploiement-site-instit | ||
channel-id: "C06EKUL552T" | ||
payload: | | ||
{ | ||
"attachments": [ | ||
{ | ||
"mrkdwn_in": ["text"], | ||
"color": "#A30002", | ||
"author_name": "${{github.actor}}", | ||
"author_link": "https://github.com/${{github.actor}}", | ||
"author_icon": "https://github.com/${{github.actor}}.png", | ||
"title": "CMS Site Instit", | ||
"title_link": "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}", | ||
"text": "Le déploiement du CMS site instit vient d'échouer en ${{ inputs.environment }} :boom:" | ||
} | ||
], | ||
"unfurl_links": false, | ||
"unfurl_media": false | ||
} | ||
env: | ||
SLACK_BOT_TOKEN: ${{ steps.secrets.outputs.SLACK_BOT_TOKEN }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,3 +90,72 @@ jobs: | |
run: | | ||
firebase use pc-site-instit-${{ inputs.environment }} | ||
firebase deploy --only hosting:${{ inputs.environment }} --project pc-site-instit-${{ inputs.environment }} --non-interactive | ||
notification: | ||
name: "Notification" | ||
runs-on: ubuntu-latest | ||
needs: [deploy-static-site] | ||
if: ${{ always() }} | ||
steps: | ||
- name: "Authentification to Google" | ||
uses: 'google-github-actions/auth@v2' | ||
with: | ||
workload_identity_provider: ${{ secrets.SECRETS_WORKLOAD_IDENTITY_PROVIDER }} | ||
service_account: ${{ secrets.SECRETS_SERVICE_ACCOUNT }} | ||
- name: "Get Secret" | ||
id: 'secrets' | ||
uses: 'google-github-actions/get-secretmanager-secrets@v2' | ||
with: | ||
secrets: |- | ||
SLACK_BOT_TOKEN:passculture-metier-ehp/passculture-ci-slack-bot-token | ||
- name: "Post to a Slack channel on success" | ||
if: ${{ always() && contains(needs.deploy-static-site.result, 'success') }} | ||
uses: slackapi/[email protected] | ||
with: | ||
# channel #alertes-deploiement-site-instit | ||
channel-id: "C06EKUL552T" | ||
payload: | | ||
{ | ||
"attachments": [ | ||
{ | ||
"mrkdwn_in": ["text"], | ||
"color": "#36A64F", | ||
"author_name": "${{github.actor}}", | ||
"author_link": "https://github.com/${{github.actor}}", | ||
"author_icon": "https://github.com/${{github.actor}}.png", | ||
"title": "Site instit public", | ||
"title_link": "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}", | ||
"text": "Le site instit vient d'être déployé en ${{ inputs.environment }} :white_check_mark:" | ||
} | ||
], | ||
"unfurl_links": false, | ||
"unfurl_media": false | ||
} | ||
env: | ||
SLACK_BOT_TOKEN: ${{ steps.secrets.outputs.SLACK_BOT_TOKEN }} | ||
- name: "Post to a Slack channel on failure" | ||
if: ${{ always() && contains(needs.deploy-static-site.result, 'failure') }} | ||
uses: slackapi/[email protected] | ||
with: | ||
# channel #alertes-deploiement-site-instit | ||
channel-id: "C06EKUL552T" | ||
payload: | | ||
{ | ||
"attachments": [ | ||
{ | ||
"mrkdwn_in": ["text"], | ||
"color": "#A30002", | ||
"author_name": "${{github.actor}}", | ||
"author_link": "https://github.com/${{github.actor}}", | ||
"author_icon": "https://github.com/${{github.actor}}.png", | ||
"title": "Site instit public", | ||
"title_link": "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}", | ||
"text": "Le déploiement du site instit vient d'échouer en ${{ inputs.environment }} :boom:" | ||
} | ||
], | ||
"unfurl_links": false, | ||
"unfurl_media": false | ||
} | ||
env: | ||
SLACK_BOT_TOKEN: ${{ steps.secrets.outputs.SLACK_BOT_TOKEN }} | ||
|