forked from bf2fc6cc711aee1a0c2a/kas-fleet-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_release.sh
executable file
·24 lines (23 loc) · 1.48 KB
/
create_release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash -ex
git clone -c http.sslVerify=false "https://gitlab-ci-token:[email protected]/mk-ci-cd/managed-kafka-versions.git" managed-kafka-versions
cd managed-kafka-versions
BRANCH_NAME="kas-fleet-manager-${VERSION}"
# only update the config, if different
CURRENT_COMMIT_SHA=$(yq '.service.scm.commitSha' services/kas-fleet-manager.yaml)
echo "Checking if the latest commit sha: $LATEST_COMMIT is different than current config commit sha: $CURRENT_COMMIT_SHA"
if [[ "${CURRENT_COMMIT_SHA}" != "${LATEST_COMMIT}" ]]; then
git checkout -b "$BRANCH_NAME"
echo "Updating commit sha and image tag for kas-fleet-manager configuration"
# update commitSha
yq -i ".service.scm.commitSha = \"$LATEST_COMMIT\"" services/kas-fleet-manager.yaml
# update image tag
yq -i ".service.image.tag = \"$VERSION\"" services/kas-fleet-manager.yaml
git config user.name "${AUTHOR_NAME}"
git config user.email "${AUTHOR_EMAIL}"
git commit -a -m "kas-fleet-manager stage release $VERSION"
# create an MR in managed-kafka-versions repo
echo "Creating MR with new config in managed-kafka-versions repository"
git push --force -o merge_request.create="true" -o merge_request.title="kas-fleet-manager stage release $VERSION" -o merge_request.description="https://gitlab.cee.redhat.com/service/kas-fleet-manager/-/compare/$CURRENT_COMMIT_SHA...$LATEST_COMMIT" -o merge_request.merge_when_pipeline_succeeds="true" -u origin "$BRANCH_NAME"
else
echo "No new version detected for kas-fleet-manager"
fi