Update release files

Signed-off-by: Anatoliy Bazko <abazko@redhat.com>
pull/261/head
Anatoliy Bazko 2020-05-15 17:37:14 +03:00
parent 03978b3724
commit 6133dfd64b
4 changed files with 57 additions and 50 deletions

View File

@ -7,15 +7,17 @@ Export environment variables:
2. `GIT_USER` and `GIT_PASSWORD` to create PR into https://github.com/operator-framework/community-operators
```bash
./make-release.sh <RELEASE_VERSION> --push-olm-files --push-git-changes
./make-release.sh <RELEASE_VERSION> --release --push-olm-files --push-git-changes --pull-requests
```
```
Usage: ./make-release.sh [RELEASE_VERSION] --push-olm-files --push-git-changes
Usage: ./make-release.sh [RELEASE_VERSION] --release --push-olm-files --push-git-changes --pull-requests
--release: to release
--push-olm-files: to push OLM files to quay.io. This flag should be omitted
if already a greater version released. For instance, we are releasing 7.9.3 version but
7.10.0 already exists. Otherwise it breaks the linear update path of the stable channel.
--push-git-changes: to create release branch and push changes into.
--pull-requests: to create pull requests.
```
## 2. Testing release on openshift

View File

@ -17,18 +17,20 @@ init() {
RELEASE="$1"
BRANCH=$(echo $RELEASE | sed 's/.$/x/')
GIT_REMOTE_UPSTREAM="git@github.com:eclipse/che-operator.git"
PULL_REQUEST_TO_X_BRANCH=false
PULL_REQUEST_TO_X_MASTER=false
RUN_RELEASE=false
PUSH_OLM_FILES=false
PUSH_GIT_CHANGES=false
CREATE_PULL_REQUESTS=false
RELEASE_DIR=$(cd "$(dirname "$0")"; pwd)
if [[ $# -lt 1 ]]; then usage; exit; fi
while [[ "$#" -gt 0 ]]; do
case $1 in
'--release') RUN_RELEASE=true; shift 0;;
'--push-olm-files') PUSH_OLM_FILES=true; shift 0;;
'--push-git-changes') PUSH_GIT_CHANGES=true; shift 0;;
'--pull-requests') CREATE_PULL_REQUESTS=true; shift 0;;
'--help'|'-h') usage; exit;;
esac
shift 1
@ -165,21 +167,12 @@ releaseOperatorCode() {
}
updateNightlyOlmFiles() {
echo "[INFO] Updateing nighlty OLM files"
echo "[INFO] Updating nighlty OLM files"
echo "[INFO] Launching 'olm/update-nightly-olm-files.sh' script"
cd $RELEASE_DIR/olm
. update-nightly-olm-files.sh
. update-nightly-olm-files.sh nightly
cd $RELEASE_DIR
echo "[INFO] Validating changes"
lastKubernetesNightlyDir=$(ls -dt $RELEASE_DIR/olm/eclipse-che-preview-kubernetes/deploy/olm-catalog/eclipse-che-preview-kubernetes/* | head -1)
csvFile=$(ls ${lastKubernetesNightlyDir}/*.clusterserviceversion.yaml)
checkImageReferences $csvFile
lastNightlyOpenshiftDir=$(ls -dt $RELEASE_DIR/olm/eclipse-che-preview-openshift/deploy/olm-catalog/eclipse-che-preview-openshift/* | head -1)
csvFile=$(ls ${lastNightlyOpenshiftDir}/*.clusterserviceversion.yaml)
checkImageReferences $csvFile
echo "[INFO] List of changed files:"
git status -s
@ -237,23 +230,14 @@ createPRToXBranch() {
createPRToMasterBranch() {
echo "[INFO] Creating pull request into master branch to copy csv"
resetChanges master
local tmpBranch=${RELEASE}-to-master
local tmpBranch="update-images-to-master"
git checkout -B $tmpBranch
git diff refs/heads/${BRANCH}...refs/heads/${RELEASE} ':(exclude)deploy/operator-local.yaml' ':(exclude)deploy/operator.yaml'
git diff refs/heads/${BRANCH}...refs/heads/${RELEASE} ':(exclude)deploy/operator-local.yaml' ':(exclude)deploy/operator.yaml' | git apply
. ${RELEASE_DIR}/replace-images-tags.sh nightly master
git add -A
git commit -m "Copy "$RELEASE" csv to master" --signoff
git push origin $tmpBranch
git push origin $tmpBranch -f
hub pull-request --base master --head ${tmpBranch} --browse -m "Copy "$RELEASE" csv to master"
echo "[INFO] Creating pull request into master branch to update images"
resetChanges master
local tmpBranch="update-images-to-master"
. ${RELEASE_DIR}/replace-images-tags.sh nightly master
git add deploy/operator.yaml
git add deploy/operator-local.yaml
git commit -m "Update images tags" --signoff
git push origin $tmpBranch
hub pull-request --base master --head ${tmpBranch} --browse -m "Update images tags in master branch"
}
run() {
@ -261,18 +245,24 @@ run() {
releaseOperatorCode
updateNightlyOlmFiles
releaseOlmFiles
if [[ $PUSH_OLM_FILES == "true" ]]; then
pushOlmFilesToQuayIo
fi
if [[ $PUSH_GIT_CHANGES == "true" ]]; then
pushGitChanges
createPRToXBranch
createPRToMasterBranch
fi
}
init "$@"
echo "[INFO] Release '$RELEASE' from branch '$BRANCH'"
run "$@"
if [[ $RUN_RELEASE == "true" ]]; then
run "$@"
fi
if [[ $PUSH_OLM_FILES == "true" ]]; then
pushOlmFilesToQuayIo
fi
if [[ $PUSH_GIT_CHANGES == "true" ]]; then
pushGitChanges
fi
if [[ $CREATE_PULL_REQUESTS == "true" ]]; then
createPRToXBranch
createPRToMasterBranch
fi

View File

@ -61,6 +61,7 @@ do
-e "/^ replaces: ${packageName}.v.*/d" \
-e "s/^ version: ${lastPackageNightlyVersion}/ version: ${RELEASE}/" \
-e "/^ version: ${RELEASE}/i\ \ replaces: ${packageName}.v${lastPackagePreReleaseVersion}" \
-e "s/: nightly/: ${RELEASE}/" \
-e "s/:nightly/:${RELEASE}/" \
-e "s/${lastPackageNightlyVersion}/${RELEASE}/" \
-e "s/createdAt:.*$/createdAt: \"$(date -u +%FT%TZ)\"/" \

View File

@ -14,29 +14,34 @@ set -e
CURRENT_DIR=$(pwd)
BASE_DIR=$(cd "$(dirname "$0")"; pwd)
TAG=$1
source ${BASE_DIR}/check-yq.sh
for platform in 'kubernetes' 'openshift'
do
packageName=eclipse-che-preview-${platform}
echo
echo "## Updating OperatorHub package '${packageName}' for platform '${platform}'"
echo "[INFO] Updating OperatorHub package '${packageName}' for platform '${platform}'"
packageBaseFolderPath=${BASE_DIR}/${packageName}
cd "${packageBaseFolderPath}"
packageFolderPath="${packageBaseFolderPath}/deploy/olm-catalog/${packageName}"
packageFilePath="${packageFolderPath}/${packageName}.package.yaml"
lastPackageVersion=$(yq -r '.channels[] | select(.name == "nightly") | .currentCSV' "${packageFilePath}" | sed -e "s/${packageName}.v//")
echo " - Last package version: ${lastPackageVersion}"
echo "[INFO] Last package version: ${lastPackageVersion}"
newNightlyPackageVersion="9.9.9-nightly.$(date +%s)"
echo " => will create a new version: ${newNightlyPackageVersion}"
echo "[INFO] will create a new version: ${newNightlyPackageVersion}"
./build-roles.sh
echo " - Updating new package version with roles defined in: ${role}"
echo "[INFO] Updating new package version with roles defined in: ${role}"
operator-sdk olm-catalog gen-csv --csv-version "${newNightlyPackageVersion}" --from-version="${lastPackageVersion}" 2>&1 | sed -e 's/^/ /'
containerImage=$(sed -n 's|^ *image: *\([^ ]*/che-operator:[^ ]*\) *|\1|p' "${packageFolderPath}/${newNightlyPackageVersion}/${packageName}.v${newNightlyPackageVersion}.clusterserviceversion.yaml")
createdAt=$(date -u +%FT%TZ)
echo " - Updating new package version fields:"
echo " - containerImage => ${containerImage}"
echo " - createdAt => ${createdAt}"
echo "[INFO] Updating new package version fields:"
echo "[INFO] - containerImage => ${containerImage}"
echo "[INFO] - createdAt => ${createdAt}"
sed \
-e "s|containerImage:.*$|containerImage: ${containerImage}|" \
-e "s/createdAt:.*$/createdAt: \"${createdAt}\"/" \
@ -44,17 +49,26 @@ do
> "${packageFolderPath}/${newNightlyPackageVersion}/${packageName}.v${newNightlyPackageVersion}.clusterserviceversion.yaml.new"
mv "${packageFolderPath}/${newNightlyPackageVersion}/${packageName}.v${newNightlyPackageVersion}.clusterserviceversion.yaml.new" \
"${packageFolderPath}/${newNightlyPackageVersion}/${packageName}.v${newNightlyPackageVersion}.clusterserviceversion.yaml"
echo " - Copying the CRD file"
echo "[INFO] - Copying the CRD file"
cp "${BASE_DIR}/../deploy/crds/org_v1_che_crd.yaml" "${packageFolderPath}/${newNightlyPackageVersion}/eclipse-che-preview-${platform}.crd.yaml"
diff -u "${packageFolderPath}/${lastPackageVersion}/eclipse-che-preview-${platform}.crd.yaml" \
"${packageFolderPath}/${newNightlyPackageVersion}/eclipse-che-preview-${platform}.crd.yaml" \
> "${packageFolderPath}/${newNightlyPackageVersion}/eclipse-che-preview-${platform}.crd.yaml.diff" || true
echo " - Updating the 'nightly' channel with new version in the package descriptor: ${packageFilePath}"
echo "[INFO] - Updating the 'nightly' channel with new version in the package descriptor: ${packageFilePath}"
sed -e "s/${lastPackageVersion}/${newNightlyPackageVersion}/" "${packageFilePath}" > "${packageFilePath}.new"
mv "${packageFilePath}.new" "${packageFilePath}"
if [[ ! -z "$TAG" ]]; then
echo "[INFO] Set tags in nighlty OLM files"
csvFile="${packageFolderPath}/${newNightlyPackageVersion}/${packageName}.v${newNightlyPackageVersion}.clusterserviceversion.yaml"
sed -i 's/'$RELEASE'/'$TAG'/g' $csvFile
fi
diff -u "${packageFolderPath}/${lastPackageVersion}/${packageName}.v${lastPackageVersion}.clusterserviceversion.yaml" \
"${packageFolderPath}/${newNightlyPackageVersion}/${packageName}.v${newNightlyPackageVersion}.clusterserviceversion.yaml" \
> "${packageFolderPath}/${newNightlyPackageVersion}/${packageName}.v${newNightlyPackageVersion}.clusterserviceversion.yaml.diff" || true
done
cd "${CURRENT_DIR}"
cd "${CURRENT_DIR}"