Skip to content

Commit 32007c4

Browse files
authored
chore: allow commit SHA override in renovate.sh (#14682)
1 parent 4b3c86e commit 32007c4

3 files changed

Lines changed: 16 additions & 5 deletions

File tree

doc/contributor/howto-guide-update-googleapis-sha.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ git checkout -b chore-update-googleapis-sha-circa-$(date +%Y-%m-%d)
2929

3030
## Run the "renovate.sh" script
3131

32+
By default `renovate.sh` uses the most recent commit SHA and the current date.
33+
To override these values use environment variables `COMMIT` and `COMMIT_DATE`.
34+
3235
```shell
3336
external/googleapis/renovate.sh
3437
```

external/googleapis/renovate.sh

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
set -euo pipefail
16+
set -eo pipefail
1717
BOLD_ON_GREY=$(tput bold && tput setab 252)
1818
TURN_OFF_ATTR=$(tput sgr0)
1919
SEPARATOR=
@@ -27,8 +27,15 @@ function banner() {
2727
banner "Determining googleapis HEAD commit and tarball checksum"
2828
REPO="googleapis/googleapis"
2929
BRANCH="master"
30-
COMMIT=$(curl -fsSL -H "Accept: application/vnd.github.VERSION.sha" \
31-
"https://api.github.com/repos/${REPO}/commits/${BRANCH}")
30+
if [[ -z "${COMMIT}" ]]; then
31+
COMMIT=$(curl -fsSL -H "Accept: application/vnd.github.VERSION.sha" \
32+
"https://api.github.com/repos/${REPO}/commits/${BRANCH}")
33+
fi
34+
35+
if [[ -z "$COMMIT_DATE" ]]; then
36+
COMMIT_DATE=$(date +%Y-%m-%d)
37+
fi
38+
3239
DOWNLOAD="$(mktemp)"
3340
curl -fsSL "https://github.com/${REPO}/archive/${COMMIT}.tar.gz" -o "${DOWNLOAD}"
3441
gsutil -q cp "${DOWNLOAD}" "gs://cloud-cpp-community-archive/com_google_googleapis/${COMMIT}.tar.gz"
@@ -86,7 +93,7 @@ TRIGGER_TYPE='pr' ci/cloudbuild/build.sh \
8693
--docker --trigger=generate-libraries-pr || true
8794

8895
banner "Creating commits"
89-
git commit -m"chore: update googleapis SHA circa $(date +%Y-%m-%d)" \
96+
git commit -m"chore: update googleapis SHA circa ${COMMIT_DATE}" \
9097
${PIPERORIGIN_REVID:+-m "${PIPERORIGIN_REVID}"} \
9198
bazel/workspace0.bzl cmake/GoogleapisConfig.cmake MODULE.bazel
9299
if ! git diff --quiet external/googleapis/protodeps \

release/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ the project itself, [git][git-docs], [GitHub][github-guides], and
1515
In order to ensure that our released version includes a SHA of the service proto
1616
definitions that is both current and stable ([googleapis-sha-update-policy]),
1717
aim for a commit SHA from 5-7 days ago (TODO(#13062): automate this update
18-
process).
18+
process). Specifying `COMMIT` and `COMMIT_DATE` when running `renovate.sh` can
19+
be used to achieve this.
1920

2021
## 1. Preparing for a release
2122

0 commit comments

Comments
 (0)