Skip to content

Commit 9d11ece

Browse files
authored
Update pre-submit to run against renamed "main" branch. (#1330)
1 parent 71c2a53 commit 9d11ece

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

cloudbuild/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Continuous Integration via Cloud Build
22

33
[Cloud Build](https://cloud.google.com/cloud-build/) is configured to trigger on
4-
`/gcbrun` comment from maintainer in PR to the `master` branch.
4+
`/gcbrun` comment from maintainer in PR to the `main` branch.
55

66
Cloud Build triggers a set of build steps, configured in a `cloudbuild.yaml`
77
config file. These steps are:

cloudbuild/presubmit.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ configure_gcloud_ssh_key() {
2424
chmod 600 "${HOME}/.ssh/google_compute_engine"
2525
}
2626

27-
# Fetches master branch from GitHub and "resets" local changes to be relative to it,
28-
# so we can diff what changed relatively to master branch.
27+
# Fetches main branch from GitHub and "resets" local changes to be relative to it,
28+
# so we can diff what changed relatively to main branch.
2929
initialize_git_repo() {
3030
rm -fr .git
3131
git config --global init.defaultBranch main
@@ -35,21 +35,21 @@ initialize_git_repo() {
3535
git config user.name "ia-tests"
3636

3737
git remote add origin "https://github.com/GoogleCloudDataproc/initialization-actions.git"
38-
git fetch origin master
38+
git fetch origin main
3939
# Fetch all PRs to get history for PRs created from forked repos
4040
git fetch origin +refs/pull/*/merge:refs/remotes/origin/pr/* > /dev/null 2>&1
4141

4242
git reset --hard "${COMMIT_SHA}"
4343

44-
git rebase origin/master
44+
git rebase origin/main
4545
}
4646

47-
# This function adds all changed files to git "index" and diffs them against master branch
47+
# This function adds all changed files to git "index" and diffs them against main branch
4848
# to determine all changed files and looks for tests in directories with changed files.
4949
determine_tests_to_run() {
5050
# Infer the files that changed
51-
mapfile -t DELETED_BUILD_FILES < <(git diff origin/master --name-only --diff-filter=D | grep BUILD)
52-
mapfile -t CHANGED_FILES < <(git diff origin/master --name-only)
51+
mapfile -t DELETED_BUILD_FILES < <(git diff origin/main --name-only --diff-filter=D | grep BUILD)
52+
mapfile -t CHANGED_FILES < <(git diff origin/main --name-only)
5353
echo "Deleted BUILD files: ${DELETED_BUILD_FILES[*]}"
5454
echo "Changed files: ${CHANGED_FILES[*]}"
5555

0 commit comments

Comments
 (0)