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

(PC-32510) chore(pipeline): slack message only on failure or success #7058

Merged
merged 1 commit into from
Oct 21, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ jobs:

slack_notify:
runs-on: ubuntu-22.04
if: ${{ always() }}
if: ${{contains(needs.sentry_and_deploy.result, 'success') && contains(needs.sentry_and_deploy.result, 'failure')}}
needs: sentry_and_deploy
steps:
- name: Connect to Secret Manager
Expand All @@ -129,13 +129,13 @@ jobs:
"attachments": [
{
"mrkdwn_in": ["text"],
"color": "${{ fromJSON('["#A30002","#36a64f"]')[steps.sentry_and_deploy.outputs.status == 'success'] }}",
"color": "${{ fromJSON('["#36a64f", "#A30002"]')[needs.sentry_and_deploy.result == 'failure'] }}",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

je ne savais pas qu'on avait accès à cette info dans needs

est-ce tu sais pourquoi steps semblait fonctionner la semaine dernière ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aucune idée, j'ai juste suivi les préconisations de Matthias !

Copy link
Contributor Author

@NolwenMajorFrances NolwenMajorFrances Oct 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

réponse de Matthias pour dans quelques mois quand on se posera la question de ces modifications :
pourquoi on peut utiliser needs et pas steps ?
"parce qu'on est pas dans le meme job
la on a deux runners distincts qui ont une relation de co dépendance (le needs))
et c'est grace à cette relation qu'on peut appeler le result du premier job
si on était dans le meme job on aurait pu appeler le result de la step voulu (en lui donnant un petit nom), de mémoire cest ce qui est fait pour le workflow de test "

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

je suis code cité, j'aime ça

"author_name": "${{github.actor}}",
"author_link": "https://github.com/${{github.actor}}",
"author_icon": "https://github.com/${{github.actor}}.png",
"title": "PCAPPNATIVE Deployment",
"title_link": "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}",
"text": "Le déploiement Android sur `${{ inputs.ENV }}` a ${{ fromJSON('["échoué :boom:","réussi :rocket:"]')[steps.sentry_and_deploy.outputs.status == 'success'] }}"
"text": "Le déploiement Android sur `${{ inputs.ENV }}` a ${{ fromJSON('["réussi :rocket:", "échoué :boom:"]')[needs.sentry_and_deploy.result == 'failure'] }}"
}
],
"unfurl_links": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ jobs:

slack_notify:
runs-on: ubuntu-22.04
if: ${{ always() }}
if: ${{ contains(needs.sentry_and_deploy.result, 'success') && contains(needs.sentry_and_deploy.result, 'failure')}}
needs: sentry_and_deploy
steps:
- name: Connect to Secret Manager
Expand All @@ -120,13 +120,13 @@ jobs:
"attachments": [
{
"mrkdwn_in": ["text"],
"color": "${{ fromJSON('["#A30002", "#36a64f"]')[steps.sentry_and_deploy.outputs.status == 'success'] }}",
"color": "${{ fromJSON('["#36a64f", "#A30002"]')[needs.sentry_and_deploy.result == 'failure'] }}",
"author_name": "${{github.actor}}",
"author_link": "https://github.com/${{github.actor}}",
"author_icon": "https://github.com/${{github.actor}}.png",
"title": "PCAPPNATIVE Deployment",
"title_link": "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}",
"text": "Le déploiement iOS sur `${{ inputs.ENV }}` a ${{ fromJSON('["échoué :boom:","réussi :rocket:"]')[steps.sentry_and_deploy.outputs.status == 'success'] }}"
"text": "Le déploiement iOS sur `${{ inputs.ENV }}` a ${{ fromJSON('["réussi :rocket:", "échoué :boom:"]')[needs.sentry_and_deploy.result == 'failure'] }}"
}
],
"unfurl_links": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:

