Update _index.md #21332
Workflow file for this run
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: Preview Synthetics | |
on: [pull_request] | |
# Stop the current running job if a new push is made to the PR | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref }} | |
cancel-in-progress: true | |
jobs: | |
synthetic_testing: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
path: repo | |
sparse-checkout: | | |
. | |
- name: Extract branch name | |
shell: bash | |
run: echo "branch=$(echo ${{ github.event.pull_request.head.ref }})" >>$GITHUB_OUTPUT | |
id: extract_branch | |
- name: Check preview status | |
id: check-status | |
run: | | |
URL="https://docs-staging.datadoghq.com/${{steps.extract_branch.outputs.branch}}" | |
SUCCESS_CODES=("200" "302" "304") | |
for i in {1..30} | |
do | |
status=$(curl -o /dev/null -s -w "%{http_code}\n" $URL) | |
if [[ " ${SUCCESS_CODES[@]} " =~ " ${status} " ]]; then | |
echo "Preview site has been deployed" | |
break | |
else | |
echo "Waiting for preview site to return 200 || 302 || 304..." | |
echo "Currently returning ${status}" | |
sleep 30 | |
fi | |
if [[ $i -eq 30 && ! (" ${SUCCESS_CODES[@]} " =~ " ${status} ") ]]; then | |
echo "Preview site returned ${status} for 15 minutes, there may be an issue with the preview site build" | |
exit 1 | |
fi | |
done | |
- name: Run Datadog Synthetic tests | |
uses: DataDog/[email protected] | |
env: | |
CI_COMMIT_REF_NAME: ${{steps.extract_branch.outputs.branch}} | |
with: | |
api_key: ${{secrets.DD_API_KEY}} | |
app_key: ${{secrets.DD_APP_KEY}} | |
config_path: 'repo/datadog-ci.preview.json' |