Skip to content

Commit 126267e

Browse files
EtiennePerotgvisor-bot
authored andcommitted
Attempt to automate PR creation for PGO profile data updates.
This will probably not work, but not much of a better way than to just try. PiperOrigin-RevId: 761299081
1 parent b77441b commit 126267e

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

.buildkite/hooks/environment

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
set -euo pipefail
2+
3+
# Do not echo!
4+
set +x
5+
6+
export GH_TOKEN="${GITHUB_AGENT_TOKEN:-TOKEN_IS_NOT_SET}"
7+
if [[ "${GH_TOKEN}" == 'TOKEN_IS_NOT_SET' ]]; then
8+
echo "[debug] GH_TOKEN is unset ('TOKEN_IS_NOT_SET')." >&2
9+
elif [[ -z "${GH_TOKEN}" ]]; then
10+
echo "[debug] GH_TOKEN is set but empty." >&2
11+
else
12+
echo "[debug] GH_TOKEN is not empty." >&2
13+
fi

.buildkite/pgo.yaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,22 @@ steps:
2626
- make ARCH=x86_64 benchmark-refresh-pgo BENCHMARKS_PLATFORMS=systrap
2727
- '
2828
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 &&
2932
git pull --rebase=true https://github.com/google/gvisor master &&
33+
git checkout -b "$pgo_branch_name" &&
3034
git add runsc/profiles &&
31-
git commit -m "Update runsc profiles for PGO (profile-guided optimizations)." &&
32-
git push [email protected]:google/gvisor.git "pgo-update-$(date +"%Y%m%d-%H:%M:%S")";
35+
git status &&
36+
gh auth login &&
37+
gh auth setup-git &&
38+
export GIT_AUTHOR_NAME=gvisor-bot &&
39+
40+
export GIT_COMMITTER_NAME=gvisor-bot &&
41+
42+
git commit -m "Update runsc profiles for PGO (profile-guided optimizations), $today." &&
43+
git push --set-upstream [email protected]: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;
3345
else
3446
echo "No changes to runsc profiles." >&2;
3547
fi

0 commit comments

Comments
 (0)