Skip to content

Commit 550b7eb

Browse files
EtiennePerotgvisor-bot
authored andcommitted
Move PGO git logistics to a dedicated script.
This was unwieldy to have in the BuildKite pipeline directly, and variable expansion didn't seem to work. PiperOrigin-RevId: 771233792
1 parent 2a2d4ae commit 550b7eb

File tree

2 files changed

+45
-22
lines changed

2 files changed

+45
-22
lines changed

.buildkite/pgo.yaml

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,6 @@ steps:
2424
if: build.branch == "master" && build.tag == null
2525
commands:
2626
- make ARCH=x86_64 benchmark-refresh-pgo BENCHMARKS_PLATFORMS=systrap
27-
- '
28-
if [[ "$(git status --porcelain | wc -l)" -gt 0 ]]; then
29-
today="$(date +"%Y-%m-%d")" &&
30-
pgo_branch_name="pgo-update-${today}" &&
31-
git stash &&
32-
git pull --rebase=true https://github.com/google/gvisor master &&
33-
git checkout -b "$pgo_branch_name" &&
34-
git add runsc/profiles &&
35-
git status &&
36-
gh auth login --with-token < "$HOME/.github-token" &&
37-
gh auth setup-git &&
38-
export GIT_AUTHOR_NAME=gvisor-bot &&
39-
export GIT_AUTHOR_EMAIL=gvisor-bot@google.com &&
40-
export GIT_COMMITTER_NAME=gvisor-bot &&
41-
export GIT_COMMITTER_EMAIL=gvisor-bot@google.com &&
42-
git commit -m "Update runsc profiles for PGO (profile-guided optimizations), $today." &&
43-
git push --set-upstream git@github.com:google/gvisor.git "$pgo_branch_name" &&
44-
gh pr create --title="Update runsc profiles for PGO (profile-guided optimizations), $today." --body="This PR updates the runsc profiles for PGO (profile-guided optimizations)." --label=pgo-update --base=master;
45-
else
46-
echo "No changes to runsc profiles." >&2;
47-
fi
48-
'
27+
- ./.buildkite/scripts/pgo/commit-update.sh
4928
agents:
5029
arch: "amd64"
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
3+
# Copyright 2025 The gVisor Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -euxo pipefail
18+
19+
if [[ "$(git status --porcelain | wc -l)" == 0 ]]; then
20+
echo "No changes to runsc profiles." >&2
21+
exit 0
22+
fi
23+
24+
today="$(date +"%Y-%m-%d")"
25+
pgo_branch_name="pgo-update-${today}"
26+
git stash
27+
git pull --rebase=true https://github.com/google/gvisor master
28+
git checkout -b "$pgo_branch_name"
29+
git stash pop
30+
git add runsc/profiles
31+
git status
32+
gh auth login --with-token < "$HOME/.github-token"
33+
gh auth setup-git
34+
export GIT_AUTHOR_NAME=gvisor-bot
35+
export GIT_AUTHOR_EMAIL=gvisor-bot@google.com
36+
export GIT_COMMITTER_NAME=gvisor-bot
37+
export GIT_COMMITTER_EMAIL=gvisor-bot@google.com
38+
git commit -m "Update runsc profiles for PGO (profile-guided optimizations), $today."
39+
git push --set-upstream git@github.com:google/gvisor.git "$pgo_branch_name"
40+
gh pr create \
41+
--title="Update runsc profiles for PGO (profile-guided optimizations), $today." \
42+
--body='This PR updates the runsc profiles for PGO (profile-guided optimizations).' \
43+
--label=pgo-update --base=master
44+
echo 'PGO profile update PR created.' >&2

0 commit comments

Comments
 (0)