Correct release name in release script for non helm install (#2084)

* Correct release name in release script for non helm install

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

* Increase test timeout to 20 minutes

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

* Enable codeql for master only

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
Sanket Sudake
2021-06-20 21:38:48 +05:30
committed by GitHub
parent 9bef235252
commit 3f99b483cb
4 changed files with 64 additions and 55 deletions
+52 -47
View File
@@ -3,11 +3,11 @@
set -e
#set -x
DIR=$(realpath $(dirname $0))/../
BUILDDIR=$(realpath $DIR)/build
DIR=$(realpath $(dirname "$0"))/../
BUILDDIR=$(realpath "$DIR")/build
artifacts=()
source $(realpath ${DIR}/test/init_tools.sh)
source $(realpath "${DIR}"/test/init_tools.sh)
doit() {
echo "! $*"
@@ -18,7 +18,7 @@ doit() {
check_branch() {
local version=$1
curr_branch=$(git rev-parse --abbrev-ref HEAD)
if [ $curr_branch != "release-${version}" ]; then
if [ "$curr_branch" != "release-${version}" ]; then
echo "Not on release-${version} branch."
exit 1
fi
@@ -69,22 +69,16 @@ update_github_charts_repo() {
local version=$1
local chartsrepo=$2
pushd $chartsrepo
cp $BUILDDIR/charts/fission-all-${version}.tgz .
cp $BUILDDIR/charts/fission-core-${version}.tgz .
pushd "$chartsrepo"
cp "$BUILDDIR"/charts/fission-all-"${version}".tgz .
cp "$BUILDDIR"/charts/fission-core-"${version}".tgz .
./index.sh
popd
}
gh_release() {
local version=$1
RELFILES=""
for relfile in ${artifacts[@]}; do
RELFILES+="\"${relfile}\" "
done
doit gh release create $version --draft --prerelease --title $version --notes-file $(realpath ${DIR}/hack/notes.md) --target $gitcommit ${RELFILES}
doit gh release create "$version" --draft --prerelease --title "$version" --notes-file $(realpath "${DIR}"/hack/notes.md) --target "$gitcommit" "${artifacts[@]}"
}
generate_changelog() {
@@ -98,12 +92,12 @@ generate_changelog() {
create_downloads_table ${version} >>new_CHANGELOG.md
# generate changelog from github
github_changelog_generator -u fission -p fission -t ${GITHUB_TOKEN} --future-release ${version} --no-issues -o tmp_CHANGELOG.md
github_changelog_generator -u fission -p fission -t "${GITHUB_TOKEN}" --future-release "${version}" --no-issues -o tmp_CHANGELOG.md
sed -i '$ d' tmp_CHANGELOG.md
# concatenate two files
cat tmp_CHANGELOG.md >>new_CHANGELOG.md
mv new_CHANGELOG.md ${DIR}/CHANGELOG.md
mv new_CHANGELOG.md "${DIR}"/CHANGELOG.md
rm tmp_CHANGELOG.md
}
@@ -130,20 +124,20 @@ release_environment_check() {
local version=$1
local chartsrepo=$2
check_branch $version
check_branch "$version"
check_clean
if [ ! -f $HOME/.github-token ]; then
if [ ! -f "$HOME"/.github-token ]; then
echo "Error finding github access token at ${HOME}/.github-token"
exit 1
fi
if [ ! -d $chartsrepo ]; then
if [ ! -d "$chartsrepo" ]; then
echo "Error finding chart repo at $chartsrepo"
exit 1
fi
if [ ! -d $FISSION_HOME ]; then
if [ ! -d "$FISSION_HOME" ]; then
echo "The FISSION_HOME variable should be set to directory where Fission and fission-charts are checked out"
exit 1
fi
@@ -151,12 +145,12 @@ release_environment_check() {
build_charts() {
local version=$1
mkdir -p $BUILDDIR/charts
pushd $DIR/charts
mkdir -p "$BUILDDIR"/charts
pushd "$DIR"/charts
find . -iname *.~?~ | xargs -r rm
for c in fission-all fission-core; do
doit helm package -u $c/
mv *.tgz $BUILDDIR/charts/
mv ./*.tgz "$BUILDDIR"/charts/
done
popd
}
@@ -164,11 +158,11 @@ build_charts() {
build_yamls() {
local version=$1
mkdir -p ${BUILDDIR}/yamls
pushd ${DIR}/charts
mkdir -p "${BUILDDIR}"/yamls
pushd "${DIR}"/charts
find . -iname *.~?~ | xargs -r rm
releaseName=fission-$(echo ${version} | sed 's/\./-/g')
releaseName=fission-$(echo "${version}" | sed 's/\./-/g')
for c in fission-all fission-core; do
# fetch dependencies
@@ -176,15 +170,26 @@ build_yamls() {
doit helm dependency update
popd
echo "Release name", "$releaseName"
cmdprefix="helm template ${releaseName} ${c} --namespace fission --validate"
# for minikube and other environments that don't support LoadBalancer
doit helm template ${c} -n ${releaseName} --namespace fission --set analytics=false,analyticsNonHelmInstall=true,serviceType=NodePort,routerServiceType=NodePort >${c}-${version}-minikube.yaml
command="$cmdprefix --set analytics=false,analyticsNonHelmInstall=true,serviceType=NodePort,routerServiceType=NodePort"
echo "$command"
$command >${c}-"${version}"-minikube.yaml
# for environments that support LoadBalancer
doit helm template ${c} -n ${releaseName} --namespace fission --set analytics=false,analyticsNonHelmInstall=true >${c}-${version}.yaml
command="$cmdprefix --set analytics=false,analyticsNonHelmInstall=true"
echo "$command"
$command >${c}-"${version}".yaml
# for OpenShift
doit helm template ${c} -n ${releaseName} --namespace fission --set analytics=false,analyticsNonHelmInstall=true,logger.enableSecurityContext=true,prometheus.enabled=false >${c}-${version}-openshift.yaml
command="$cmdprefix --set analytics=false,analyticsNonHelmInstall=true,logger.enableSecurityContext=true,prometheus.enabled=false"
echo "$command"
$command >${c}-"${version}"-openshift.yaml
# copy yaml files to build directory
mv *.yaml ${BUILDDIR}/yamls/
mv ./*.yaml "${BUILDDIR}"/yamls/
done
popd
@@ -212,12 +217,12 @@ build_all() {
exit 1
fi
if [ -e $BUILDDIR ]; then
if [ -e "$BUILDDIR" ]; then
echo "Removing existing build dir ($BUILDDIR)."
rm -rf $BUILDDIR
rm -rf "$BUILDDIR"
fi
mkdir -p $BUILDDIR
mkdir -p "$BUILDDIR"
# generate swagger (OpenApi 2.0) doc before building bundle image
VERSION=$version TIMESTAMP=$date COMMITSHA=$gitcommit make generate-swagger-doc
@@ -240,7 +245,7 @@ build_images() {
fi
local gitcommit=$3
if [ -z "gitcommit" ]; then
if [ -z "$gitcommit" ]; then
echo "Git commit unspecified"
exit 1
fi
@@ -259,7 +264,7 @@ check_commands() {
export GITHUB_TOKEN=$(cat ~/.github-token)
version=$1
if [ -z $version ]; then
if [ -z "$version" ]; then
echo "Release version not mentioned"
exit 1
fi
@@ -268,23 +273,23 @@ date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
gitcommit=$(git rev-parse HEAD)
chartsrepo=$2
if [ -z $chartsrepo ]; then
if [ -z "$chartsrepo" ]; then
chartsrepo="$DIR../fission-charts"
fi
check_commands
release_environment_check $version $chartsrepo
build_all $version $date $gitcommit
build_images $version $date $gitcommit
build_charts $version
build_yamls $version
release_environment_check "$version" "$chartsrepo"
build_all "$version" "$date" "$gitcommit"
build_images "$version" "$date" "$gitcommit"
build_charts "$version"
build_yamls "$version"
attach_github_release_cli $version
attach_github_release_charts $version
attach_github_release_yamls $version
update_github_charts_repo $version $chartsrepo
generate_changelog $version
gh_release $version
attach_github_release_cli "$version"
attach_github_release_charts "$version"
attach_github_release_yamls "$version"
update_github_charts_repo "$version" "$chartsrepo"
generate_changelog "$version"
gh_release "$version"
echo "############ DONE #############"
echo "Congratulation, ${version} is ready to ship !!"