Skip to content

Commit 32f1cf3

Browse files
Merge pull request #537 from tmshort/verify
OPRUN-3022: Add support for make verify to sync script
2 parents 3d61138 + 4a496b2 commit 32f1cf3

File tree

2 files changed

+42
-21
lines changed

2 files changed

+42
-21
lines changed

Makefile

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ bin/cpb: FORCE
105105
CGO_ENABLED=0 go build $(GO_BUILD_OPTS) -ldflags '-extldflags "-static"' -o $@ github.com/operator-framework/operator-lifecycle-manager/util/cpb
106106

107107
unit/olm: bin/kubebuilder
108-
echo "Running the OLM unit tests"
108+
@echo "Running the OLM unit tests"
109109
$(MAKE) unit WHAT=operator-lifecycle-manager
110110

111111
unit/registry:
@@ -157,32 +157,33 @@ verify-nested-vendor:
157157
verify-commits:
158158
./scripts/verify_commits.sh $(PULL_BASE_SHA) # see https://github.com/kubernetes/test-infra/blob/master/prow/jobs.md#job-environment-variables
159159

160+
# Update scripts/sync_pop_candidate.sh if anything is changed in this recipe
160161
.PHONY: verify
161162
verify:
162-
echo "Checking for unstaged root vendor changes"
163+
@echo "Checking for unstaged root vendor changes"
163164
$(MAKE) verify-vendor
164-
echo "Checking whether the CVO manifests need to be generated"
165+
@echo "Checking whether the CVO manifests need to be generated"
165166
$(MAKE) verify-manifests
166-
echo "Checking for unsynced nested [go.mod,go.sum] files"
167+
@echo "Checking for unsynced nested [go.mod,go.sum] files"
167168
$(MAKE) verify-nested-vendor
168-
echo "Checking commit integrity"
169+
@echo "Checking commit integrity"
169170
$(MAKE) verify-commits
170171

171172
.PHONY: crc-start
172173
crc-start:
173-
echo "Starting CRC"
174+
@echo "Starting CRC"
174175
./scripts/crc-start.sh
175176

176177
.PHONY: crc-build
177178
crc-build:
178-
echo "Building olm image"
179+
@echo "Building olm image"
179180
IMG="olm:test" $(MAKE) build/olm-container
180-
echo "Building opm image"
181+
@echo "Building opm image"
181182
IMG="opm:test" $(MAKE) build/registry-container
182183

183184
.PHONY: crc-deploy
184185
crc-deploy:
185-
echo "Deploying OLM"
186+
@echo "Deploying OLM"
186187
./scripts/crc-deploy.sh
187188

188189
.PHONY: crc

scripts/sync_pop_candidate.sh

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ fi
2626

2727
set -o errexit
2828
set -o pipefail
29-
#set -x
3029

3130
ROOT_DIR=$(dirname "${BASH_SOURCE[@]}")/..
3231
# shellcheck disable=SC1091
@@ -63,6 +62,7 @@ function pop() {
6362
rc="${rcs[2]}"
6463
printf 'popping: %s\n' "${rc}"
6564

65+
# Cherrypick the commit
6666
if ! git cherry-pick --allow-empty --keep-redundant-commits -Xsubtree="${subtree_dir}" "${rc}"; then
6767
# Always blast away the vendor directory given OLM/registry still commit it into source control.
6868
git rm -rf "${subtree_dir}"/vendor 2>/dev/null || true
@@ -122,34 +122,54 @@ function pop() {
122122
popd
123123
fi
124124

125-
# 1. Pop next commit off cherrypick set
126-
# 2. Cherry-pick
127-
# 3. Ammend commit
128-
# 4. Remove from cherrypick set
125+
# Update commit with make vendor
129126
if ! make vendor; then
130127
echo ""
131-
echo -e "Pausing script: ${RED}fix make vendor{$RESET}"
128+
echo -e "Pausing script: ${RED}fix (or ignore) make vendor{$RESET}"
132129
echo "Use another terminal window"
133-
echo -n '<ENTER> to continue, ^C to quit: '
130+
echo -n '<ENTER> to update commit and continue, ^C to quit: '
134131
read
135132
fi
136133
git add "${subtree_dir}" "${ROOT_GENERATED_PATHS[@]}"
137-
git status
138-
git commit --amend --allow-empty --no-edit --trailer "Upstream-repository: ${remote}" --trailer "Upstream-commit: ${rc}"
139-
if ! make manifests; then
134+
git commit --amend --allow-empty --no-edit
135+
136+
# Update commit with make verify-manifests, this uses the proper OLM_VERSION
137+
if ! make verify-manifests; then
140138
echo ""
141139
echo -e "Pausing script: ${RED}fix (or ignore) make manifests${RESET}"
142140
echo "Use another terminal window"
143-
echo -n '<ENTER> to continue, ^C to quit: '
141+
echo -n '<ENTER> to update commit and continue, ^C to quit: '
144142
read
145143
fi
146144
git add "${subtree_dir}" "${ROOT_GENERATED_PATHS[@]}"
147-
git status
148145
git commit --amend --allow-empty --no-edit
149146

147+
# Update commit with make verify-nested-vendor
148+
if ! make verify-nested-vendor; then
149+
echo ""
150+
echo -e "Pausing script: ${RED}fix make (or ignore) verify-nested-vendors${RESET}"
151+
echo "Use another terminal window"
152+
echo -n '<ENTER> to update commit and continue, ^C to quit: '
153+
read
154+
fi
155+
git add "${subtree_dir}" "${ROOT_GENERATED_PATHS[@]}"
156+
git commit --amend --allow-empty --no-edit --trailer "Upstream-repository: ${remote}" --trailer "Upstream-commit: ${rc}"
157+
# need to add these trailers for make verify-commits
158+
159+
# Remove from cherrypick set, now that the trailers are added, it's effectively complete
150160
tmp_set=$(mktemp)
151161
tail -n +2 "${cherrypick_set}" > "${tmp_set}"; cat "${tmp_set}" > "${cherrypick_set}"
152162

163+
# Verify commit with make verify-commits - this should not error out
164+
if ! make verify-commits; then
165+
echo ""
166+
echo -e "Pausing script: ${RED}fix make verify-commits${RESET}"
167+
echo "Use another terminal window"
168+
echo -n '<ENTER> to continue, ^C to quit: '
169+
read
170+
fi
171+
# At this point "make verify" would pass
172+
153173
# Note: handle edge case where there's zero remaining to avoid
154174
# returning a non-zero exit code.
155175
(( --remaining )) || true

0 commit comments

Comments
 (0)