slack_notify:
runs-on: ubuntu-22.04
if: ${{ always() }}
if: ${{ contains(needs.sentry_and_deploy.result, 'success') && contains(needs.sentry_and_deploy.result, 'failure')}}
needs: sentry_and_deploy
steps:
- name: Connect to Secret Manager
Expand All @@ -111,13 +111,13 @@ jobs:
"attachments": [
{
"mrkdwn_in": ["text"],
"color": "${{ fromJSON('["#A30002","#36a64f"]')[steps.sentry_and_deploy.outputs.status == 'success'] }}",
"color": "${{ fromJSON('["#36a64f", "#A30002"]')[needs.sentry_and_deploy.result == 'failure'] }}",
"author_name": "${{github.actor}}",
"author_link": "https://github.com/${{github.actor}}",
"author_icon": "https://github.com/${{github.actor}}.png",
"title": "PCAPPNATIVE Deployment",
"title_link": "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}",
"text": "Le déploiement codePush Android/iOS sur `${{ inputs.ENV }}` a ${{ fromJSON('["échoué :boom:","réussi :rocket:"]')[steps.sentry_and_deploy.outputs.status == 'success'] }}"
"text": "Le déploiement codePush Android/iOS sur `${{ inputs.ENV }}` a ${{ fromJSON('["réussi :rocket:", "échoué :boom:"]')[needs.sentry_and_deploy.result == 'failure'] }}"
}
],
"unfurl_links": false,
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/dev_on_workflow_web_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
gsutil cp dist/index.html gs://${{ inputs.BUCKET_NAME }}
slack_notify:
runs-on: ubuntu-22.04
if: ${{ always() }}
if: ${{ contains(needs.web_deploy.result, 'success') && contains(needs.web_deploy.result, 'failure')}}
needs: web_deploy
steps:
- name: Connect to Secret Manager
Expand All @@ -101,13 +101,13 @@ jobs:
"attachments": [
{
"mrkdwn_in": ["text"],
"color": "${{ fromJSON('["#A30002","#36a64f"]')[steps.web_deploy.outputs.status == 'success'] }}",
"color": "${{ fromJSON('["#36a64f", "#A30002"]')[needs.web_deploy.result == 'failure'] }}",
"author_name": "${{github.actor}}",
"author_link": "https://github.com/${{github.actor}}",
"author_icon": "https://github.com/${{github.actor}}.png",
"title": "PCAPPNATIVE Deployment",
"title_link": "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}",
"text": "Le déploiement Web sur `${{ inputs.ENV }}` a ${{ fromJSON('["échoué :boom:","réussi :rocket:"]')[steps.web_deploy.outputs.status == 'success'] }}"
"text": "Le déploiement Web sur `${{ inputs.ENV }}` a ${{ fromJSON('["réussi :rocket:", "échoué :boom:"]')[needs.web_deploy.result == 'failure'] }}"
}
],
"unfurl_links": false,
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/dev_on_workflow_web_proxy_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
| xargs gcloud app versions delete --service=web-proxy-${{ inputs.ENV }}
slack_notify:
runs-on: ubuntu-22.04
if: ${{ always() }}
if: ${{ contains(needs.web_proxy_deploy.result, 'success') && contains(needs.web_proxy_deploy.result, 'failure')}}
needs: web_proxy_deploy
steps:
- name: Connect to Secret Manager
Expand All @@ -100,13 +100,13 @@ jobs:
"attachments": [
{
"mrkdwn_in": ["text"],
"color": "${{ fromJSON('["#A30002","#36a64f"]')[steps.web_proxy_deploy.outputs.status == 'success'] }}",
"color": "${{ fromJSON('["#36a64f", "#A30002"]')[needs.web_proxy_deploy.result == 'failure'] }}",
"author_name": "${{github.actor}}",
"author_link": "https://github.com/${{github.actor}}",
"author_icon": "https://github.com/${{github.actor}}.png",
"title": "PCAPPNATIVE Deployment",
"title_link": "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}",
"text": "Le déploiement Web proxy sur `${{ inputs.ENV }}` a ${{ fromJSON('["échoué :boom:","réussi :rocket:"]')[steps.web_proxy_deploy.outputs.status == 'success'] }}"
"text": "Le déploiement Web proxy sur `${{ inputs.ENV }}` a ${{ fromJSON('["réussi :rocket:", "échoué :boom:"]')[needs.web_proxy_deploy.result == 'failure'] }}"
}
],
"unfurl_links": false,
Expand Down
Loading