dashboard/scripts/build-e2e

41 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
set -e
set -x
# Builds a production version of dashboard directly in the dist folder with the
# base configured to be /dashboard so that this can be mapped or copied into a docker container
# deploymet of Rancher
# This is currently used by the e2e tests to build a version of dashboard and map this into
# the docker container to avoid having to run a separate node process to serve up the dashboard static assets
BUILD_DEBUG="${BUILD_DEBUG:-}"
if [[ -n "${BUILD_DEBUG}" ]]; then
set -x
env
fi
cd $(dirname $0)/..
echo "Building production build for e2e ..."
yarn --pure-lockfile install
source scripts/version
echo "BRANCH: ${COMMIT_BRANCH:-<none>}"
echo "TAG: ${GIT_TAG:-<none>}"
OUTPUT_DIR=dist
echo "Building..."
COMMIT=${COMMIT} VERSION=${VERSION} OUTPUT_DIR=$OUTPUT_DIR ROUTER_BASE='/dashboard/' RESOURCE_BASE='/dashboard/' yarn run build
# Ensure we have the latest ember (rancher/ui) build as well
# Note - We can't pull the `latest2` directory from CDN and we don't build a tar.gz for latest builds...
# ..so just fetch the latest index.html which references latest CDN bits
OUTPUT_EMBER_DIR=dist_ember
echo "Pulling latest rancher/ui"
mkdir $OUTPUT_EMBER_DIR
curl https://releases.rancher.com/ui/latest2/index.html -k -o $OUTPUT_EMBER_DIR/index.html