Skip to content

Commit

Permalink
test alert
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Dec 19, 2024
1 parent 007c8aa commit df47909
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 51 deletions.
119 changes: 68 additions & 51 deletions .github/workflows/create_rc_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ on:

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_API_TOKEN : ${{ secrets.SLACK_API_TOKEN }}
AGENT6_RELEASE_BRANCH: '6.53.x'
IS_AGENT6_RELEASE: ${{ github.event.schedule == '0 9 * * 1' }}
# IS_AGENT6_RELEASE: ${{ github.event.schedule == '0 9 * * 1' }}
IS_AGENT6_RELEASE: 'true'
permissions: {}

jobs:
Expand All @@ -20,6 +22,21 @@ jobs:
branches: ${{ steps.branches.outputs.value }}
warning: ${{ steps.warning.outputs.value }}
steps:
- name: Check if agent 6 rc PR already exists
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')
err_msg="Error: An agent 6 release candidate PR already exists. Please merge and build it before creating a new one: $pr_url"
inv notify.send-slack-msg '#test-send-msg' "$err_msg"
exit 1
fi
- name: Checkout repository
if: ${{ env.IS_AGENT6_RELEASE == 'false' }}
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
Expand Down Expand Up @@ -57,57 +74,57 @@ jobs:
run: |
echo "value=-w" >> $GITHUB_OUTPUT
create_rc_pr:
runs-on: ubuntu-latest
needs: find_release_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@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
with:
persist-credentials: true
# create_rc_pr:
# runs-on: ubuntu-latest
# needs: find_release_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@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
# with:
# persist-credentials: true

- name: Install python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: 3.11
cache: "pip"
# - name: Install python
# uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
# with:
# python-version: 3.11
# cache: "pip"

- name: Install Python dependencies
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: Install Python dependencies
# 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: Check for changes since last RC
id: check_for_changes
env:
ATLASSIAN_USERNAME: ${{ secrets.ATLASSIAN_USERNAME }}
ATLASSIAN_PASSWORD: ${{ secrets.ATLASSIAN_PASSWORD }}
SLACK_API_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=$(inv -e release.check-for-changes -r "$MATRIX" "$WARNING")" >> $GITHUB_OUTPUT
else
echo "CHANGES=$(inv -e release.check-for-changes -r "$MATRIX")" >> $GITHUB_OUTPUT
fi
# - name: Check for changes since last RC
# id: check_for_changes
# env:
# ATLASSIAN_USERNAME: ${{ secrets.ATLASSIAN_USERNAME }}
# ATLASSIAN_PASSWORD: ${{ secrets.ATLASSIAN_PASSWORD }}
# SLACK_API_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=$(inv -e release.check-for-changes -r "$MATRIX" "$WARNING")" >> $GITHUB_OUTPUT
# else
# echo "CHANGES=$(inv -e release.check-for-changes -r "$MATRIX")" >> $GITHUB_OUTPUT
# fi

- name: Create RC PR
if: ${{ steps.check_for_changes.outputs.CHANGES == 'true' || env.IS_AGENT6_RELEASE == 'true' }}
env:
MATRIX: ${{ matrix.value }}
run: |
if ${{ env.IS_AGENT6_RELEASE == 'true' }}; then
inv -e release.create-rc -r "$MATRIX" --slack-webhook=${{ secrets.AGENT_RELEASE_SYNC_SLACK_WEBHOOK }} --patch-version
else
inv -e release.create-rc -r "$MATRIX" --slack-webhook=${{ secrets.AGENT_RELEASE_SYNC_SLACK_WEBHOOK }}
fi
# - name: Create RC PR
# if: ${{ steps.check_for_changes.outputs.CHANGES == 'true' || env.IS_AGENT6_RELEASE == 'true' }}
# env:
# MATRIX: ${{ matrix.value }}
# run: |
# if ${{ env.IS_AGENT6_RELEASE == 'true' }}; then
# inv -e release.create-rc -r "$MATRIX" --slack-webhook=${{ secrets.AGENT_RELEASE_SYNC_SLACK_WEBHOOK }} --patch-version
# else
# inv -e release.create-rc -r "$MATRIX" --slack-webhook=${{ secrets.AGENT_RELEASE_SYNC_SLACK_WEBHOOK }}
# fi
6 changes: 6 additions & 0 deletions tasks/notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,3 +271,9 @@ def close_failing_tests_stale_issues(_, dry_run=False):
print(f'Error closing issue {issue["key"]}: {e}', file=sys.stderr)

print(f'Closed {n_closed} issues without failing tests')

@task
def send_slack_msg(_, channel, message):
from slack_sdk import WebClient
client = WebClient(os.environ["SLACK_API_TOKEN"])
client.chat_postMessage(channel=channel, text=message)

0 comments on commit df47909

Please sign in to comment.