From 368da14581476b889ee130a7a05e4ef3ef70c4a1 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Thu, 5 Jul 2018 10:59:47 -0400 Subject: [PATCH] Add/update slack notifications Add slack notifications for CircleCI nightly releases Update VSTS slack notifications to match other platforms. --- .circleci/config.yml | 38 +++++++++++++++++++++++++++++--------- vsts.yml | 25 +++++++++++++++++++------ 2 files changed, 48 insertions(+), 15 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7c36f10ad96..05693b8ae07 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,3 +1,24 @@ +notify-slack-failure: ¬ify-slack-failure + run: + name: Send a slack notification on failure + command: | + if [ "$NIGHTLY_BUILD" == "true" ]; then + export MESSAGE="Build failed for *<$CIRCLE_BUILD_URL|$CIRCLE_JOB>* nightly build." + curl -g -H "Content-Type: application/json" -X POST \ + -d "{\"text\": \"$MESSAGE\", \"attachments\": [{\"color\": \"#FC5C3C\",\"title\": \"$CIRCLE_JOB nightly build results\",\"title_link\": \"$CIRCLE_BUILD_URL\"}]}" $SLACK_WEBHOOK + fi + when: on_fail +notify-slack-success: ¬ify-slack-success + run: + name: Send a slack notification on success + command: | + if [ "$NIGHTLY_BUILD" == "true" ]; then + export MESSAGE="Build succeeded for *<$CIRCLE_BUILD_URL|$CIRCLE_JOB>* nightly build." + curl -g -H "Content-Type: application/json" -X POST \ + -d "{\"text\": \"$MESSAGE\", \"attachments\": [{\"color\": \"good\",\"title\": \"$CIRCLE_JOB nightly build results\",\"title_link\": \"$CIRCLE_BUILD_URL\"}]}" $SLACK_WEBHOOK + fi + when: on_success + build-steps: &build-steps steps: - checkout @@ -109,6 +130,8 @@ build-steps: &build-steps if [ "$CREATE_TYPESCRIPT_DEFS" == "true" ]; then npm run create-typescript-definitions fi + - <<: *notify-slack-failure + - <<: *notify-slack-success - persist_to_workspace: root: out paths: @@ -165,6 +188,7 @@ jobs: environment: TARGET_ARCH: arm RUN_RELEASE_BUILD: true + NIGHTLY_BUILD: true <<: *build-defaults resource_class: 2xlarge @@ -203,6 +227,7 @@ jobs: environment: TARGET_ARCH: arm64 RUN_RELEASE_BUILD: true + NIGHTLY_BUILD: true <<: *build-defaults resource_class: 2xlarge @@ -219,6 +244,7 @@ jobs: environment: TARGET_ARCH: ia32 RUN_RELEASE_BUILD: true + NIGHTLY_BUILD: true <<: *build-defaults resource_class: xlarge @@ -242,6 +268,7 @@ jobs: environment: TARGET_ARCH: x64 RUN_RELEASE_BUILD: true + NIGHTLY_BUILD: true <<: *build-defaults resource_class: xlarge @@ -259,6 +286,7 @@ jobs: TARGET_ARCH: x64 RUN_RELEASE_BUILD: true INSTALL_MACOS_NODE: true + NIGHTLY_BUILD: true macos: xcode: "8.3.3" <<: *build-steps @@ -279,6 +307,7 @@ jobs: MAS_BUILD: 1 RUN_RELEASE_BUILD: true INSTALL_MACOS_NODE: true + NIGHTLY_BUILD: true macos: xcode: "8.3.3" <<: *build-steps @@ -327,12 +356,3 @@ workflows: - electron-linux-arm64-release-nightly - electron-linux-ia32-release-nightly - electron-linux-x64-release-nightly - -experimental: - notify: - branches: - only: - - master - - 2-0-x - - 1-8-x - - 1-7-x diff --git a/vsts.yml b/vsts.yml index 5209acdec2e..52faf62c060 100644 --- a/vsts.yml +++ b/vsts.yml @@ -67,16 +67,29 @@ steps: - task: PublishTestResults@2 displayName: Publish Test Results inputs: - testResultsFiles: 'test-results.xml' - searchFolder: junit - condition: and(always(), ne(variables['ELECTRON_RELEASE'], '1')) + testResultsFiles: '**/test-*.xml' + condition: and(always(), eq(variables['MOCHA_FILE'], 'test-results.xml')) - task: kasunkodagoda.slack-notification.slack-notification-task.SlackNotification@3 - displayName: Post Slack Notification + displayName: Post Slack Notification on Failure inputs: SlackApiToken: '$(slack_token)' Channel: '#bot-nightly-releases' - Message: '$(Build.DefinitionName)-$(Build.BuildNumber) finished with a $(Agent.JobStatus) status.' - condition: and(always(), eq(variables['Build.Reason'], 'Schedule')) + Message: 'Build failed for *<$(System.TeamFoundationCollectionUri)$(System.TeamProject)/_build/results?buildId=$(Build.BuildId)|$(Build.DefinitionName)>* nightly build.' + Title: '$(Build.DefinitionName) nightly build results' + TitleLink: '$(System.TeamFoundationCollectionUri)$(System.TeamProject)/_build/results?buildId=$(Build.BuildId)' + Color: '#FC5C3C' + condition: and(failed(), eq(variables['Build.Reason'], 'Schedule')) + +- task: kasunkodagoda.slack-notification.slack-notification-task.SlackNotification@3 + displayName: Post Slack Notification on Success + inputs: + SlackApiToken: '$(slack_token)' + Channel: '#bot-nightly-releases' + Message: 'Build succeeded for *<$(System.TeamFoundationCollectionUri)$(System.TeamProject)/_build/results?buildId=$(Build.BuildId)|$(Build.DefinitionName)>* nightly build.' + Title: '$(Build.DefinitionName) nightly build results' + TitleLink: '$(System.TeamFoundationCollectionUri)$(System.TeamProject)/_build/results?buildId=$(Build.BuildId)' + Color: 'good' + condition: and(succeeded(), eq(variables['Build.Reason'], 'Schedule')) - task: mspremier.PostBuildCleanup.PostBuildCleanup-task.PostBuildCleanup@3