Create RC PR #489
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: Create RC PR | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 14 * * 1,3,5' # Run on Monday, Wednesday, and Friday at 14:00 UTC | |
- cron: '0 8 * * 1,3,5' # Same as above but at 08:00 UTC, to warn agent-integrations team about releasing | |
- cron: '0 9 * * 1' # Run Agent 6 workflow on Monday at 09:00 UTC | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
AGENT6_RELEASE_BRANCH: '6.53.x' | |
IS_AGENT6_RELEASE: ${{ github.event.schedule == '0 9 * * 1' }} | |
permissions: {} | |
jobs: | |
find_release_branches: | |
runs-on: ubuntu-latest | |
outputs: | |
branches: ${{ steps.branches.outputs.value }} | |
warning: ${{ steps.warning.outputs.value }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 | |
with: | |
sparse-checkout: 'tasks' | |
persist-credentials: false | |
- name: Install python | |
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 | |
with: | |
python-version-file: .python-version | |
cache: "pip" | |
- name: Install dda | |
uses: ./.github/actions/install-dda | |
with: | |
features: legacy-tasks | |
- name: Check previous agent 6 RC status | |
if: ${{ env.IS_AGENT6_RELEASE == 'true' }} | |
env: | |
DD_SITE: 'datadoghq.com' | |
DD_API_KEY: ${{ secrets.DD_API_KEY }} | |
DD_APP_KEY: ${{ secrets.DD_APP_KEY }} | |
SLACK_DATADOG_AGENT_CI_WEBHOOK: ${{ secrets.SLACK_DATADOG_AGENT_CI_WEBHOOK }} | |
run: | | |
dda inv -e release.check-previous-agent6-rc | |
- name: Determine the release active branches | |
id: branches | |
run: | | |
if ${{ env.IS_AGENT6_RELEASE == 'true' }}; then | |
echo "value=[\"$AGENT6_RELEASE_BRANCH\"]" >> $GITHUB_OUTPUT | |
else | |
echo "value=$(dda inv release.get-unreleased-release-branches)" >> $GITHUB_OUTPUT | |
fi | |
- name: Set the warning option | |
id: warning | |
if: github.event.schedule == '0 8 * * 1,3,5' | |
run: | | |
echo "value=-w" >> $GITHUB_OUTPUT | |
create_rc_pr: | |
runs-on: ubuntu-latest | |
needs: find_release_branches | |
if: ${{ needs.find_release_branches.outputs.branches != '[]' && needs.find_release_branches.outputs.branches != '' }} | |
permissions: | |
contents: write | |
pull-requests: write | |
strategy: | |
matrix: | |
value: ${{fromJSON(needs.find_release_branches.outputs.branches)}} | |
fail-fast: false | |
steps: | |
- name: Checkout the main branch | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
persist-credentials: true | |
- name: Install python | |
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 | |
with: | |
python-version-file: .python-version | |
cache: "pip" | |
- name: Install dda | |
uses: ./.github/actions/install-dda | |
with: | |
features: legacy-tasks | |
- name: Check for changes since last RC | |
id: check_for_changes | |
env: | |
ATLASSIAN_USERNAME: ${{ secrets.ATLASSIAN_USERNAME }} | |
ATLASSIAN_PASSWORD: ${{ secrets.ATLASSIAN_PASSWORD }} | |
SLACK_DATADOG_AGENT_BOT_TOKEN : ${{ secrets.SLACK_DATADOG_AGENT_BOT_TOKEN }} | |
MATRIX: ${{ matrix.value }} | |
WARNING: ${{ needs.find_release_branches.outputs.warning }} | |
run: | | |
if [ -n "${{ needs.find_release_branches.outputs.warning }}" ]; then | |
echo "CHANGES=$(dda inv -e release.check-for-changes -r "$MATRIX" "$WARNING")" >> $GITHUB_OUTPUT | |
else | |
echo "CHANGES=$(dda inv -e release.check-for-changes -r "$MATRIX")" >> $GITHUB_OUTPUT | |
fi | |
- name: Check if agent 6 is in qualification phase | |
if: ${{ env.IS_AGENT6_RELEASE == 'true' }} | |
run: | | |
is_qualification=$(inv -e release.is-qualification -r 6.53.x --output) | |
echo "IS_QUALIFICATION=$is_qualification" >> $GITHUB_ENV | |
if [[ "$is_qualification" == "true" && "${{ steps.check_for_changes.outputs.CHANGES }}" == "false" ]]; then | |
inv -e release.alert-ci-on-call -r 6.53.x --slack-webhook=${{ secrets.SLACK_DATADOG_AGENT_CI_WEBHOOK }} | |
fi | |
- name: Create RC PR | |
if: ${{ steps.check_for_changes.outputs.CHANGES == 'true' || ( env.IS_AGENT6_RELEASE == 'true' && env.IS_QUALIFICATION == 'false') }} | |
env: | |
MATRIX: ${{ matrix.value }} | |
run: | | |
if ${{ env.IS_AGENT6_RELEASE == 'true' }}; then | |
dda inv -e release.create-rc -r "$MATRIX" --slack-webhook=${{ secrets.AGENT6_RELEASE_SLACK_WEBHOOK }} --patch-version | |
else | |
dda inv -e release.create-rc -r "$MATRIX" --slack-webhook=${{ secrets.AGENT_RELEASE_SYNC_SLACK_WEBHOOK }} | |
fi |