From 3f99b483cb65fd0d01a6591da7d626ccf6c77bcf Mon Sep 17 00:00:00 2001 From: Sanket Sudake Date: Sun, 20 Jun 2021 21:38:48 +0530 Subject: [PATCH] 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 * Increase test timeout to 20 minutes Signed-off-by: Sanket Sudake * Enable codeql for master only Signed-off-by: Sanket Sudake --- .github/workflows/codeql.yaml | 5 ++ CHANGELOG.md | 13 +++-- hack/release.sh | 99 ++++++++++++++++++----------------- test/kind_CI.sh | 2 +- 4 files changed, 64 insertions(+), 55 deletions(-) diff --git a/.github/workflows/codeql.yaml b/.github/workflows/codeql.yaml index adf29001..03a3b45f 100644 --- a/.github/workflows/codeql.yaml +++ b/.github/workflows/codeql.yaml @@ -2,9 +2,14 @@ name: Code Scanning on: push: + branches: + - master pull_request: + branches: + - master schedule: - cron: "0 0 * * 0" + workflow_dispatch: jobs: CodeQL-Build: diff --git a/CHANGELOG.md b/CHANGELOG.md index 0fb8a34c..e67eac99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,6 @@ [Documentation](https://docs.fission.io/) ## Downloads for 1.13.0 - filename | sha256 hash -------- | ----------- [fission-1.13.0-darwin-amd64](https://github.com/fission/fission/releases/download/1.13.0/fission-1.13.0-darwin-amd64) | `47d47196e15455a60ec15b80141f3de7435bb524e4a9b373f059cb89e63e68ff` @@ -12,12 +11,12 @@ filename | sha256 hash [fission-1.13.0-linux-arm64](https://github.com/fission/fission/releases/download/1.13.0/fission-1.13.0-linux-arm64) | `faa8a3b23e88bc6867051ada7c1f272270f2a231e1f1b2d2d97c57ebd47b632a` [fission-all-1.13.0.tgz](https://github.com/fission/fission/releases/download/1.13.0/fission-all-1.13.0.tgz) | `b1faaa96e4d71cff5bce960c185f7dc423b3251430734d1d65034991bb0b736d` [fission-core-1.13.0.tgz](https://github.com/fission/fission/releases/download/1.13.0/fission-core-1.13.0.tgz) | `191ef5d320e3bd8a5c0877b187ebb0189c91c4dfd15f2131de2319bd61c51d8c` -[fission-all-1.13.0-minikube.yaml](https://github.com/fission/fission/releases/download/1.13.0/fission-all-1.13.0-minikube.yaml) | `6032092352ac323b2b87d3a9c4c22ebb24584a3058a312ee84f3915f71ee6930` -[fission-all-1.13.0.yaml](https://github.com/fission/fission/releases/download/1.13.0/fission-all-1.13.0.yaml) | `23c8d6ef9ae41184b46a65dde993375795cfed103d97bfdd535cb6dfd2057377` -[fission-all-1.13.0-openshift.yaml](https://github.com/fission/fission/releases/download/1.13.0/fission-all-1.13.0-openshift.yaml) | `0d84aaa170cb6e01453bb6d4aeb31435dbd6e8706747013b38b5de19b56d5df4` -[fission-core-1.13.0-minikube.yaml](https://github.com/fission/fission/releases/download/1.13.0/fission-core-1.13.0-minikube.yaml) | `c471bff6244641e57eea64051d9d2b16ef21c1fbb9c6c3ab8e7536992fdd1602` -[fission-core-1.13.0.yaml](https://github.com/fission/fission/releases/download/1.13.0/fission-core-1.13.0.yaml) | `19d66b709a96ad6cc4a413ac7f0a7bb45fab4ff02de35276e9abd25eaacba1d5` -[fission-core-1.13.0-openshift.yaml](https://github.com/fission/fission/releases/download/1.13.0/fission-core-1.13.0-openshift.yaml) | `acb232f347751d1f87b9f7a2ed1ce546e1def31ed0ff05ed19f8a08cad724336` +[fission-all-1.13.0-minikube.yaml](https://github.com/fission/fission/releases/download/1.13.0/fission-all-1.13.0-minikube.yaml) | `7019cd21d8994ef659c03c2167412a7063c897c7d7acbdabcb9ba4d8ddd20bcd` +[fission-all-1.13.0.yaml](https://github.com/fission/fission/releases/download/1.13.0/fission-all-1.13.0.yaml) | `d21686dbbf7540876dcbc19e6f0bf3b6948f6e0169350d5ee9d4a25f75bfc00b` +[fission-all-1.13.0-openshift.yaml](https://github.com/fission/fission/releases/download/1.13.0/fission-all-1.13.0-openshift.yaml) | `8f53c7e1c8c582bc1d7c1ba548ba38d386b4b1c71c6d28fd79e6fada7cbcc72e` +[fission-core-1.13.0-minikube.yaml](https://github.com/fission/fission/releases/download/1.13.0/fission-core-1.13.0-minikube.yaml) | `3191e7ee5de1b7eaef647a4ff6b4a94035ab7759e4fe3f19411f42683695e97f` +[fission-core-1.13.0.yaml](https://github.com/fission/fission/releases/download/1.13.0/fission-core-1.13.0.yaml) | `075ebe033fa3d9c4519f1d650153e3a5346892a12e03fdf6594e66cf2cf80a40` +[fission-core-1.13.0-openshift.yaml](https://github.com/fission/fission/releases/download/1.13.0/fission-core-1.13.0-openshift.yaml) | `c42add1ec77444f31e7d0e30fd086f10dd00c345c6340c5748767668effecfe6` # Changelog diff --git a/hack/release.sh b/hack/release.sh index 2a141dfe..ea479452 100755 --- a/hack/release.sh +++ b/hack/release.sh @@ -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 !!" diff --git a/test/kind_CI.sh b/test/kind_CI.sh index dbd82583..a7237931 100755 --- a/test/kind_CI.sh +++ b/test/kind_CI.sh @@ -53,7 +53,7 @@ echo "Successfully pull env and builder images" export FAILURES=0 main() { set +e - export TIMEOUT=1000 # 15 minutes per test + export TIMEOUT=1200 # 20 minutes per test # run tests without newdeploy in parallel. export JOBS=6 source $ROOT/test/run_test.sh \