monitor-api-integration-test #82
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
name: monitor-api-integration-test | |
on: | |
schedule: | |
# 1pm UTC (9am EDT, 8am EST), every day | |
- cron: "0 13 * * *" | |
jobs: | |
integration-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Node 18 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Cache Node modules | |
id: cache-node-modules | |
uses: actions/cache@v3 | |
with: | |
path: "**/node_modules" | |
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | |
- name: Test getting recommended monitors | |
env: | |
DD_API_KEY: ${{ secrets.DD_API_KEY }} | |
DD_APP_KEY: ${{ secrets.DD_APP_KEY }} | |
run: npm run test:integration | |
- name: Send failure message to Slack | |
env: | |
SLACK_CHANNEL: "#serverless-onboarding-and-enablement-ops" | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
if: failure() | |
run: | | |
set -x | |
OPS_MESSAGE=":gh-check-failed: Serverless Plugin failed to fetch recommended monitors from monitor API! | |
Please check GitHub Action log: https://github.com/DataDog/serverless-plugin-datadog/actions/workflows/monitor_api_integration_test.yml" | |
curl -H "Content-type: application/json" -X POST "$SLACK_WEBHOOK" -d '{ | |
"channel": "'"$SLACK_CHANNEL"'", | |
"text": "'"$OPS_MESSAGE"'" | |
}' |