Skip to content

Commit 09eed91

Browse files
authored
Merge branch 'master' into ivoanjo/prof-11385-gvl-profiling-ga
2 parents 0b8012e + 18de083 commit 09eed91

File tree

4 files changed

+532
-87
lines changed

4 files changed

+532
-87
lines changed

.github/workflows/publish.yml

+114-4
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ jobs:
119119
attestations: false # PENDING decision for attestations
120120

121121
github-release:
122-
name: Attach gem to GitHub release and publish
122+
name: Attach gem to Github Release and publish
123123
runs-on: ubuntu-24.04
124124
needs:
125125
- verify-checks
@@ -138,15 +138,127 @@ jobs:
138138
gh release upload "v${GEM_VERSION}" *.gem --clobber
139139
gh release edit "v${GEM_VERSION}" --draft=false
140140
141-
update-document:
141+
update-gem-version:
142142
if: github.ref_name == 'master'
143+
name: Prepare next gem version
143144
runs-on: ubuntu-24.04
144145
needs:
145146
- verify-checks
146147
- rubygems-release
148+
env:
149+
GEM_VERSION: ${{ needs.verify-checks.outputs.version }}
150+
outputs:
151+
next_version: ${{ steps.next_version.outputs.next_version }}
152+
steps:
153+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
154+
with:
155+
fetch-depth: 0
156+
- run: bundle install
157+
- id: next_version
158+
run: |
159+
echo "next_version=$(bundle exec rake version:next)" >> $GITHUB_OUTPUT
160+
161+
# https://docs.github.com/en/rest/issues/milestones?apiVersion=2022-11-28
162+
milestone:
163+
if: github.ref_name == 'master'
164+
name: Open/Close Github milestones
165+
runs-on: ubuntu-24.04
166+
needs:
167+
- verify-checks
168+
- rubygems-release
169+
- update-gem-version
147170
env:
148171
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
149172
GEM_VERSION: ${{ needs.verify-checks.outputs.version }}
173+
NEXT_VERSION: ${{ needs.update-gem-version.outputs.next_version }}
174+
permissions:
175+
issues: write
176+
pull-requests: write
177+
steps:
178+
- name: list milestones
179+
id: milestones
180+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
181+
with:
182+
script: |
183+
// https://octokit.github.io/rest.js/v21/#issues-list-milestones
184+
// https://docs.github.com/en/rest/issues/milestones?apiVersion=2022-11-28#list-milestones
185+
const milestones = await github.rest.issues.listMilestones({
186+
owner: context.repo.owner,
187+
repo: context.repo.repo,
188+
state: 'open'
189+
});
190+
return milestones.data;
191+
192+
- name: Close milestone
193+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
194+
with:
195+
script: |
196+
const milestones = ${{steps.milestones.outputs.result}}
197+
198+
const milestone = milestones.data.find(
199+
m => m.title === process.env.GEM_VERSION
200+
);
201+
202+
if (!milestone) {
203+
console.log(`No open milestone found with version ${process.env.GEM_VERSION} - skipping close operation`);
204+
return;
205+
}
206+
207+
// https://octokit.github.io/rest.js/v21/#issues-update-milestone
208+
// https://docs.github.com/en/rest/issues/milestones?apiVersion=2022-11-28#update-a-milestone
209+
try {
210+
await github.rest.issues.updateMilestone({
211+
owner: context.repo.owner,
212+
repo: context.repo.repo,
213+
milestone_number: milestone.number,
214+
state: 'closed'
215+
});
216+
console.log(`Successfully closed milestone: ${process.env.GEM_VERSION}`);
217+
} catch (error) {
218+
core.setFailed(`Failed to close milestone: ${error.message}`);
219+
}
220+
221+
- name: Create milestone
222+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
223+
with:
224+
script: |
225+
const milestones = ${{steps.milestones.outputs.result}}
226+
227+
const milestone = milestones.data.find(
228+
m => m.title === process.env.NEXT_VERSION
229+
);
230+
231+
if (milestone) {
232+
console.log(`Milestone "${process.env.NEXT_VERSION}" already exists - skipping creation`);
233+
return;
234+
}
235+
236+
// https://octokit.github.io/rest.js/v21/#issues-create-milestone
237+
// https://docs.github.com/en/rest/issues/milestones?apiVersion=2022-11-28#create-a-milestone
238+
try {
239+
await github.rest.issues.createMilestone({
240+
owner: context.repo.owner,
241+
repo: context.repo.repo,
242+
title: process.env.NEXT_VERSION
243+
});
244+
console.log(`Successfully created milestone: ${process.env.NEXT_VERSION}`);
245+
} catch (error) {
246+
core.setFailed(`Failed to create milestone: ${error.message}`);
247+
}
248+
249+
update-release-branch:
250+
if: github.ref_name == 'master'
251+
name: Pull request to update 'release' branch
252+
runs-on: ubuntu-24.04
253+
needs:
254+
- verify-checks
255+
- rubygems-release
256+
permissions:
257+
issues: write
258+
pull-requests: write
259+
env:
260+
GITHUB_TOKEN: ${{ secrets.GHA_PAT }}
261+
GEM_VERSION: ${{ needs.verify-checks.outputs.version }}
150262
steps:
151263
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
152264
with:
@@ -160,5 +272,3 @@ jobs:
160272
--title "Update document v${GEM_VERSION}" \
161273
--body "This is an auto-generated PR to update documentation from [here](${JOB_URL}). Please merge (with a merge commit) when ready." \
162274
--label "docs"
163-
164-
# TODO: Close existing milestone and create next milestone

