-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dockolith POC #1331
Open
jaredperreault-okta
wants to merge
47
commits into
master
Choose a base branch
from
jp-OKTA-528462
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
dockolith POC #1331
Changes from all commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
c8ed138
first pass
jaredperreault-okta 7c5fc04
testing on bacon
jaredperreault-okta 92960da
fixes bacon.yml
jaredperreault-okta 0629593
removes dockolith
jaredperreault-okta b79b335
fixes e2e dockolith
jaredperreault-okta 010a3e5
fixes bacon
jaredperreault-okta 53a0a8b
fixes bacon
jaredperreault-okta 6fd703c
fixes e2e to run on dockolith
jaredperreault-okta 89f336e
fixes bacon
jaredperreault-okta 787e901
fixes bacon
jaredperreault-okta f61f84e
fixes hidden linter errors
jaredperreault-okta c5f9f33
pr feedback
jaredperreault-okta 3324428
fixes bacon
jaredperreault-okta fbfd653
fixes bacon
jaredperreault-okta 21eb8ee
fix for bacon
jaredperreault-okta 31543d9
fixes e2e tests, turns on headless mode on bacon
jaredperreault-okta ac9aa87
install chrome on bacon
jaredperreault-okta fe4ce8f
fixes linter issues
jaredperreault-okta 1152e6f
skip tests
jaredperreault-okta f46a7c4
fixes e2e-monolith
jaredperreault-okta e05500c
feedback
jaredperreault-okta 7d8330e
adds buildversion override
jaredperreault-okta dc2472c
update buildversion
jaredperreault-okta a71ff29
bumps dockolith version
jaredperreault-okta ac29ceb
updates to monolith version with test baselines
jaredperreault-okta d893c1e
new build version
jaredperreault-okta 8ec1bd4
fixes org setup
jaredperreault-okta 8554753
fixes embedded login error
jaredperreault-okta dd280c8
disable https
jaredperreault-okta f4b2610
disable cucumber tests for dockolith
jaredperreault-okta e0a7c45
fixes failing cucumber suite
jaredperreault-okta 2248fde
new buildversion
jaredperreault-okta 92f4d70
debug bacon
jaredperreault-okta b6e5b17
new build version
jaredperreault-okta 456f668
new buildversion
jaredperreault-okta 464b770
bumps java version
jaredperreault-okta 3698d3d
new build version
jaredperreault-okta db028ee
new build version
jaredperreault-okta 993d3b2
buildversion
jaredperreault-okta 09c9e97
update queue name
jaredperreault-okta 70327e9
new build
jaredperreault-okta 964c23f
removes java install
jaredperreault-okta 52c638e
updates dockolith
jaredperreault-okta fae241d
fixes bacon
jaredperreault-okta 2313845
fixes bacon
jaredperreault-okta f2542c9
fixes scripts
jaredperreault-okta ff6d9fb
bacon wont finish
jaredperreault-okta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/bash | ||
|
||
LOCAL_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd) | ||
|
||
export CI=true | ||
# export SKIP_SETUP_BUILD=1 | ||
source $LOCAL_DIR/../setup-dockolith.sh | ||
|
||
create_log_group "E2E Setup" | ||
export DBUS_SESSION_BUS_ADDRESS=/dev/null | ||
export TEST_SUITE_TYPE="junit" | ||
export TEST_RESULT_FILE_DIR="${REPO}/build2/reports/e2e" | ||
|
||
# NOTE: exports which are used to control test and/or test app behavior have been | ||
# moved to test/support/monolith/create-e2e-env.ts (output via testenv.local) | ||
|
||
# re-export testenv | ||
set -a | ||
source $LOCAL_DIR/../../testenv | ||
set +a | ||
|
||
export TEST_NAME=@okta/test.app | ||
finish_log_group $? | ||
|
||
create_log_group "E2E Test Run" | ||
if ! yarn test:e2e; then | ||
echo "Cucumber tests failed! Exiting..." | ||
exit ${TEST_FAILURE} | ||
fi | ||
finish_log_group $? | ||
|
||
# Skip cucumber tests for now | ||
# create_log_group "E2E Cucumber Test Run" | ||
# if ! yarn test:e2e:cucumber; then | ||
# echo "Cucumber tests failed! Exiting..." | ||
# exit ${TEST_FAILURE} | ||
# fi | ||
# finish_log_group $? | ||
|
||
echo ${TEST_SUITE_TYPE} > ${TEST_SUITE_TYPE_FILE} | ||
echo ${TEST_RESULT_FILE_DIR} > ${TEST_RESULT_FILE_DIR_FILE} | ||
exit ${PUBLISH_TYPE_AND_RESULT_DIR} |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash -xe | ||
|
||
# Creates a test org and outputs environment variables to a file named "testenv.local" in the project root | ||
|
||
#yarn workspace @okta/test.support monolith:create-env | ||
pushd ./test/support | ||
yarn ts-node ./monolith/create-e2e-env.ts | ||
popd | ||
|
||
cat testenv.local >> testenv | ||
echo "updated testenv" |
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash -e | ||
|
||
if [[ -z ${DOCKOLITH_BRANCH} ]]; then | ||
export DOCKOLITH_BRANCH=master | ||
fi | ||
|
||
pushd ./scripts | ||
rm -rf dockolith | ||
echo "Cloning dockolith from branch: ${DOCKOLITH_BRANCH}" | ||
git clone --depth 1 -b $DOCKOLITH_BRANCH https://github.com/okta/dockolith.git | ||
|
||
# build dockolith target | ||
pushd ./dockolith | ||
yarn | ||
yarn build | ||
popd | ||
popd | ||
|
||
# Yarn "add" always modifies package.json https://github.com/yarnpkg/yarn/issues/1743 | ||
# Make a backup of package.json and restore it after install | ||
cp package.json package.json.bak | ||
yarn add -DW --no-lockfile file:./scripts/dockolith | ||
mv package.json.bak package.json |
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/bin/bash -xe | ||
|
||
if [ -z "${DOCKOLITH_CI}" ]; then # Local | ||
# remove all running containers and networks before running | ||
source ${DOCKOLITH_HOME}/scripts/smoke-docker.sh | ||
|
||
# clear all tmp files | ||
rm -rf ${DOCKOLITH_TMP} | ||
fi | ||
|
||
source ${DOCKOLITH_HOME}/scripts/lib/dockolith/setup-dockolith.sh | ||
|
||
dockolith::setup; | ||
|
||
create_log_group "Setup" | ||
dockolith::setup; | ||
finish_log_group $? | ||
|
||
#Set the spring config profiles. this determines which config files are loaded | ||
# http://localhost:8100/okta/ci,ci_test_shared_credentials | ||
# web credentials for CCS in bootstrap-ci.properties | ||
# special "widget" profile is used to load locally built widget version | ||
export MONOLITH_PROFILES_ACTIVE="ci_test_shared_credentials,ci,widget" | ||
|
||
create_log_group "Start Tomcat" | ||
dockolith::start_tomcat; | ||
finish_log_group $? | ||
|
||
create_log_group "Verify Webapp" | ||
export DOCKER_HOST_CONTAINER_IP=$(docker inspect --format='{{.NetworkSettings.Networks.monolith_network.IPAddress}}' mono_dockerhost) | ||
update_hosts_entry $DOCKER_HOST_CONTAINER_IP cdn.okta1.com | ||
update_hosts_entry $DOCKER_HOST_CONTAINER_IP rain.okta1.com | ||
update_hosts_entry $DOCKER_HOST_CONTAINER_IP backdoorentry.okta1.com | ||
|
||
curl http://backdoorentry.okta1.com:1802 | ||
finish_log_group $? | ||
|
||
|
||
create_log_group "Bootstrap" | ||
export METRIC_TO_LOG=bootstrap_db | ||
if ! log_metric_wrapper dockolith::bootstrap; | ||
then | ||
echo "bootstrap failed!" | ||
# move_logs_tmp_api | ||
# log_extra_dir_as_zip ${TMP_LOGS_LOCATION} run_logs.zip | ||
exit ${BUILD_FAILURE} | ||
fi | ||
finish_log_group $? |
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 |
---|---|---|
@@ -0,0 +1,156 @@ | ||
#!/bin/bash -e | ||
|
||
DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd) | ||
for f in $(ls $DIR/utils); do source $DIR/utils/$f; done | ||
|
||
# if running on bacon | ||
if [ -n "${TEST_SUITE_ID}" ]; then | ||
# Add yarn to the $PATH so npm cli commands do not fail | ||
export PATH="${PATH}:$(yarn global bin)" | ||
# Install required node version | ||
export NVM_DIR="/root/.nvm" | ||
|
||
setup_service node "${1:-v14.18.0}" | ||
# Use the cacert bundled with centos as okta root CA is self-signed and cause issues downloading from yarn | ||
setup_service yarn 1.21.1 /etc/pki/tls/certs/ca-bundle.crt | ||
|
||
else | ||
# bacon defines OKTA_HOME and REPO, define these relative to this file | ||
export OKTA_HOME=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )/.." &> /dev/null && pwd) | ||
export REPO="." | ||
export TEST_SUITE_TYPE_FILE=/dev/null | ||
export TEST_RESULT_FILE_DIR_FILE=/dev/null | ||
|
||
### (known) Bacon exit codes | ||
# success | ||
export SUCCESS=0 | ||
export PUBLISH_TYPE_AND_RESULT_DIR=0 | ||
export PUBLISH_TYPE_AND_RESULT_DIR_BUT_SUCCEED_IF_NO_RESULTS=0 | ||
# failure | ||
export FAILURE=1 | ||
export FAILED_SETUP=1 | ||
export TEST_FAILURE=1 | ||
export PUBLISH_TYPE_AND_RESULT_DIR_BUT_ALWAYS_FAIL=1 | ||
export PUBLISH_ARTIFACTORY_FAILURE=1 | ||
|
||
# bacon commands | ||
get_secret () { | ||
# ensures the env var is set | ||
if [ -z "$(echo "$2")" ]; then | ||
echo "$2 is not defined. Exiting..." | ||
exit 1 | ||
fi | ||
} | ||
|
||
get_vault_secret_key () { | ||
get_secret $1 $3 | ||
} | ||
|
||
junit () { | ||
echo 'noop' | ||
} | ||
|
||
create_log_group () { | ||
set +x | ||
echo "~*~*~~*~*~ $1 ~*~*~~*~*~ " | ||
set -x | ||
} | ||
|
||
finish_log_group () { | ||
set +x | ||
echo "~*~*~~*~*~ *~*~* ~*~*~~*~*~" | ||
set -x | ||
} | ||
|
||
set -x # when running locally, might as well see all the commands being ran | ||
fi | ||
|
||
cd ${OKTA_HOME}/${REPO} | ||
|
||
function artifactory_siw_install () { | ||
REGISTRY="https://artifacts.aue1d.saasure.com/artifactory/npm-topic/@okta/okta-signin-widget/-/@okta" | ||
|
||
ssl=$(npm config get strict-ssl) | ||
npm config set strict-ssl false | ||
pkg_uri="${REGISTRY}/okta-signin-widget-${WIDGET_VERSION}.tgz" | ||
if ! yarn add -DW --force --ignore-scripts $pkg_uri &>/dev/null; then | ||
echo "WIDGET_VERSION could not be installed via artifactory: ${WIDGET_VERSION}" | ||
exit ${FAILED_SETUP} | ||
fi | ||
npm config set strict-ssl $ssl | ||
echo $pkg_uri | ||
} | ||
|
||
function npm_siw_install () { | ||
if ! yarn add -DW --force --ignore-scripts @okta/okta-signin-widget@${WIDGET_VERSION} ; then | ||
echo "WIDGET_VERSION could not be installed via npm: ${WIDGET_VERSION}" | ||
exit ${FAILED_SETUP} | ||
fi | ||
} | ||
|
||
function verify_workspace_versions () { | ||
PKG=$1 | ||
|
||
onError () { | ||
echo "ADDITIONAL WIDGET INSTALL DETECTED (check $1)" | ||
yarn why $PKG | ||
exit ${FAILED_SETUP} | ||
} | ||
|
||
LOCAL_INSTALLS=$(find . -type d -path "*/node_modules/$PKG" | wc -l) | ||
if [ $LOCAL_INSTALLS -gt 1 ] | ||
then | ||
onError 1 | ||
fi | ||
|
||
# parses `yarn why` output to generate an json array of installed versions | ||
INSTALLED_VERSIONS=$(yarn why --json $PKG | jq -r -s 'map(select(.type == "info") | select(.data | strings | contains("Found"))) | map(.data[11:-1]) | map(split("@")[-1]) | unique') | ||
|
||
if [ $(echo $INSTALLED_VERSIONS | jq length) -ne 1 ] | ||
then | ||
onError 2 | ||
fi | ||
|
||
if [ $(echo $INSTALLED_VERSIONS | jq .[0] | tr -d \" ) != $WIDGET_VERSION ] | ||
then | ||
onError 3 | ||
fi | ||
} | ||
|
||
function setup::install() { | ||
# Install dependences. --ignore-scripts will prevent chromedriver from attempting to install | ||
if ! yarn install --frozen-lockfile --ignore-scripts; then | ||
echo "yarn install failed! Exiting..." | ||
exit ${FAILED_SETUP} | ||
fi | ||
|
||
if [ ! -z "$WIDGET_VERSION" ]; then | ||
echo "Installing WIDGET_VERSION: ${WIDGET_VERSION}" | ||
|
||
SHA=$(echo $WIDGET_VERSION | cut -d "-" -f 2) | ||
# cut -d "-" ran on '7.0.0' returns '7.0.0', ensure a SHA exists on the version string | ||
if [ "$WIDGET_VERSION" = "$SHA" ]; then | ||
# no sha found, install from npm | ||
INSTALLED_VERSION=$(npm_siw_install) | ||
else | ||
# sha found, install from artifactory | ||
INSTALLED_VERSION=$(artifactory_siw_install) | ||
fi | ||
|
||
install_beta_pkg @okta/okta-signin-widget "$INSTALLED_VERSION" | ||
|
||
verify_workspace_versions @okta/okta-signin-widget | ||
echo "WIDGET_VERSION installed: ${WIDGET_VERSION}" | ||
fi | ||
} | ||
|
||
function setup::build() { | ||
if [ -z "$SKIP_SETUP_BUILD" ]; then | ||
if ! yarn build; then | ||
echo "build failed! Exiting..." | ||
exit ${TEST_FAILURE} | ||
fi | ||
else | ||
echo '`SKIP_SETUP_BUILD` set, skipping build...' | ||
fi | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is where the build happens. Can add --ignore-scripts option to skip the build step
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding
--ignore-scripts
here prevents dockolith from building