Skip to content

Commit 7d8d974

Browse files
authored
fix dirty commit version (#21062)
* fix release script detecting dirty commit * add go-licenses to gitignore * add more help text
1 parent 0988cc3 commit 7d8d974

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,4 @@ test/integration/testdata/minikube-linux-amd64-latest-stable
6464
hack/legacy_fill_db/gopogh_filldb_log.txt
6565
hack/legacy_fill_db/out/output_summary.json
6666
hack/legacy_fill_db/out/output.html
67+
hack/go-licenses

hack/jenkins/release_build_and_upload.sh

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,20 @@ env BUILD_IN_DOCKER=y \
7777
"out/docker-machine-driver-kvm2-${RPM_VERSION}-${RPM_REVISION}.x86_64.rpm"
7878

7979
# check if 'commit: <commit-id>' line contains '-dirty' commit suffix
80-
BUILT_VERSION=$("out/minikube-$(go env GOOS)-$(go env GOARCH)" version)
81-
echo ${BUILT_VERSION}
82-
83-
COMMIT=$(echo ${BUILT_VERSION} | grep 'commit:' | awk '{print $2}')
84-
if (echo ${COMMIT} | grep -q dirty); then
85-
echo "'minikube version' reports dirty commit: ${COMMIT}"
80+
BUILT_VERSION="$(out/minikube-$(go env GOOS)-$(go env GOARCH) version)"
81+
echo "$BUILT_VERSION"
82+
# Extract commit hash from the correct line
83+
COMMIT=$(echo "$BUILT_VERSION" | grep '^commit:' | awk '{print $2}')
84+
85+
if echo "$COMMIT" | grep -q dirty; then
86+
echo "'minikube version' reports dirty commit: $COMMIT"
87+
echo "------------------------------------------------------------------------"
88+
echo "The following uncommitted changes are causing the build to be dirty:"
89+
git status --porcelain
90+
echo "------------------------------------------------------------------------"
91+
echo "To fix this, commit or stash the above changes."
8692
exit 1
8793
fi
88-
8994
# Don't upload temporary copies, avoid unused duplicate files in the release storage
9095
rm -f out/minikube-linux-x86_64
9196
rm -f out/minikube-linux-i686

0 commit comments

Comments
 (0)