Skip to content

Commit

Permalink
ci: make-release.sh (#1854)
Browse files Browse the repository at this point in the history
Signed-off-by: Anatolii Bazko <[email protected]>
  • Loading branch information
tolusha authored Jun 7, 2024
1 parent 9849290 commit 814999a
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 22 deletions.
13 changes: 10 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ update-dev-resources: validate-requirements ## Update development resources
$(MAKE) fmt

gen-deployment: SHELL := /bin/bash
gen-deployment: manifests download-kustomize kustomize-operator-image ## Generate Eclipse Che k8s deployment resources
gen-deployment: manifests download-kustomize kustomize-operator-image download-addlicense ## Generate Eclipse Che k8s deployment resources
rm -rf $(DEPLOYMENT_DIR)
for TARGET_PLATFORM in kubernetes openshift; do
PLATFORM_DIR=$(DEPLOYMENT_DIR)/$${TARGET_PLATFORM}
Expand All @@ -189,6 +189,8 @@ gen-deployment: manifests download-kustomize kustomize-operator-image ## Generat
echo "[INFO] Deployments resources generated into $${PLATFORM_DIR}"
done

$(MAKE) license deploy

update-helmcharts: SHELL := /bin/bash
update-helmcharts: ## Update Helm Charts based on deployment resources
[[ -z "$(CHANNEL)" ]] && { echo [ERROR] CHANNEL not defined; exit 1; }
Expand Down Expand Up @@ -323,7 +325,7 @@ update-go-dependencies: ## Update golang dependencies
go mod tidy
go mod vendor

license: ## Add license to the files
license: download-addlicense ## Add license to the files
FILES=$$(echo $(filter-out $@,$(MAKECMDGOALS)))
$(ADD_LICENSE) -f hack/license-header.txt $${FILES}

Expand Down Expand Up @@ -471,7 +473,12 @@ bundle: generate manifests download-kustomize download-operator-sdk ## Generate
# Format file
yq -riY "." "$${BUNDLE_PATH}/manifests/org.eclipse.che_checlusters.yaml"

$(MAKE) license $$(find $${BUNDLE_PATH} -name "*.yaml")
$(MAKE) license $${BUNDLE_PATH}
$(MAKE) license config/manifests/bases

# Fix formating
goimports -w ./api
go fmt -x ./api

$(OPERATOR_SDK) bundle validate $${BUNDLE_PATH} --select-optional name=operatorhub --optional-values=k8s-version=1.19

Expand Down
44 changes: 25 additions & 19 deletions build/scripts/release/make-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ init() {
command -v skopeo >/dev/null 2>&1 || { echo "[ERROR] skopeo is not installed. Abort."; exit 1; }
REQUIRED_OPERATOR_SDK=$(yq -r ".\"operator-sdk\"" "${OPERATOR_REPO}/REQUIREMENTS")
[[ $(operator-sdk version) =~ .*${REQUIRED_OPERATOR_SDK}.* ]] || { echo "[ERROR] operator-sdk ${REQUIRED_OPERATOR_SDK} is required. Abort."; exit 1; }
make download-addlicense
}

usage () {
Expand Down Expand Up @@ -114,8 +113,8 @@ releaseManagerYaml() {

echo "[INFO] releaseManagerYaml :: Commit changes"
if git status --porcelain; then
git add "${MANAGER_YAML}"
git commit -m "ci: Update manager.yaml" --signoff
git add -A || true
git commit -am "ci: Update manager.yaml to $RELEASE" --signoff
fi
}

Expand All @@ -131,24 +130,30 @@ updateVersionFile() {
echo "[INFO] updating version.go file"
# change version/version.go file
sed -i version/version.go -r -e 's#(Version = ")([0-9.]+)(")#\1'"${RELEASE}"'\3#g'
git add version/version.go
git commit -m "ci: Update VERSION to $RELEASE" --signoff
if git status --porcelain; then
git add -A || true
git commit -am "ci: Update version.go to $RELEASE" --signoff
fi
}

releaseHelmPackage() {
echo "[INFO] releaseHelmPackage :: release Helm package"
yq -rYi ".version=\"${RELEASE}\"" "${OPERATOR_REPO}/helmcharts/stable/Chart.yaml"
make update-helmcharts CHANNEL=stable
git add -A helmcharts/stable
git commit -m "ci: Update Helm Charts to $RELEASE" --signoff
if git status --porcelain; then
git add -A || true
git commit -am "ci: Update Helm Charts to $RELEASE" --signoff
fi
}

releaseDeploymentFiles() {
echo "[INFO] releaseDeploymentFiles :: release deployment files"
echo "[INFO] releaseDeploymentFiles :: Release Kubernetes resources"
make gen-deployment
make fmt
git add -A deploy
git commit -m "ci: Update Deployment Files" --signoff

if git status --porcelain; then
git add -A || true
git commit -am "ci: Update Kubernetes resources to $RELEASE" --signoff
fi
}

releaseEditorsDefinitions() {
Expand All @@ -159,8 +164,10 @@ releaseEditorsDefinitions() {
make license editors-definitions

echo "[INFO] releaseEditorsDefinitions :: Commit changes"
git add editors-definitions
git commit -m "ci: Release editors definitions to $RELEASE" --signoff
if git status --porcelain; then
git add -A || true
git commit -am "ci: Release editors definitions to $RELEASE" --signoff
fi
}

releaseOlmFiles() {
Expand All @@ -174,9 +181,6 @@ releaseOlmFiles() {
yq -riY '(.spec.version) = "'${RELEASE}'"' "${CSV_STABLE_PATH}"
yq -riY '(.metadata.name) = "eclipse-che.v'${RELEASE}'"' "${CSV_STABLE_PATH}"

echo "[INFO] releaseOlmFiles :: Ensure license header"
make fmt

echo "[INFO] releaseOlmFiles :: Commit changes"
if git status --porcelain; then
git add -A || true
Expand All @@ -198,12 +202,14 @@ addDigests() {
pushOlmBundlesToQuayIo() {
echo "[INFO] releaseOperatorCode :: Login to quay.io..."
docker login quay.io -u "${QUAY_ECLIPSE_CHE_USERNAME}" -p "${QUAY_ECLIPSE_CHE_PASSWORD}"
echo "[INFO] Push OLM bundles to quay.io"

echo "[INFO] Push OLM bundles to quay.io"
. "${OPERATOR_REPO}/build/scripts/olm/release-catalog.sh" -c stable -i quay.io/eclipse/eclipse-che-olm-catalog:stable

git add -A olm-catalog/stable
git commit -m "ci: Add new bundle to a catalog" --signoff
if git status --porcelain; then
git add -A || true
git commit -am "ci: Add new $RELEASE bundle to a catalog" --signoff
fi
}

pushGitChanges() {
Expand Down

0 comments on commit 814999a

Please sign in to comment.