-
Notifications
You must be signed in to change notification settings - Fork 1.2k
131 lines (116 loc) · 5.43 KB
/
create_rc_pr.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
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@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version-file: .python-version
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: 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: |
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=$(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
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@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version-file: .python-version
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: 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 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
- 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
inv -e release.create-rc -r "$MATRIX" --slack-webhook=${{ secrets.AGENT6_RELEASE_SLACK_WEBHOOK }} --patch-version
else
inv -e release.create-rc -r "$MATRIX" --slack-webhook=${{ secrets.AGENT_RELEASE_SYNC_SLACK_WEBHOOK }}
fi
- name: Rebuild agent 6 RC pipeline if no changes and in qualification phase
if: ${{ env.IS_AGENT6_RELEASE == 'true' && steps.check_for_changes.outputs.CHANGES == 'false' && env.IS_QUALIFICATION == 'true' }}
run: |
inv -e release.run-rc-pipeline -r 6.53.x