diff --git a/.github/workflows/create_rc_pr.yml b/.github/workflows/create_rc_pr.yml index 0e5de270d2f41..0c14c56a0c900 100644 --- a/.github/workflows/create_rc_pr.yml +++ b/.github/workflows/create_rc_pr.yml @@ -9,63 +9,77 @@ on: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SLACK_API_TOKEN : ${{ secrets.SLACK_DATADOG_AGENT_BOT_TOKEN }} AGENT6_RELEASE_BRANCH: '6.53.x' # IS_AGENT6_RELEASE: ${{ github.event.schedule == '0 9 * * 1' }} IS_AGENT6_RELEASE: 'true' permissions: {} jobs: + agent6_check: + runs-on: ubuntu-latest + outputs: + a6_error: ${{ steps.a6_error.outputs.value }} + steps: + - name: Check if agent 6 rc PR already exists + id: a6_error + if: ${{ env.IS_AGENT6_RELEASE == 'true' }} + run: | + prs=$(gh pr list \ + --repo "$GITHUB_REPOSITORY" \ + --base "$AGENT6_RELEASE_BRANCH" \ + --json url,title \ + --search "Update release.json and Go modules for in:title") + echo $prs + if [ "$(echo "$prs" | jq 'length')" -gt 0 ]; then + pr_url=$(echo "$prs" | jq -r '.[0].url') + echo "value=Error: An agent 6 release candidate PR already exists, please merge and build it before creating a new one $pr_url" >> $GITHUB_OUTPUT + fi + + - name: Send Agent 6 error to slack + uses: slackapi/slack-github-action@v2.0.0 + if: ${{ env.IS_AGENT6_RELEASE == 'true' && steps.a6_error.outputs.value }} + with: + webhook: ${{ secrets.SLACK_DATADOG_AGENT_CI_WEBHOOK }} + webhook-type: webhook-trigger + payload: | + channel_id: "C085P12CTFX" + message: "${{ steps.a6_error.outputs.value }}" + + - name: Fail and exit workflow + if: ${{ env.IS_AGENT6_RELEASE == 'true' && steps.a6_error.outputs.value }} + run: | + echo ${{ steps.a6_error.outputs.value }} + exit 1 + find_release_branches: runs-on: ubuntu-latest + needs: agent6_check outputs: branches: ${{ steps.branches.outputs.value }} - a6_error: ${{ steps.a6_error.outputs.value }} warning: ${{ steps.warning.outputs.value }} steps: - - name: Check if agent 6 rc PR already exists - id: a6_error - if: ${{ env.IS_AGENT6_RELEASE == 'true' }} - run: | - prs=$(gh pr list \ - --repo "$GITHUB_REPOSITORY" \ - --base "$AGENT6_RELEASE_BRANCH" \ - --json url,title \ - --search "Update release.json and Go modules for in:title") - echo $prs - if [ "$(echo "$prs" | jq 'length')" -gt 0 ]; then - pr_url=$(echo "$prs" | jq -r '.[0].url') - echo "value=Error: An agent 6 release candidate PR already exists. Please merge and build it before creating a new one: $pr_url" >> $GITHUB_OUTPUT - fi - name: Checkout repository - if: ${{ env.IS_AGENT6_RELEASE == 'false' || steps.a6_error.outputs.value }} + if: ${{ env.IS_AGENT6_RELEASE == 'false' }} uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 with: sparse-checkout: 'tasks' persist-credentials: false - name: Install python - if: ${{ env.IS_AGENT6_RELEASE == 'false' || steps.a6_error.outputs.value }} + if: ${{ env.IS_AGENT6_RELEASE == 'false' }} uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 with: python-version: 3.11 cache: "pip" - name: Install Python dependencies - if: ${{ env.IS_AGENT6_RELEASE == 'false' || steps.a6_error.outputs.value }} + if: ${{ env.IS_AGENT6_RELEASE == 'false' }} run: | python -m pip install --upgrade pip pip install -r requirements.txt pip install -r tasks/libs/requirements-github.txt pip install -r tasks/requirements_release_tasks.txt - - name: Send Agent 6 error to slack - run: | - if [ -n "${{ steps.a6_error.outputs.value }}" ]; then - inv notify.send-slack-msg '#test-send-msg' "${{ steps.a6_error.outputs.value }}" - exit 1 - fi - - name: Determine the release active branches id: branches run: |