Skip to content

Commit

Permalink
Update E2E tests script to provide option for using nightly releases
Browse files Browse the repository at this point in the history
Some automated tests just need to run the integration tests / browser
E2E tests against a specific release version. They do not need to
build the application from scratch.

Add support for an environment variable `USE_NIGHTLY_RELEASE` which
bypasses the normal `npm install`, webpack build, ko build, etc. and
instead deploys the latest nightly release to the target environment.
  • Loading branch information
AlanGreene authored and tekton-robot committed Apr 18, 2023
1 parent aa2e844 commit 4ed004f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 35 deletions.
34 changes: 13 additions & 21 deletions scripts/release-installer
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

# Copyright 2020 The Tekton Authors
# Copyright 2020-2023 The Tekton Authors
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand All @@ -13,6 +13,14 @@

BASE_RELEASE_URL="https://storage.googleapis.com/tekton-releases/dashboard"

download() {
if type "curl" > /dev/null 2>&1; then
curl -sL $@
else
wget -q $@
fi
}

verifySupported() {
if ! type "curl" > /dev/null 2>&1 && ! type "wget" > /dev/null 2>&1; then
echo "Either curl or wget is required"
Expand All @@ -31,39 +39,23 @@ getReleaseURL() {

build() {
local VERSION=$1
if type "curl" > /dev/null 2>&1; then
curl -sL $(getReleaseURL $VERSION)/installer | bash -s -- build --version $@
elif type "wget" > /dev/null 2>&1; then
wget -q $(getReleaseURL $VERSION)/installer | bash -s -- build --version $@
fi
download $(getReleaseURL $VERSION)/installer | bash -s -- build --version $@
}

install() {
local VERSION=$1
if type "curl" > /dev/null 2>&1; then
curl -sL $(getReleaseURL $VERSION)/installer | bash -s -- install --version $@
elif type "wget" > /dev/null 2>&1; then
wget -q $(getReleaseURL $VERSION)/installer | bash -s -- install --version $@
fi
download $(getReleaseURL $VERSION)/installer | bash -s -- install --version $@
}

uninstall() {
local VERSION=$1
if type "curl" > /dev/null 2>&1; then
curl -sL $(getReleaseURL $VERSION)/installer | bash -s -- uninstall --version $@
elif type "wget" > /dev/null 2>&1; then
wget -q $(getReleaseURL $VERSION)/installer | bash -s -- uninstall --version $@
fi
download $(getReleaseURL $VERSION)/installer | bash -s -- uninstall --version $@
}

# help provides possible cli installation arguments
help () {
local VERSION=$1
if type "curl" > /dev/null 2>&1; then
curl -sL $(getReleaseURL $VERSION)/installer | bash -s -- "help"
elif type "wget" > /dev/null 2>&1; then
wget -q $(getReleaseURL $VERSION)/installer | bash -s -- "help"
fi
download $(getReleaseURL $VERSION)/installer | bash -s -- "help"
}

set -e
Expand Down
23 changes: 11 additions & 12 deletions test/e2e-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,36 +22,35 @@ source $(dirname $0)/e2e-common.sh

# Script entry point.

SED="sed"
START=1
END=30
PLATFORM=${PLATFORM:+"--platform $PLATFORM"}

initOS() {
local OS=$(echo `uname`|tr '[:upper:]' '[:lower:]')

case "$OS" in
darwin*) SED='gsed';;
esac
}

if [ "${SKIP_INITIALIZE}" != "true" ]; then
initialize $@
else
END=50
fi

initOS
install_buildx
install_kustomize
if [ "${USE_NIGHTLY_RELEASE}" != "true" ]; then
install_kustomize
fi

test_dashboard() {
local readonly=true
if [[ "$@" =~ "--read-write" ]]; then
readonly=false
fi
header "Setting up environment ($@)"
$tekton_repo_dir/scripts/installer install $@
if [ "${USE_NIGHTLY_RELEASE}" == "true" ]; then
echo "Installing nightly release"
$tekton_repo_dir/scripts/release-installer install --nightly latest $@
else
echo "Installing from HEAD"
$tekton_repo_dir/scripts/installer install $@
fi

wait_dashboard_backend
header "Running the e2e tests ($@)"

Expand Down
8 changes: 6 additions & 2 deletions test/presubmit-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,15 @@ function pre_unit_tests() {
}

function pre_integration_tests() {
local failed=0
local failed=0
if [ "${USE_NIGHTLY_RELEASE}" == "true" ]; then
echo "Using nightly release, skipping npm install and frontend build"
else
node_npm_install || failed=1
echo "Running frontend build"
npm run build || failed=1
return ${failed}
fi
return ${failed}
}

function extra_initialization() {
Expand Down

0 comments on commit 4ed004f

Please sign in to comment.