Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

makefile improvement #241

Merged
merged 1 commit into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,7 @@ release-images.txt:
done;

tag-release:
(cd k8s/base && kustomize edit set image signadot/hotrod:$(RELEASE_TAG))
git diff-index --quiet HEAD || git commit -m tag-release-$(RELEASE_TAG) k8s/base
git tag -a -f -m release-$(RELEASE_TAG) $(RELEASE_TAG)
git push origin -f $(RELEASE_TAG)
./tag-release.sh $(RELEASE_TAG)

release: build-release release-images.txt tag-release
for os in $(RELEASE_OSES); do \
Expand All @@ -69,3 +66,4 @@ generate-proto:
protoc --go_out=. --go_opt=paths=source_relative \
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
services/route/route.proto

52 changes: 52 additions & 0 deletions tag-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/sh
#

set -ex


RELEASE_TAG=$1

if [ -z ${RELEASE_TAG} ] ; then
echo "usage $0 <release-tag>"
exit 1
fi

if [ ! -d k8s/base ]; then
echo wrong dir
exit 1
fi

#
# check for changes before editing images
#
set +e
git diff --exit-code
if [ ! $? -eq 0 ]; then
echo "repository is dirty"
exit 1
fi
set -e

(cd k8s/base && kustomize edit set image signadot/hotrod:${RELEASE_TAG})

# do we need to commit the kustomize changes from above?
set +e
git diff --exit-code
diffCode=$?;

set -e
if [ ${diffCode} -eq 1 ] ; then
git commit -m tag-release-${RELEASE_TAG} k8s/base
echo commited tag-release-${RELEASE_TAG}
elif [ ${diffCode} -eq 0 ] ; then
echo image tag ${RELEASE_TAG} already committed
else
echo "git diff-index failed"
exit 1
fi


# in any event, make sure we've tagged it locally and in-repo
git tag -a -f -m release-${RELEASE_TAG} ${RELEASE_TAG}
git push origin -f ${RELEASE_TAG}

Loading