forked from kiali/kiali
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '3891-phaseout-npm' into v1.34-test-npm
- Loading branch information
Showing
9 changed files
with
156 additions
and
276 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)" |
Oops, something went wrong.