|
| 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