.gitlab-ci.yml

+11-10
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ default:
2424
rules:
2525
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_PIPELINE_SOURCE == "push"
2626
changes:
27-
- .gitlab/Dockerfile-*
28-
when: manual
27+
- .gitlab/Dockerfile-* # these are direct dependencies
28+
- .gitlab-ci.yml # list of images is here so it is a dependency too
2929
allow_failure: true
3030
image: $DOCKER_REGISTRY/docker:20.10.13
3131
parallel:
@@ -54,7 +54,13 @@ build-image-arm64:
5454

5555
promote-image:
5656
stage: manual-images
57-
when: manual
57+
rules: # same as build-image
58+
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_PIPELINE_SOURCE == "push"
59+
changes:
60+
- .gitlab/Dockerfile-* # these are direct dependencies
61+
- .gitlab-ci.yml # list of images is here so it is a dependency too
62+
when: manual # this one is manual, but it means that install-dependencies may be hitting the wrong <base>:current til this is run
63+
allow_failure: true
5864
tags: ["runner:docker"]
5965
image: $DOCKER_REGISTRY/docker:20.10.13
6066
parallel:
@@ -162,16 +168,11 @@ deploy_to_reliability_env:
162168
# Due to the constraints of Github workflow dispatch endpoint, it does not return the workflow run id.
163169
# https://docs.github.com/en/rest/actions/workflows?apiVersion=2022-11-28#create-a-workflow-dispatch-event
164170
#
165-
# We fetch the latest workflow run from vaccine after 5 seconds of the dispatch event.
166-
# False positive/negative result can happen when multiple requests are made within the same window.
167-
#
168-
# TODO:
169-
# Replace polling implementation with reporting status to Github with Github App. This will allow us
170-
# to get a deterministic result without mismatched workflow run id.
171+
# We fetch the latest workflow runs from vaccine then match against the run name, polling until we find it.
171172
vaccine:
172173
image: $DOCKER_REGISTRY/docker:20.10.13
173174
tags: [ "arch:amd64" ]
174175
stage: vaccine
175176
needs: [create-multiarch-lib-injection-image]
176177
script: |
177-
.gitlab/scripts/vaccine.sh
178+
.gitlab/scripts/vaccine.sh master "${CI_COMMIT_SHA}" "glci:${CI_PIPELINE_ID}"

0 commit comments

Comments
 (0)