Skip to content

Commit 3c459f7

Browse files
[VAULT-39267] actions(slack): migrate to v2 action (#8964) (#8990)
Signed-off-by: Ryan Cragun <[email protected]> Co-authored-by: Ryan Cragun <[email protected]>
1 parent 50af559 commit 3c459f7

File tree

2 files changed

+61
-72
lines changed

2 files changed

+61
-72
lines changed

.github/workflows/build.yml

Lines changed: 31 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -434,44 +434,39 @@ jobs:
434434
steps.status.outputs.result != 'success' &&
435435
(github.ref_name == 'main' || startsWith(github.ref_name, 'release/'))
436436
uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1
437-
env:
438-
SLACK_BOT_TOKEN: ${{ steps.slackbot-token.outputs.slackbot-token }}
439437
with:
440-
channel-id: "C05AABYEA9Y" # Notify #feed-vault-ci-official
441-
# channel-id: "C05Q4D5V89W" # Notify #test-vault-ci-slack-integration
438+
# send to #feed-vault-ci-official, use "C05Q4D5V89W" as the channel to send to test-vault-ci-slack-integration for testing
439+
errors: true # exit with an error if the payload is invalid
440+
retries: rapid # retry if we're being rated limited
441+
method: chat.postMessage
442+
token: ${{ steps.slackbot-token.outputs.slackbot-token }}
442443
payload: |
443-
{
444-
"text": "${{ needs.setup.outputs.is-ent-branch == 'true' && 'vault-enterprise' || 'vault' }} build failures on ${{ github.ref_name }}",
445-
"blocks": [
446-
{
447-
"type": "header",
448-
"text": {
449-
"type": "plain_text",
450-
"text": ":rotating_light: ${{ needs.setup.outputs.is-ent-branch == 'true' && 'vault-enterprise' || 'vault' }} build failures on ${{ github.ref_name }} :rotating_light:",
451-
"emoji": true
452-
}
453-
},
454-
{
455-
"type": "divider"
456-
},
457-
{
458-
"type": "section",
459-
"text": {
460-
"type": "mrkdwn",
461-
"text": "${{ needs.setup.result != 'failure' && ':white_check_mark:' || ':x:' }} Setup\n${{ needs.ui.result != 'failure' && ':white_check_mark:' || ':x:' }} Build UI\n${{ (needs.artifacts-ent.result != 'failure' && needs.artifacts-ce.result != 'failure') && ':white_check_mark:' || ':x:' }} Build Vault Artifacts\n${{ needs.test.result != 'failure' && ':white_check_mark:' || ':x:' }} Enos package test scenarios\n${{ needs.test-containers.result != 'failure' && ':white_check_mark:' || ':x:' }} Enos container test scenarios"
462-
},
463-
"accessory": {
464-
"type": "button",
465-
"text": {
466-
"type": "plain_text",
467-
"text": "View Failing Workflow",
468-
"emoji": true
469-
},
470-
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
471-
}
472-
}
473-
]
474-
}
444+
channel: C05AABYEA9Y
445+
text: ${{ needs.setup.outputs.is-ent-branch == 'true' && 'vault-enterprise' || 'vault' }} build failures on ${{ github.ref_name }}
446+
blocks:
447+
- type: header
448+
text:
449+
type: plain_text
450+
text: :rotating_light: ${{ needs.setup.outputs.is-ent-branch == 'true' && 'vault-enterprise' || 'vault' }} build failures on ${{ github.ref_name }} :rotating_light:
451+
emoji: true
452+
- type: divider
453+
- type: section
454+
text:
455+
type: mrkdwn
456+
text: |
457+
${{ needs.setup.result != 'failure' && ':white_check_mark:' || ':x:' }} Setup
458+
${{ needs.ui.result != 'failure' && ':white_check_mark:' || ':x:' }} Build UI
459+
${{ (needs.artifacts-ent.result != 'failure' && needs.artifacts-ce.result != 'failure') && ':white_check_mark:' || ':x:' }} Build Vault Artifacts
460+
${{ needs.test.result != 'failure' && ':white_check_mark:' || ':x:' }} Enos package test scenarios
461+
${{ needs.test-containers.result != 'failure' && ':white_check_mark:' || ':x:' }} Enos container test scenarios
462+
accessory:
463+
type: button
464+
text:
465+
type: plain_text
466+
text: View Failing Workflow
467+
emoji: true
468+
url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
469+
475470
- uses: hashicorp/actions-generate-metadata@f1d852525201cb7bbbf031dd2e985fb4c22307fc # v1.1.3
476471
# create build metadata if we successfully created artifacts
477472
if: needs.setup.outputs.is-ent-branch == 'true' && needs.artifacts-ent.result == 'success' || needs.artifacts-ce.result == 'success'

.github/workflows/ci.yml

Lines changed: 30 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -437,44 +437,38 @@ jobs:
437437
)
438438
name: Notify build failures in Slack
439439
uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1
440-
env:
441-
SLACK_BOT_TOKEN: ${{ steps.slackbot-token.outputs.slackbot-token }}
442440
with:
443-
channel-id: "C05AABYEA9Y" # sent to #feed-vault-ci-official, use "C05Q4D5V89W"/test-vault-ci-slack-integration for testing
441+
# send to #feed-vault-ci-official, use "C05Q4D5V89W" as the channel to send to test-vault-ci-slack-integration for testing
442+
errors: true # exit with an error if the payload is invalid
443+
retries: rapid # retry if we're being rated limited
444+
method: chat.postMessage
445+
token: ${{ steps.slackbot-token.outputs.slackbot-token }}
444446
payload: |
445-
{
446-
"text": "CE test failures on ${{ github.ref_name }}",
447-
"text": "${{ needs.setup.outputs.is-ent-branch == 'true' && 'vault-enterprise' || 'vault' }} build failures on ${{ github.ref_name }}",
448-
"blocks": [
449-
{
450-
"type": "header",
451-
"text": {
452-
"type": "plain_text",
453-
"text": ":rotating_light: ${{ needs.setup.outputs.is-ent-branch == 'true' && 'vault-enterprise' || 'vault' }} test failures on ${{ github.ref_name }} :rotating_light:",
454-
"emoji": true
455-
}
456-
},
457-
{
458-
"type": "divider"
459-
},
460-
{
461-
"type": "section",
462-
"text": {
463-
"type": "mrkdwn",
464-
"text": "${{ needs.test-go.result != 'failure' && ':white_check_mark:' || ':x:' }} Go tests\n${{ needs.test-go-race.result != 'failure' && ':white_check_mark:' || ':x:' }} Go race tests\n\t\t${{ needs.test-go-race.outputs.data-race-result != 'success' && ':x: Data race detected' || ':white_check_mark: No race detected' }}\n${{ needs.test-go-testonly.result != 'failure' && ':white_check_mark:' || ':x:' }} Go testonly tests\n${{ needs.test-ui.result != 'failure' && ':white_check_mark:' || ':x:' }} UI tests"
465-
},
466-
"accessory": {
467-
"type": "button",
468-
"text": {
469-
"type": "plain_text",
470-
"text": "View Failing Workflow",
471-
"emoji": true
472-
},
473-
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
474-
}
475-
}
476-
]
477-
}
447+
channel: C05AABYEA9Y
448+
text: ${{ needs.setup.outputs.is-ent-branch == 'true' && 'vault-enterprise' || 'vault' }} test failures on ${{ github.ref_name }}
449+
blocks:
450+
- type: header
451+
text:
452+
type: plain_text
453+
text: :rotating_light: ${{ needs.setup.outputs.is-ent-branch == 'true' && 'vault-enterprise' || 'vault' }} test failures on ${{ github.ref_name }} :rotating_light:
454+
emoji: true
455+
- type: divider
456+
- type: section
457+
text:
458+
type: mrkdwn
459+
text: |
460+
${{ needs.test-go.result != 'failure' && ':white_check_mark:' || ':x:' }} Go tests
461+
${{ needs.test-go-race.result != 'failure' && ':white_check_mark:' || ':x:' }} Go race tests
462+
${{ needs.test-go-race.outputs.data-race-result != 'success' && ':x: Data race detected' || ':white_check_mark: No race detected' }}
463+
${{ needs.test-go-testonly.result != 'failure' && ':white_check_mark:' || ':x:' }} Go testonly tests
464+
${{ needs.test-ui.result != 'failure' && ':white_check_mark:' || ':x:' }} UI tests"
465+
accessory:
466+
type: button
467+
text:
468+
type: plain_text
469+
text: View Failing Workflow
470+
emoji: true
471+
url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
478472
# Only create the PR summary if it's a pull request and it is not a fork as we need access
479473
# to secrets.
480474
- if: ${{ needs.setup.outputs.is-fork == 'false' }}

0 commit comments

Comments
 (0)