THIS IS ONLY A TEST INSTANCE. DON'T DO IMPORTANT WORK HERE!

Commit ebd4d4c5 authored by David Festal's avatar David Festal Committed by Nick Boldt
Browse files

Fix release scripts after first use (#60)



* Remove a weird copy-paste

that produces syntax errors
Signed-off-by: default avatarDavid Festal <dfestal@redhat.com>

* typo in `nightly` version replacement
Signed-off-by: default avatarDavid Festal <dfestal@redhat.com>

* Complete PR-preparing script ...

... in order to :
- name the branch with the release number instead of a timestamp
- clone from the `che-incubator` fork
- fetch from the upstream (`operator-framework`) repo
- create the branch starting from the upstream master
- commit the changes
- push the branch to the fork if user creds are provided.
Signed-off-by: default avatarDavid Festal <dfestal@redhat.com>

* Check that `yq` is available
Signed-off-by: default avatarDavid Festal <dfestal@redhat.com>

* Provide, in the warning, the command to push again

 as soon as the env variables have ben set.
Signed-off-by: default avatarDavid Festal <dfestal@redhat.com>

* fix copyrights
Signed-off-by: default avatarDavid Festal <dfestal@redhat.com>
parent d16dd077
#!/bin/bash
#
# Copyright (c) 2019 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
if ! which yq &> /dev/null
then
echo
echo "#### ERROR ####"
echo "####"
echo "#### Please install the 'yq' tool before being able to use this script"
echo "#### see https://github.com/kislyuk/yq"
echo "#### and https://stedolan.github.io/jq/download"
echo "####"
echo "###############"
exit 1
fi
#!/bin/bash
#
# Copyright (c) 2012-2018 Red Hat, Inc.
# Copyright (c) 2019 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
......@@ -14,6 +14,7 @@ set -e
CURRENT_DIR=$(pwd)
BASE_DIR=$(cd "$(dirname "$0")"; pwd)
source ${BASE_DIR}/check-yq.sh
for platform in 'kubernetes' 'openshift'
do
......@@ -25,23 +26,28 @@ do
cd "${packageBaseFolderPath}"
packageFolderPath="${packageBaseFolderPath}/deploy/olm-catalog/${packageName}"
sourcePackageFilePath="${packageFolderPath}/${packageName}.package.yaml"
communityOperatorsLocalGitFolder="${packageBaseFolderPath}/generated/community-operators"
lastPackagePreReleaseVersion=$(yq -r '.channels[] | select(.name == "stable") | .currentCSV' "${sourcePackageFilePath}" | sed -e "s/${packageName}.v//")
echo " - Cloning the 'community-operators' GitHub repository to temporary folder: ${communityOperatorsLocalGitFolder}"
rm -Rf "${communityOperatorsLocalGitFolder}"
mkdir -p "${communityOperatorsLocalGitFolder}"
git clone https://github.com/operator-framework/community-operators.git "${communityOperatorsLocalGitFolder}" 2>&1 | sed -e 's/^/ /'
git clone https://github.com/che-incubator/community-operators.git "${communityOperatorsLocalGitFolder}" 2>&1 | sed -e 's/^/ /'
cd "${communityOperatorsLocalGitFolder}"
git remote add upstream https://github.com/operator-framework/community-operators.git
git fetch upstream master:upstream/master
branch="update-eclipse-che"
if [ "${platform}" == "kubernetes" ]
then
branch="${branch}-upstream"
fi
branch="${branch}-operator-$(date +%s)"
branch="${branch}-operator-${lastPackagePreReleaseVersion}"
echo
echo " - Creating branch '${branch}' in the local 'community-operators' repository: ${communityOperatorsLocalGitFolder}"
cd "${communityOperatorsLocalGitFolder}"
git checkout -b "${branch}" 2>&1 | sed -e 's/^/ /'
git checkout -b "${branch}" upstream/master 2>&1 | sed -e 's/^/ /'
cd "${packageBaseFolderPath}"
platformSubFolder="community-operators"
......@@ -51,14 +57,12 @@ do
fi
folderToUpdate="${communityOperatorsLocalGitFolder}/${platformSubFolder}/eclipse-che"
sourcePackageFilePath="${packageFolderPath}/${packageName}.package.yaml"
destinationPackageFilePath="${folderToUpdate}/eclipse-che.package.yaml"
lastPackagePreReleaseVersion=$(yq -r '.channels[] | select(.name == "stable") | .currentCSV' "${sourcePackageFilePath}" | sed -e "s/${packageName}.v//")
lastPublishedPackageVersion=$(yq -r '.channels[] | select(.name == "final") | .currentCSV' "${destinationPackageFilePath}" | sed -e "s/eclipse-che.v//")
echo
echo " - Last package pre-release version of local package: ${lastPackagePreReleaseVersion}"
echo " - Last package release version of cloned 'community-operators' repository: ${lastPackagePreReleaseVersion}"
echo " - Last package release version of cloned 'community-operators' repository: ${lastPublishedPackageVersion}"
if [ "${lastPackagePreReleaseVersion}" == "${lastPublishedPackageVersion}" ]
then
echo "#### ERROR ####"
......@@ -75,11 +79,35 @@ do
"${packageFolderPath}/${lastPackagePreReleaseVersion}/${packageName}.v${lastPackagePreReleaseVersion}.clusterserviceversion.yaml" \
> "${folderToUpdate}/eclipse-che.v${lastPackagePreReleaseVersion}.clusterserviceversion.yaml"
echo
echo " - Copying the CRD file"
cp "${packageFolderPath}/${lastPackagePreReleaseVersion}/${packageName}.crd.yaml" \
"${folderToUpdate}/eclipse-che.crd.yaml"
echo
echo " - Updating the 'final' channel with new release in the package descriptor: ${destinationPackageFilePath}"
sed -e "s/${lastPublishedPackageVersion}/${lastPackagePreReleaseVersion}/" "${destinationPackageFilePath}" > "${destinationPackageFilePath}.new"
mv "${destinationPackageFilePath}.new" "${destinationPackageFilePath}"
echo
echo " - Committing changes"
cd "${communityOperatorsLocalGitFolder}"
git add --all
git commit -m "Update eclipse-che operator for ${platform} to release ${lastPackagePreReleaseVersion}"
echo
echo " - Pushing branch ${branch} to the 'che-incubator/community-operators' GitHub repository"
if [ -z "${GIT_USER}" ] || [ -z "${GIT_PASSWORD}" ]
then
echo
echo "#### WARNING ####"
echo "####"
echo "#### You shoud define GIT_USER and GIT_PASSWORD environment variable"
echo "#### to be able to push release branches to the 'che-incubator/community-operators' repository"
echo "####"
echo "#### As soon as you have set them, you can push by running the following command:"
echo "#### cd \"${communityOperatorsLocalGitFolder}\" && git push \"https://\${GIT_USER}:\${GIT_PASSWORD}@github.com/che-incubator/community-operators.git\" \"${branch}\""
echo "####"
echo "#################"
else
git push "https://${GIT_USER}:${GIT_PASSWORD}@github.com/che-incubator/community-operators.git" "${branch}"
fi
done
cd "${CURRENT_DIR}"
#!/bin/bash
#
# Copyright (c) 2012-2018 Red Hat, Inc.
# Copyright (c) 2019 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
......
#!/bin/bash
#
# Copyright (c) 2012-2018 Red Hat, Inc.
# Copyright (c) 2019 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
......@@ -16,6 +16,8 @@ REGEX="^([0-9]+)\\.([0-9]+)\\.([0-9]+)(\\-[0-9a-z-]+(\\.[0-9a-z-]+)*)?(\\+[0-9A-
CURRENT_DIR=$(pwd)
BASE_DIR=$(cd "$(dirname "$0")"; pwd)
source ${BASE_DIR}/check-yq.sh
if [[ "$1" =~ $REGEX ]]
then
RELEASE="$1"
......@@ -55,7 +57,7 @@ do
-e 's/"cheImageTag": *"nightly"/"cheImageTag": ""/' \
-e 's|"identityProviderImage": *"eclipse/che-keycloak:nightly"|"identityProviderImage": ""|' \
-e 's|"devfileRegistryImage": *"quay.io/eclipse/che-devfile-registry:nightly"|"devfileRegistryImage": ""|' \
-e 's|"pluginRegistryImage": *"quay.io/eclipse/che-plugin-registry:nighlty"|"pluginRegistryImage": ""|' \
-e 's|"pluginRegistryImage": *"quay.io/eclipse/che-plugin-registry:nightly"|"pluginRegistryImage": ""|' \
-e "/^ replaces: ${packageName}.v.*/d" \
-e "s/^ version: ${lastPackageNightlyVersion}/ version: ${RELEASE}/" \
-e "/^ version: ${RELEASE}/i\ \ replaces: ${packageName}.v${lastPackagePreReleaseVersion}" \
......
#!/bin/bash
#
# Copyright (c) 2012-2018 Red Hat, Inc.
# Copyright (c) 2019 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
......@@ -14,6 +14,8 @@ set -e
CURRENT_DIR=$(pwd)
BASE_DIR=$(cd "$(dirname "$0")"; pwd)
source ${BASE_DIR}/check-yq.sh
for platform in 'kubernetes' 'openshift'
do
packageName=eclipse-che-preview-${platform}
......
#!/bin/bash
#
# Copyright (c) 2012-2018 Red Hat, Inc.
# Copyright (c) 2019 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
......@@ -30,8 +30,6 @@ cd "${BASE_DIR}"
echo
echo "## Creating release '${RELEASE}' of the Che operator docker image"
DefaultPluginRegistryImage
lastDefaultCheVersion=$(grep 'DefaultCheServerImageTag' "pkg/deploy/defaults.go" | sed -e 's/.*DefaultCheServerImageTag *= *"\([^"]*\)"/\1/')
lastDefaultKeycloakVersion=$(grep 'DefaultKeycloakUpstreamImage' "pkg/deploy/defaults.go" | sed -e 's/.*DefaultKeycloakUpstreamImage *= *"[^":]*:\([^"]*\)"/\1/')
lastDefaultPluginRegistryVersion=$(grep 'DefaultPluginRegistryImage' "pkg/deploy/defaults.go" | sed -e 's/.*DefaultPluginRegistryImage *= *"[^":]*:\([^"]*\)"/\1/')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment