forked from adoptium/aqa-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
192 lines (167 loc) · 8.36 KB
/
Copy pathcreate-release-issues.yml
File metadata and controls
192 lines (167 loc) · 8.36 KB
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This code was partially generated by Co-pilot
name: Create Release Issues
on:
workflow_dispatch:
inputs:
version:
description: "Release version (such as 8 or 21)"
required: true
type: string
releaseDate:
description: "Release date (Month and Year, e.g. 'July 2025')"
required: true
type: string
pipelineUrl:
description: "Optional URL of the release pipeline, if available"
required: false
type: string
dryRun:
description: "Dry run mode: when true, prefix all issue titles with 'Dry-run:'"
required: false
type: boolean
default: false
repository_dispatch:
types: [custom_event]
permissions:
contents: read
issues: write
pull-requests: read
jobs:
create-issues:
runs-on: ubuntu-latest
steps:
- name: Create parent and sub-issues
env:
GH_TOKEN: ${{ secrets.TEMURIN_ISSUES_TOKEN || secrets.GITHUB_TOKEN }}
VERSION: "JDK${{ inputs.version || github.event.client_payload.version }}"
RELEASE_DATE: ${{ inputs.releaseDate || github.event.client_payload.releaseDate }}
PRIMARY_PLATFORMS: "aarch64_linux,aarch64_mac,x86-64_linux,x86-64_mac,x86-64_windows"
SECONDARY_PLATFORMS: "aarch64_windows,ppc64le_linux,s390x_linux,ppc64_aix"
SKIP_INTERACTIVES: "true"
HEADLESS_PLATFORMS: "aarch64_alpine-linux,riscv64_linux,x86-64_alpine-linux"
PIPELINE_URL: ${{ inputs.pipelineUrl || github.event.client_payload.pipelineUrl }}
DRY_RUN: ${{ inputs.dryRun || github.event.client_payload.dryRun || false }}
run: |
set -euo pipefail
TITLE_PREFIX=""
if [[ "$DRY_RUN" == "true" ]]; then
TITLE_PREFIX="Dry-run: "
fi
release_date_lc="${RELEASE_DATE,,}"
if [[ "$release_date_lc" == *mar* || "$release_date_lc" == *sep* ]]; then
MATRIX_INT="0"
elif [[ "$release_date_lc" == *jan* || "$release_date_lc" == *jul* ]]; then
MATRIX_INT="1"
elif [[ "$release_date_lc" == *apr* || "$release_date_lc" == *oct* ]]; then
MATRIX_INT="2"
else
echo "Expected month containing Mar/Sep, Jan/Jul, or Apr/Oct. Interim release with RELEASE_DATE: $RELEASE_DATE"
MATRIX_INT="3"
fi
# Returns the URL of an existing open issue with the given title, or nothing if none found.
find_existing_issue() {
local title="$1"
gh issue list \
--state open \
--search "\"$title\" in:title" \
--json url,title \
--jq ".[] | select(.title == \"$title\") | .url" \
--repo "$GITHUB_REPOSITORY" | head -1
}
version_label="$VERSION"
if [[ "$VERSION" == "JDK8" ]]; then
PRIMARY_PLATFORMS="aarch64_linux,x86-64_linux,x86-64_mac,x86-64_windows"
SECONDARY_PLATFORMS="x86-64_alpine-linux,arm_linux,ppc64le_linux,ppc64_aix"
elif [[ "$VERSION" == "JDK11" ]]; then
SECONDARY_PLATFORMS="x86-64_alpine-linux,arm_linux,ppc64le_linux,s390x_linux,ppc64_aix"
elif [[ "$VERSION" == "JDK17" ]]; then
SECONDARY_PLATFORMS="riscv64_linux,x86-64_alpine-linux,arm_linux,ppc64le_linux,s390x_linux,ppc64_aix"
else
SECONDARY_PLATFORMS="aarch64_alpine-linux,riscv64_linux,x86-64_alpine-linux,aarch64_windows,ppc64le_linux,s390x_linux,ppc64_aix"
fi
gh label create "$version_label" -d "Version $version_label" -c "ededed" >/dev/null 2>&1 || true
IFS=',' read -r -a primary_platforms <<< "$PRIMARY_PLATFORMS"
IFS=',' read -r -a secondary_platforms <<< "$SECONDARY_PLATFORMS"
IFS=',' read -r -a headless_platforms <<< "$HEADLESS_PLATFORMS"
tasks=""
for raw in "${primary_platforms[@]}"; do
platform="$(echo "$raw" | xargs)"
if [[ -z "$platform" ]]; then
continue
fi
sub_body=$(printf 'Version: %s\nPlatform: %s\nMatrix: %s\n\nChecklist:\n- [ ] Triage AQAvit tests\n- [ ] Triage TCK automated tests\n %s\n\nClose this issue when checklist completed.' "$VERSION" "$platform" "$MATRIX_INT")
if [[ "$SKIP_INTERACTIVES" == "true" ]]; then
for interactive in "${headless_platforms[@]}"; do
if [[ "$platform" == "$(echo "$interactive" | xargs)" ]]; then
echo "Adjusting issue body for non-interactive platform: $platform"
sub_body=$(printf 'Version: %s\nHeadless Platform: %s\n\nChecklist:\n- [ ] Triage AQAvit tests\n- [ ] Triage TCK automated tests (no dev.jck for headless)\n %s\n\nClose this issue when checklist completed.' "$VERSION" "$platform")
fi
done
fi
sub_title="${TITLE_PREFIX}Triage Automated Tests for $RELEASE_DATE $VERSION - $platform"
existing_url=$(find_existing_issue "$sub_title")
if [[ -n "$existing_url" ]]; then
echo "Issue already exists, skipping: $sub_title ($existing_url)"
sub_url="$existing_url"
else
sub_url=$(gh issue create \
--title "$sub_title" \
--body "$sub_body" \
--label "$version_label" \
--repo "$GITHUB_REPOSITORY")
fi
tasks+="- [ ] $sub_url"$'\n'
done
secondary_tasks=""
for raw in "${secondary_platforms[@]}"; do
platform="$(echo "$raw" | xargs)"
if [[ -z "$platform" ]]; then
continue
fi
sub_body=$(printf 'Version: %s\nPlatform: %s\nMatrix: %s\n\nChecklist:\n- [ ] Triage AQAvit tests\n- [ ] Triage TCK automated tests\n %s\n\nClose this issue when checklist completed.' "$VERSION" "$platform" "$MATRIX_INT")
if [[ "$SKIP_INTERACTIVES" == "true" ]]; then
for interactive in "${headless_platforms[@]}"; do
if [[ "$platform" == "$(echo "$interactive" | xargs)" ]]; then
echo "Adjusting issue body for non-interactive platform: $platform"
sub_body=$(printf 'Version: %s\nHeadless Platform: %s\n\nChecklist:\n- [ ] Triage AQAvit tests\n- [ ] Triage TCK automated tests (no dev.jck for headless)\n %s\n\nClose this issue when checklist completed.' "$VERSION" "$platform")
fi
done
fi
sub_title="${TITLE_PREFIX}Triage Automated Tests for $RELEASE_DATE $VERSION - $platform"
existing_url=$(find_existing_issue "$sub_title")
if [[ -n "$existing_url" ]]; then
echo "Issue already exists, skipping: $sub_title ($existing_url)"
sub_url="$existing_url"
else
sub_url=$(gh issue create \
--title "$sub_title" \
--body "$sub_body" \
--label "$version_label" \
--repo "$GITHUB_REPOSITORY")
fi
secondary_tasks+="- [ ] $sub_url"$'\n'
done
parent_body=$(printf 'Pipeline URL: %s\nVersion: %s\nPrimary Platforms: %s\nSecondary Platforms: %s\n\n### Primary Tasks\n\n%s\n### Secondary Tasks\n\n%s\n' "$PIPELINE_URL" "$VERSION" "$PRIMARY_PLATFORMS" "$SECONDARY_PLATFORMS" "$tasks" "$secondary_tasks")
parent_title="${TITLE_PREFIX}$RELEASE_DATE Release AQAvit Activities - $VERSION"
existing_parent=$(find_existing_issue "$parent_title")
if [[ -n "$existing_parent" ]]; then
echo "Parent issue already exists, skipping: $parent_title ($existing_parent)"
else
gh issue create \
--title "$parent_title" \
--body "$parent_body" \
--label "$version_label" \
--repo "$GITHUB_REPOSITORY"
fi