Skip to content

Commit

Permalink
Merge branch '3891-phaseout-npm' into v1.34-test-npm
Browse files Browse the repository at this point in the history
  • Loading branch information
israel-hdez committed May 13, 2021
2 parents 31fc359 + 5e0b5bb commit f4f8b71
Show file tree
Hide file tree
Showing 9 changed files with 156 additions and 276 deletions.
19 changes: 11 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
20 changes: 1 addition & 19 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down
16 changes: 1 addition & 15 deletions RELEASING.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
50 changes: 25 additions & 25 deletions deploy/get-console.sh
Original file line number Diff line number Diff line change
@@ -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)"
Loading

0 comments on commit f4f8b71

Please sign in to comment.