diff --git a/Makefile b/Makefile index 9dc143d408..0e9ad88a52 100644 --- a/Makefile +++ b/Makefile @@ -13,14 +13,10 @@ TARGET_ARCHS ?= amd64 arm64 s390x ppc64le VERSION ?= v1.34.0 COMMIT_HASH ?= $(shell git rev-parse HEAD) -# Indicates which version of the UI console is to be embedded -# in the container image. If "local" the CONSOLE_LOCAL_DIR is -# where the UI project has been git cloned and has its -# content built in its build/ subdirectory. -# WARNING: If you have previously build a container image but -# later want to change the CONSOLE_VERSION then you must run -# the 'clean' target first before re-building the container image. -CONSOLE_VERSION ?= 1.34.0 +# The path where the UI project has been git cloned. The UI should +# have been built before trying to create a kiali server container +# image. The UI project is configured to place its build +# output in the $UI_SRC_ROOT/build/ subdirectory. CONSOLE_LOCAL_DIR ?= ${ROOTDIR}/../../../../../kiali-ui # Version label is used in the OpenShift/K8S resources to identify @@ -156,6 +152,13 @@ endif # If you do not want this to happen (i.e. if you want to retain the local copies of your helm charts), set this to false. HELM_CHARTS_REPO_PULL ?= true +.PHONY: default_target +default_target: + @echo + @echo "Apparently, you didn't specify a target." + @echo "This Makefile requires you to explicitly call a target." + @echo "Run '$(MAKE) help' to learn about the available targets." + include make/Makefile.build.mk include make/Makefile.container.mk include make/Makefile.cluster.mk diff --git a/README.adoc b/README.adoc index 4416084976..c4e6a28d00 100644 --- a/README.adoc +++ b/README.adoc @@ -139,7 +139,7 @@ make container-build This will build the Kiali image. -Generated container image will be consistant with the host machine (either x86_64 or aarch64). +Generated container image will be consistent with the host machine (either x86_64 or aarch64). === Pushing Kiali operator and Kiali images to your cluster @@ -372,24 +372,6 @@ Otherwise the header will be WWW-Authenticate: Basic realm="Kiali" ---- -=== Running A Locally Built UI Inside the Core - -If you are developing the UI on your local machine but you want to see it deployed and running inside of the core server, you can do so by setting the environment variable CONSOLE_VERSION to the value "local" when building the container image via the `container-build` or `cluster-build` target. By default, your UI's build/ directory is assumed to be in a directory called `kiali-ui` that is a peer directory of the GOPATH root directory for the core server. If it is not, you can set the environment variable CONSOLE_LOCAL_DIR to the value of the path of the root directory for the UI such that `$CONSOLE_LOCAL_DIR/build` contains the generated build files for the UI. - -For example, if your GOPATH directory for the Kiali project is `/source/kiali/kiali` and you have git cloned the Kiali UI repository in `/source/kiali/kiali-ui` then you do not need to set CONSOLE_LOCAL_DIR. You can embed your locally built console into the core container image via: - -[source,shell] ----- -CONSOLE_VERSION=local make container-build ----- - -If you git cloned the Kiali UI repository in directory `/my/git/repo` and have built the UI there (such that the build files are located at `/my/git/repo/build`) then you can embed that locally built console into the core container image via: - -[source,shell] ----- -CONSOLE_VERSION=local CONSOLE_LOCAL_DIR=/my/git/repo make container-build ----- - === Disabling SSL In the provided OpenShift templates, SSL is turned on by default. If you want to turn it off, you should: diff --git a/RELEASING.adoc b/RELEASING.adoc index 586265a960..24c66fb0f5 100644 --- a/RELEASING.adoc +++ b/RELEASING.adoc @@ -107,10 +107,6 @@ https://github.com/kiali/kiali[kiali/kiali GitHub repository]. === Making the release -. Make a release of the front-end, if needed -** Please, follow the https://github.com/kiali/kiali-ui/blob/master/RELEASING.adoc[releasing guide for the front-end] -** You can omit this step if there is no need to release the front-end. Kiali - will be released using the specified version of the front-end. . Login to Quay.io ** `docker login quay.io` . Checkout the code that you want to release: @@ -123,17 +119,7 @@ https://github.com/kiali/kiali[kiali/kiali GitHub repository]. ** Optional: If a token is not provided, a branch is created in your fork of the code, if needed. Then, you can place the PR manually. . Run the release process: -** `CONSOLE_VERSION="{ui-version}" make -f deploy/jenkins-ci/Makefile release` - -In the last step, you can omit the CONSOLE_VERSION variable. However, it is -_**very** highly_ recommended that you specify the version of the UI to package. -If you released kiali-ui (step 1), you should specify the version you just released. -Else, you should specify whatever version you need packaged. If you don't specify -a kiali-ui version, the console version specified in the main `Makefile` -will be downloaded from NPM and packaged in the release. If the main `Makefile` -specifies `latest` as the console version, the latest version *published* in NPM -will be used, which is not necessarily the latest _released_ version -(most likely it will be a snapshot). +** `CONSOLE_LOCAL_DIR="path_to_ui_source_code" make -f deploy/jenkins-ci/Makefile release` By default, it's assumed that you are doing a _minor_ release. If want to do another type of release, you can run the release process specifying diff --git a/deploy/get-console.sh b/deploy/get-console.sh index c2c1775e63..c2013ede49 100755 --- a/deploy/get-console.sh +++ b/deploy/get-console.sh @@ -1,40 +1,40 @@ #!/bin/bash -# This is a helper script used when building the docker image of Kaili. +# This is a helper script used when building the container image of Kaili. # You should not run this file directly. It is invoked through the main # Makefile when doing: -# $ make docker-build +# $ make container-build-kiali # # See the main Makefile for more info. DIR=$(dirname $0)/.. -VERSION=${CONSOLE_VERSION:-latest} CONSOLE_DIR=${CONSOLE_LOCAL_DIR:-$DIR/../../../../../kiali-ui} mkdir -p $DIR/_output/docker -if [ "$VERSION" = "local" ]; then - echo "Copying local console files from $CONSOLE_DIR" - rm -rf $DIR/_output/docker/console && mkdir $DIR/_output/docker/console - cp -r $CONSOLE_DIR/build/* $DIR/_output/docker/console - # If there is a version.txt file, use it (required for continuous delivery) - if [ ! -f "$DIR/_output/docker/console/version.txt" ]; then - # If jq command is available, don't do a trip to the web - if ! type "jq" > /dev/null 2>&1 ; then - echo "$(npm -C $CONSOLE_DIR view $CONSOLE_DIR version)-local-$(cd $CONSOLE_DIR; git rev-parse HEAD)" > $DIR/_output/docker/console/version.txt - else - echo "$(jq -r '.version' $CONSOLE_DIR/package.json)-local-$(cd $CONSOLE_DIR; git rev-parse HEAD)" > $DIR/_output/docker/console/version.txt - fi - fi -else - if [ ! -d "$DIR/_output/docker/console" ]; then - echo "Downloading console ($VERSION)..." - mkdir $DIR/_output/docker/console || exit 1 - curl -s $(npm view @kiali/kiali-ui@$VERSION dist.tarball) \ - | tar zxf - --strip-components=2 --directory $DIR/_output/docker/console package/build || exit 1 - echo "$(npm view @kiali/kiali-ui@$VERSION version)" > \ - $DIR/_output/docker/console/version.txt || exit 1 - fi +# Some sanity checks of CONSOLE_DIR. Some checks are naive. +if [ -z "$CONSOLE_DIR" ]; then + echo "You must set the CONSOLE_LOCAL_DIR environment variable to the path where the kiali-ui source code is located." + echo "If you don't have the kiali-ui source code, download it from the kiali/kiali-ui GitHub repository." + exit 1 +elif [ ! -f "$CONSOLE_DIR/package.json" ]; then + echo "CONSOLE_DIR is $CONSOLE_DIR" + echo "Apparently, this CONSOLE_DIR does not contain the kiali-ui" + exit 1 +elif [ ! -d "$CONSOLE_DIR/build" ] || [ -z "$(ls -A $CONSOLE_DIR/build)" ]; then + echo "CONSOLE_DIR is $CONSOLE_DIR" + echo "Apparently, the kiali-ui is not built." + echo "Build the front-end by running 'yarn && yarn build' inside the kiali-ui directory" + exit 1 +fi + +echo "Copying local console files from $CONSOLE_DIR" +rm -rf $DIR/_output/docker/console && mkdir $DIR/_output/docker/console +cp -r $CONSOLE_DIR/build/* $DIR/_output/docker/console + +# If there is a version.txt file, use it (required for continuous delivery) +if [ ! -f "$DIR/_output/docker/console/version.txt" ]; then + echo "$(sed -n 's/.*"version":.*"\(.*\)".*/\1/p' $CONSOLE_DIR/package.json)-local-$(cd $CONSOLE_DIR; git rev-parse HEAD)" > $DIR/_output/docker/console/version.txt fi echo "Console version being packaged: $(cat $DIR/_output/docker/console/version.txt)" diff --git a/deploy/jenkins-ci/Jenkinsfile b/deploy/jenkins-ci/Jenkinsfile index ee821c6c6d..a907e1a0b2 100644 --- a/deploy/jenkins-ci/Jenkinsfile +++ b/deploy/jenkins-ci/Jenkinsfile @@ -32,15 +32,9 @@ * - QUAY_OPERATOR_NAME * defaultValue: quay.io/kiali/kiali-operator * description: The name of the Quay repository to push the operator release - * - NPM_DRY_RUN + * - SKIP_KIALI_SERVER_RELEASE * defaultValue: n - * description: Set to "y" if you want to make a "dry run" of the front-end release process - * - SKIP_BACKEND_RELEASE - * defaultValue: n - * description: Set to 'y' if you don't want to release the backend - * - SKIP_UI_RELEASE - * defaultValue: n - * description: Set to 'y' if you don't want to release the UI + * description: Set to 'y' if you don't want to release the server (back-end and front-end) * - SKIP_OPERATOR_RELEASE * defaultValue: n * description: Set to 'y' if you don't want to release the operator @@ -50,10 +44,6 @@ * - SKIP_SITE_RELEASE * defaultValue: n * description: Set to 'y' if you don't want to release the website - * - UI_VERSION - * defaultValue: '' - * description: If you are skipping UI release. Specify the UI version to package, or leave - * unset to use the version present in the main Makefile (e.g. leave unset for patch releases) * - NPM_CONFIG_REGISTRY * defaultValue: '' * description: NPM registry to use for fetching packages. This is not used for publishing releases. @@ -63,6 +53,72 @@ * description: E-mail for sending build failure notifications. */ +def determineReleaseType() { + // This script determines the type of release that + // should be done, given the current date. + // It is possible to specify a different date + // by setting the NOW_DATE environment variable. + // The script will print a text: + // - "minor": if it's determined that a minor release + // should be built. + // - "snapshot.0": if it's determined that a snapshot + // release should be built (specifically, the first + // snapshot of the sprint. + // - "snapshot.1": if it's determined that a snapshot + // release should be built (specifically, the second + // snapshot of the sprint. + // - "snapshot.2": for some sprints with longer duration. + // + // The reference date (base date) can be set in the + // environment variable BASE_DATE. By default, it is the + // last day of Kiali Sprint #14. Starting at end of Sprint #33, + // BASE_DATE is the last day of Sprint #33. + // + // Both NOW_DATE and BASE_DATE should be given in seconds + // since EPOCH. It is assumed that this script is run weekly + // starting in the base date. Running at different timespans + // won't guarantee a good result. + return sh (''' +BASE_DATE=${BASE_DATE:-$(date -d '2018-11-30' '+%s')} +NOW_DATE=${NOW_DATE:-$(date -d 'now' '+%s')} + +# At end of Sprint #33, we use it's last day as the base date +cond=$(date -d '2020-01-10' '+%s') +if [ $NOW_DATE -ge $cond ]; +then + BASE_DATE=$cond +fi + +# Transitional calculations +DATE_DIFF=$(( $NOW_DATE - $BASE_DATE )) +DAYS_ELAPSED=$(( $DATE_DIFF / (24*60*60) )) +WEEKS_ELAPSED=$(( $DAYS_ELAPSED / 7)) + +# This value will be used to determine the type of the release +WEEKS_MOD3=$(( $WEEKS_ELAPSED % 3 )) + +# Sprint #33 is 4 weeks long. Return 'snapshot.2' between Jan 3rd and Jan 9th +if [ $NOW_DATE -ge $(date -d '2020-01-03' '+%s') ] && [ $NOW_DATE -lt $(date -d '2020-01-10' '+%s') ]; +then + echo 'snapshot.2' + exit 0 +fi + +case $WEEKS_MOD3 in + 0) + RELEASE_TYPE='minor' ;; + 1) + RELEASE_TYPE='snapshot.0' ;; + 2) + RELEASE_TYPE='snapshot.1' ;; +esac + +# Print the determined type +echo $RELEASE_TYPE + ''', + returnStdout: true).trim() +} + node('kiali-build && fedora') { def backendDir = 'src/github.com/kiali/kiali' def backendMakefile = 'deploy/jenkins-ci/Makefile' @@ -70,14 +126,13 @@ node('kiali-build && fedora') { def uiDir = 'src/github.com/kiali/kiali-ui' def uiMakefile = 'Makefile.jenkins' - def buildUi = params.SKIP_UI_RELEASE != "y" - def buildBackend = params.SKIP_BACKEND_RELEASE != "y" + def buildServer = params.SKIP_KIALI_SERVER_RELEASE != "y" def buildOperator = params.SKIP_OPERATOR_RELEASE != "y" def buildHelm = params.SKIP_HELM_RELEASE != "y" // Temptative value. It's re-assigned later. def buildSite = params.SKIP_SITE_RELEASE != "y" // Temptative value. It's re-assigned later. def quayTag = "" - if ( !buildBackend && !buildUi && !buildOperator && !buildHelm && !buildSite ) { + if ( !buildServer && !buildOperator && !buildHelm && !buildSite ) { currentBuild.result = 'ABORTED' echo "Nothing to release. Stopping." return @@ -86,7 +141,7 @@ node('kiali-build && fedora') { try { cleanWs() stage('Checkout code') { - if ( buildBackend || buildOperator || buildHelm || buildSite ) { + if ( buildServer ) { checkout([ $class: 'GitSCM', branches: [[name: params.RELEASING_BRANCHES]], @@ -102,8 +157,7 @@ node('kiali-build && fedora') { sh "cd ${backendDir}; git config user.email 'kiali-dev@googlegroups.com'" sh "cd ${backendDir}; git config user.name 'kiali-bot'" - } - if ( buildUi ) { + checkout([ $class: 'GitSCM', branches: [[name: params.RELEASING_BRANCHES]], @@ -125,90 +179,68 @@ node('kiali-build && fedora') { // Determine release type if "auto" was specified def releaseType = "${params.RELEASE_TYPE}" if ( releaseType == "auto" ) { - releaseType = sh( - returnStdout: true, - script: "${backendDir}/deploy/jenkins-ci/bin/determine-release-type.sh").trim() + releaseType = determineReleaseType() } buildSite = params.SKIP_SITE_RELEASE != "y" && releaseType == "minor" buildHelm = params.SKIP_HELM_RELEASE != "y" && (releaseType == "minor" || releaseType == "patch") echo "Resolved release type: ${releaseType}" - echo "Will build back-end? ${buildBackend}" - echo "Will build front-end? ${buildUi}" + echo "Will build back-end? ${buildServer}" + echo "Will build front-end? ${buildServer}" echo "Will build operator? ${buildOperator}" echo "Will build Helm charts? ${buildHelm}" echo "Will build site? ${buildSite}" - withEnv(["PATH+TOOLS=${env.WORKSPACE}/${backendDir}/deploy/jenkins-ci/bin", - "GOPATH=${env.WORKSPACE}", - "BACKEND_GITHUB_URI=git@github.com:${params.BACKEND_REPO}.git", - "BACKEND_FORK_URI=git@github.com:kiali-bot/kiali.git", - "BACKEND_PULL_URI=https://api.github.com/repos/${params.BACKEND_REPO}/pulls", - "UI_GITHUB_URI=git@github.com:${params.UI_REPO}.git", - "UI_FORK_URI=git@github.com:kiali-bot/kiali-ui.git", - "UI_PULL_URI=https://api.github.com/repos/${params.UI_REPO}/pulls", - "RELEASE_TYPE=${releaseType}" - ]) { - parallel backend: { - withEnv(["GOPATH=${env.WORKSPACE}"]) { - stage('Build backend') { - if ( buildBackend ) { + if ( buildServer ) { + withEnv(["PATH+TOOLS=${env.WORKSPACE}/${backendDir}/deploy/jenkins-ci/bin", + "GOPATH=${env.WORKSPACE}", + "BACKEND_GITHUB_URI=git@github.com:${params.BACKEND_REPO}.git", + "BACKEND_FORK_URI=git@github.com:kiali-bot/kiali.git", + "BACKEND_PULL_URI=https://api.github.com/repos/${params.BACKEND_REPO}/pulls", + "NPM_DRY_RUN=y", // Just for safety, as we may be running Makefiles for pre-v1.35 + "UI_GITHUB_URI=git@github.com:${params.UI_REPO}.git", + "UI_FORK_URI=git@github.com:kiali-bot/kiali-ui.git", + "UI_PULL_URI=https://api.github.com/repos/${params.UI_REPO}/pulls", + "RELEASE_TYPE=${releaseType}" + ]) { + parallel backend: { + withEnv(["GOPATH=${env.WORKSPACE}"]) { + stage('Build backend') { sh "make -f ${backendMakefile} -C ${backendDir} backend-build-release" } - } - stage('Test backend') { - if ( buildBackend ) { + stage('Test backend') { sh "make -f ${backendMakefile} -C ${backendDir} backend-test" } } - } - }, ui: { - stage('Build UI') { - if ( buildUi ) { + }, ui: { + stage('Build UI') { sh "make -f ${uiMakefile} -C ${uiDir} ui-fix-version ui-build" } - } - stage('Test UI') { - if ( buildUi ) { + stage('Test UI') { sh "make -f ${uiMakefile} -C ${uiDir} ui-test" } - } - }, - - failFast: true + }, + failFast: true - stage('Release kiali-ui to NPM') { - if ( buildUi ) { - withCredentials([string(credentialsId: 'kiali-npm', variable: 'NPM_TOKEN')]) { - sh "make -f ${uiMakefile} -C ${uiDir} ui-npm-publish" + stage('Release Kiali to Container Repositories') { + withCredentials([usernamePassword(credentialsId: 'kiali-quay', passwordVariable: 'QUAY_PASSWORD', usernameVariable: 'QUAY_USER')]) { + sh "make -f ${backendMakefile} -C ${backendDir} backend-push-docker" + quayTag = sh(returnStdout: true, script: "sed -rn 's/^VERSION \\?= v(.*)/v\\1/p' ${backendDir}/Makefile").trim() } } - } - stage('Create release cut in front-end repo') { - if ( buildUi ) { + stage('Create release cut in back-end repo') { withCredentials([string(credentialsId: 'kiali-bot-gh-token', variable: 'GH_TOKEN')]) { sshagent(['kiali-bot-gh-ssh']) { - sh "make -f ${uiMakefile} -C ${uiDir} ui-push-version-tag ui-prepare-next-version" + sh "make -f ${backendMakefile} -C ${backendDir} backend-push-version-tag backend-prepare-next-version" } } } - } - - stage('Release Kiali to Container Repositories') { - if ( buildBackend ) { - withCredentials([usernamePassword(credentialsId: 'kiali-quay', passwordVariable: 'QUAY_PASSWORD', usernameVariable: 'QUAY_USER')]) { - sh "make -f ${backendMakefile} -C ${backendDir} backend-push-docker" - quayTag = sh(returnStdout: true, script: "sed -rn 's/^VERSION \\?= v(.*)/v\\1/p' ${backendDir}/Makefile").trim() - } - } - } - stage('Create release cut in back-end repo') { - if ( buildBackend ) { + stage('Create release cut in front-end repo') { withCredentials([string(credentialsId: 'kiali-bot-gh-token', variable: 'GH_TOKEN')]) { sshagent(['kiali-bot-gh-ssh']) { - sh "make -f ${backendMakefile} -C ${backendDir} backend-push-version-tag backend-prepare-next-version" + sh "make -f ${uiMakefile} -C ${uiDir} ui-push-version-tag ui-prepare-next-version" } } } diff --git a/deploy/jenkins-ci/README.md b/deploy/jenkins-ci/README.md index be67af222f..802624600d 100644 --- a/deploy/jenkins-ci/README.md +++ b/deploy/jenkins-ci/README.md @@ -36,10 +36,6 @@ more in _[The Pipelines](#the-pipelines)_ section The `kiali-release` pipeline uses some support files: -* The [bin/determine-release-type.sh](bin/determine-release-type.sh) - is used to automatically resolve what kind of release needs to be - build, assuming the Pipeline runs weekly. Read the script - to learn more about how it works. * The [bin/jq](https://stedolan.github.io/jq/) v1.6 and [bin/semver](https://github.com/fsaintjacques/semver-tool) v2.1.0 are tools used to properly set version strings when building releases. @@ -160,30 +156,6 @@ Note that the Helm release always builds and pushes to the "master" branch because that is the branch that GitHub Pages gets the content for the Helm Chart Repository HTTP server. -### Building a patch release omitting the front-end - -First, make sure that all fixes are properly committed to the -back-end repository (don't change version numbers). - -In the current Kiali project workflow, patch releases are built off -from a version branch rather than the `master` branch. - -Set the Pipeline parameters as follows: - -* RELEASE_TYPE: Use `patch`. -* RELEASING_BRANCHES: The branch name of the repositories to - generate the release from; e.g. `refs/heads/v0.20`. The build - assumes that all repositories have a branch with this name. -* SKIP_UI_RELEASE: Set to `y`. - -The front-end that will be bundled in the container image will be the version -specified in the main Makefile -(e.g: https://github.com/kiali/kiali/blob/v0.20.0/Makefile#L16). The front-end -will be downloaded from the NPM registry. If you want to bundle a different -front-end version, use the UI_VERSION parameter; for example. - -* UI_VERSION: `0.19.0` - ### Building a major release In the current Kiali project workflow, major releases are built off @@ -233,8 +205,7 @@ repositories. There is a set of _SKIP\_*\_RELEASE_ parameters that allow individual control about what should and should not be built: -* SKIP_BACKEND_RELEASE: Forces to omit the back-end build. -* SKIP_UI_RELEASE: Forces to omit the front-end build. +* SKIP_SERVER_RELEASE: Forces to omit the server build (front-end and back-end). * SKIP_OPERATOR_RELEASE: Forces to omit the operator build. * SKIP_HELM_RELEASE: Forces to omit the helm charts build. * SKIP_SITE_RELEASE: Forces to omit the website build. @@ -267,30 +238,22 @@ first check if the `kiali-release` pipeline finished successfully. If it didn't, pass through the following checks (in order) to know how to proceed to recover the build. Do the suggested action of the first check that is not OK: -1. Is the front-end release properly - [published in NPM](https://www.npmjs.com/package/@kiali/kiali-ui?activeTab=versions)? - If not: - * Retry the build. No special handling required. 1. Is the front-end version properly tagged in the repository? (see https://github.com/kiali/kiali-ui/tags). If not: * Manually create the tag setting the version in package.json to the published one. * For builds other than snapshots, manually update the package.json file of the master/version branch to prepare it for the next release. - * Retry the build but set parameters SKIP_UI_RELEASE to `y` and UI_VERSION - to the version of the front-end that got published in NPM. 1. In the front-end repository, is the package.json correctly updated and prepared for the next version? If not: * This check does not apply for snapshot builds. * Manually update the package.json file of the master/version branch to prepare it for the next release. - * Retry the build but set parameters SKIP_UI_RELEASE to `y` and UI_VERSION - to the version of the front-end that got published in NPM. + * Retry the build (TODO: how?). 1. Are the container images present in Quay.io? Is the back-end version properly tagged (see https://github.com/kiali/kiali/tags)? If not to any of these questions: - * Retry the build but set parameters SKIP_UI_RELEASE to `y` and UI_VERSION - to the version of the front-end that got published in NPM. + * Retry the build (TODO: how?). 1. Is the back-end release properly created in https://github.com/kiali/kiali/releases? * Don't retry the build. * Manually [create the version entry in GitHub](https://github.com/kiali/kiali/releases/new). @@ -337,7 +300,6 @@ When running the build, set the following parameters: e.g. `quay.io/edgarhz/kiali`. * QUAY_OPERATOR_NAME: Use your own Quay.io repository for the operator; e.g. `quay.io/edgarhz/kiali-operator`. -* NPM_DRY_RUN: Set to `y`. Once you run the first test build, if you need to run more test builds, you may want to use the _Rebuild_ option to avoid setting these diff --git a/deploy/jenkins-ci/bin/determine-release-type.sh b/deploy/jenkins-ci/bin/determine-release-type.sh deleted file mode 100755 index 2c3b8bf82b..0000000000 --- a/deploy/jenkins-ci/bin/determine-release-type.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash - -# This script determines the type of release that -# should be done, given the current date. -# It is possible to specify a different date -# by setting the NOW_DATE environment variable. -# The script will print a text: -# - "minor": if it's determined that a minor release -# should be built. -# - "snapshot.0": if it's determined that a snapshot -# release should be built (specifically, the first -# snapshot of the sprint. -# - "snapshot.1": if it's determined that a snapshot -# release should be built (specifically, the second -# snapshot of the sprint. -# - "snapshot.2": for some sprints with longer duration. -# -# The reference date (base date) can be set in the -# environment variable BASE_DATE. By default, it is the -# last day of Kiali Sprint #14. Starting at end of Sprint #33, -# BASE_DATE is the last day of Sprint #33. -# -# Both NOW_DATE and BASE_DATE should be given in seconds -# since EPOCH. It is assumed that this script is run weekly -# starting in the base date. Running at different timespans -# won't guarantee a good result. - -BASE_DATE=${BASE_DATE:-$(date -d '2018-11-30' '+%s')} -NOW_DATE=${NOW_DATE:-$(date -d 'now' '+%s')} - -# At end of Sprint #33, we use it's last day as the base date -cond=$(date -d '2020-01-10' '+%s') -if [ $NOW_DATE -ge $cond ]; -then - BASE_DATE=$cond -fi - -# Transitional calculations -DATE_DIFF=$(( $NOW_DATE - $BASE_DATE )) -DAYS_ELAPSED=$(( $DATE_DIFF / (24*60*60) )) -WEEKS_ELAPSED=$(( $DAYS_ELAPSED / 7)) - -# This value will be used to determine the type of the release -WEEKS_MOD3=$(( $WEEKS_ELAPSED % 3 )) - -# Sprint #33 is 4 weeks long. Return 'snapshot.2' between Jan 3rd and Jan 9th -if [ $NOW_DATE -ge $(date -d '2020-01-03' '+%s') ] && [ $NOW_DATE -lt $(date -d '2020-01-10' '+%s') ]; -then - echo 'snapshot.2' - exit 0 -fi - -case $WEEKS_MOD3 in - 0) - RELEASE_TYPE='minor' ;; - 1) - RELEASE_TYPE='snapshot.0' ;; - 2) - RELEASE_TYPE='snapshot.1' ;; -esac - -# Print the determined type -echo $RELEASE_TYPE diff --git a/hack/run-kiali.sh b/hack/run-kiali.sh index d13952da51..d851471119 100755 --- a/hack/run-kiali.sh +++ b/hack/run-kiali.sh @@ -86,7 +86,6 @@ DEFAULT_LOCAL_REMOTE_PORTS_PROMETHEUS="9091:9090" DEFAULT_LOCAL_REMOTE_PORTS_TRACING="16686:16686" DEFAULT_LOG_LEVEL="info" DEFAULT_REBOOTABLE="true" -DEFAULT_UI_CONSOLE_DOWNLOAD_VERSION="latest" # Process command line options @@ -112,7 +111,6 @@ while [[ $# -gt 0 ]]; do -r|--rebootable) REBOOTABLE="$2"; shift;shift ;; -tu|--tracing-url) TRACING_URL="$2"; shift;shift ;; -ucd|--ui-console-dir) UI_CONSOLE_DIR="$2"; shift;shift ;; - -ucv|--ui-console-version) UI_CONSOLE_DOWNLOAD_VERSION="$2"; shift;shift ;; -h|--help ) cat < - -ucv|--ui-console-version - If you elect to download the UI Console from npm, this is the version it will download. - Make sure this version is compatible with the server you are going to run. - Note that this value is ignored if you do not elect to download the UI Console. - Default: ${DEFAULT_UI_CONSOLE_DOWNLOAD_VERSION} + The "build" directory of the kiali-ui is generated after you run "yarn build" to + generate the distributable package. So, make sure that you build the kiali-ui before + using this script and then set this option to the generated build directory. + For details, see: https://github.com/kiali/kiali-ui + Default: HELPMSG exit 1 ;; @@ -439,7 +430,7 @@ if [ -z "${KUBERNETES_API_HOST:-}" -o -z "${KUBERNETES_API_PORT:-}" ]; then fi fi -# If the user didn't tell us what ui console directory to use, try to determine it or download it +# If the user didn't tell us what ui console directory to use, try to determine it if [ -z "${UI_CONSOLE_DIR:-}" ]; then infomsg "Attempting to find the UI Console directory..." @@ -460,25 +451,13 @@ if [ -z "${UI_CONSOLE_DIR:-}" ]; then cur_path="$(readlink -f "${cur_path}"/..)" done if [ -z "${UI_CONSOLE_DIR:-}" ]; then - warnmsg "Could not find a local directory containing the UI Console. You can either specify it via --ui-console-dir or download a copy." - questionchar; read -p "Do you want to download a copy now from npm into the ${TMP_DIR} directory? ('y' or 'n'): " yn - case $yn in - [Yy]*) infomsg "OK, attempting to download it..."; UI_CONSOLE_DIR="download";; - *) errormsg "Aborting. You need to specify the UI Console directory via --ui-console-dir"; exit 1;; - esac + errormsg "Could not find a local directory containing the UI Console." + errormsg "You need to specify the UI Console directory via --ui-console-dir." + errormsg "Aborting." + exit 1 fi fi -if [ "${UI_CONSOLE_DIR}" == "download" ]; then - UI_CONSOLE_DIR="${TMP_DIR}/console" - UI_CONSOLE_DOWNLOAD_VERSION="${UI_CONSOLE_DOWNLOAD_VERSION:-${DEFAULT_UI_CONSOLE_DOWNLOAD_VERSION}}" - infomsg "Attempting to download UI Console version [${UI_CONSOLE_DOWNLOAD_VERSION}] to: ${UI_CONSOLE_DIR}"; - rm -rf ${TMP_DIR}/console - mkdir -p "${UI_CONSOLE_DIR}" - curl -s $(npm view @kiali/kiali-ui@${UI_CONSOLE_DOWNLOAD_VERSION} dist.tarball) \ - | tar zxf - --strip-components=2 --directory ${UI_CONSOLE_DIR} package/build || warnmsg "Failed to download UI Console" -fi - # Kiali will log the version of the UI based on version.txt - create a dummy one to avoid a warning message at startup if [ ! -f "${UI_CONSOLE_DIR}/version.txt" ]; then echo "Local-Build" > "${UI_CONSOLE_DIR}/version.txt" @@ -506,7 +485,6 @@ echo "PROMETHEUS_URL=$PROMETHEUS_URL" echo "REBOOTABLE=$REBOOTABLE" echo "TRACING_URL=$TRACING_URL" echo "UI_CONSOLE_DIR=$UI_CONSOLE_DIR" -echo "UI_CONSOLE_DOWNLOAD_VERSION=${UI_CONSOLE_DOWNLOAD_VERSION:-}" # Validate the settings diff --git a/make/Makefile.container.mk b/make/Makefile.container.mk index 283a85339a..6dab4cf0e7 100644 --- a/make/Makefile.container.mk +++ b/make/Makefile.container.mk @@ -4,7 +4,7 @@ # .prepare-kiali-image-files: - @CONSOLE_VERSION=${CONSOLE_VERSION} CONSOLE_LOCAL_DIR=${CONSOLE_LOCAL_DIR} deploy/get-console.sh + @CONSOLE_LOCAL_DIR=${CONSOLE_LOCAL_DIR} deploy/get-console.sh @echo Preparing container image files @mkdir -p ${OUTDIR}/docker @cp -r deploy/docker/* ${OUTDIR}/docker