Skip to content
This repository has been archived by the owner on Jun 28, 2023. It is now read-only.

Enable the ability to create a release from a release branch #829

Merged
merged 1 commit into from
Jun 23, 2021
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
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ _test
_output
/addons/repos/generated/
/build
/offline
hack/NEW_BUILD_VERSION
cayman_trigger.txt
artifacts
Expand Down
22 changes: 3 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,6 @@ build-plugin: version clean-plugin install-cli-plugins ## build only CLI plugins
@printf "\n[COMPLETE] installed TCE-specific plugins at $${XDG_DATA_HOME}/tanzu-cli/. "
@printf "These plugins will be automatically detected by your tanzu CLI.\n"

rebuild-all: version install-cli install-cli-plugins
rebuild-plugin: version install-cli-plugins

release: build-all package-release ### builds and produces the release packaging/tarball for TCE in your local Go environment

release-docker: release-env-check ### builds and produces the release packaging/tarball for TCE in a containerized environment
Expand Down Expand Up @@ -183,10 +180,6 @@ package-release:
# IMPORTANT: This should only ever be called CI/github-action
.PHONY: tag-release
tag-release: version
# reset here to avoid conflicts, checkout main, and then make sure it's pristine
git reset --hard
git checkout main
git reset --hard
ifeq ($(shell expr $(BUILD_VERSION)), $(shell expr $(CONFIG_VERSION)))
go run ./hack/tags/tags.go -tag $(BUILD_VERSION) -release
BUILD_VERSION=${NEW_BUILD_VERSION} hack/update-tag.sh
Expand All @@ -203,8 +196,6 @@ upload-signed-assets: release-env-check

clean-release:
rm -rf ./build
rm -rf ./metadata
rm -rf ./offline
# RELEASE MANAGEMENT

# TANZU CLI
Expand All @@ -216,12 +207,9 @@ install-cli:
TANZU_CORE_REPO_BRANCH="tce-v1.3.0" TKG_CLI_REPO_BRANCH="tce-v1.3.0-saui" CLUSTER_API_REPO_BRANCH="tce-v0.3.14" TKG_PROVIDERS_REPO_BRANCH="tce-v1.3.0" TANZU_TKG_CLI_PLUGINS_REPO_BRANCH="tce-v1.3.0" BUILD_VERSION=${CORE_BUILD_VERSION} hack/build-tanzu.sh

.PHONY: clean-core
clean-core: clean-cli-metadata
clean-core:
rm -rf /tmp/tce-release

.PHONY: clean-cli-metadata
clean-cli-metadata:
- rm -rf ${XDG_DATA_HOME}/tanzu-cli/*
rm -rf ${XDG_DATA_HOME}/tanzu-cli/*
# TANZU CLI

# PLUGINS
Expand All @@ -244,12 +232,8 @@ test-plugins: ## run tests on TCE plugins
@echo "No tests to run."

.PHONY: clean-plugin
clean-plugin: clean-plugin-metadata
clean-plugin:
rm -rf ${ARTIFACTS_DIR}

.PHONY: clean-plugin-metadata
clean-plugin-metadata:
- rm -rf ${XDG_DATA_HOME}/tanzu-repository/*
# PLUGINS

# MISC
Expand Down
22 changes: 19 additions & 3 deletions hack/update-tag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,26 @@ fi
git config user.name github-actions
git config user.email github-actions@github.com

# which branch did this tag come from
# get commit hash for this tag, then find which branch the hash is on
WHICH_HASH=$(git rev-parse "tags/${BUILD_VERSION}")
echo "hash: ${WHICH_HASH}"
if [[ "${WHICH_HASH}" == "" ]]; then
echo "Unable to find the hash associated with this tag."
exit 1
fi

WHICH_BRANCH=$(git branch --contains "${WHICH_HASH}" | grep -v detached | awk '{print $1}')
echo "branch: ${WHICH_BRANCH}"
if [[ "${WHICH_HASH}" == "" ]]; then
echo "Unable to find the branch associated with this hash."
exit 1
fi

# handle the case when a PR is merged before the commit/tag can complete
git stash
git fetch
git pull origin main
git pull origin "${WHICH_BRANCH}"
git stash pop

if [[ "${FAKE_RELEASE}" != "" ]]; then
Expand All @@ -38,7 +54,7 @@ echo "NEW_BUILD_VERSION: ${NEW_BUILD_VERSION}"

git add hack/FAKE_BUILD_VERSION.yaml
git commit -m "auto-generated - update fake version"
git push origin main
git push origin "${WHICH_BRANCH}"
# skip the tagging... commit the file is a good enough simulation

else
Expand All @@ -49,7 +65,7 @@ echo "NEW_BUILD_VERSION: ${NEW_BUILD_VERSION}"

git add hack/DEV_BUILD_VERSION.yaml
git commit -m "auto-generated - update dev version"
git push origin main
git push origin "${WHICH_BRANCH}"
git tag -m "${NEW_BUILD_VERSION}" "${NEW_BUILD_VERSION}"
git push origin "${NEW_BUILD_VERSION}"

Expand Down