Skip to content

Commit 4996fdd

Browse files
committed
Cleanup
1 parent b028288 commit 4996fdd

11 files changed

Lines changed: 102 additions & 277 deletions

File tree

.travis.yml

Lines changed: 41 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -16,73 +16,77 @@ addons:
1616

1717
env:
1818
global:
19-
# Docker variables
20-
# You need to additionally set secret variables:
21-
# DOCKER_USER, DOCKER_PASSWORD in Travis settings panel to make sure they are not visible
19+
# Docker variables:
20+
- DOCKHER_HUB_REPO="${DOCKER_USER}/oracledb"
2221
- ORACLE_VERSION=11g-r2-xe
2322
- CONNECTION_STR='127.0.0.1:1521/XE'
2423
- DOCKER_OPTIONS='--shm-size=1g'
25-
- ORACLE_PWD="oracle"
26-
- UT3_DOCKER_REPO="utplsqlv3/oracledb"
27-
- DOCKHER_HUB_REPO="${DOCKER_BASE_TAG:-$UT3_DOCKER_REPO}"
28-
- SQLCLI="$HOME/sqlcl/bin/sql"
29-
- OJDBC_HOME="$HOME/sqlcl/lib"
3024

31-
# Project database user variables
25+
# SYS account password for DB - could be stored in Travis secrets
26+
- ORACLE_SYS_PASS="oracle"
27+
# Adding utPLSQL-cli to path - to be able to invoke "utplsql" from command line
28+
- PATH=$PATH:${TRAVIS_BUILD_DIR}/utPLSQL-cli/bin
29+
# Adding Oracle SQLCL to path - to be able to invoke "sql" from command line
30+
- PATH=$PATH:${TRAVIS_BUILD_DIR}/sqlcl/bin
31+
32+
# Project-specific database variables
3233
# used for creating the user in database, deploying source code and tests as well as executing the tests
3334
- DB_USER=ut3_demo
3435
- DB_PASS=ut3_demo
3536
#utPLSQL variables
3637
- UTPLSQL_DIR="utPLSQL"
37-
# - ORA_SDTZ='Europe/London' #Needed as a client parameter
38-
# - TZ='Europe/London' #Needed as a DB Server parameter
39-
##utPLSQL-cli variables
40-
- UTPLSQL_CLI_VERSION="3.1.0"
4138
- CACHE_DIR=$HOME/.cache
42-
- MAVEN_HOME=/usr/local/maven
43-
- MAVEN_CFG=$HOME/.m2
39+
# Additionally, you need to set following variables as Travis secrets:
40+
# DOCKER_USER
41+
# DOCKER_PASSWORD
42+
# ORACLE_OTN_USER
43+
# ORACLE_OTN_PASSWORD
4444
matrix:
45-
- UTPLSQL_3_VERSION='develop'
46-
- UTPLSQL_3_VERSION='v3.0.0' VERSION_PLACEHOLDER='utPLSQL - Version X.X.X.X'
47-
- UTPLSQL_3_VERSION='v3.0.4' VERSION_PLACEHOLDER='X.X.X.X'
48-
- UTPLSQL_3_VERSION='v3.1.1'
45+
- UTPLSQL_VERSION='develop'
46+
- UTPLSQL_VERSION='v3.0.0' VERSION_PLACEHOLDER='utPLSQL - Version X.X.X.X'
47+
- UTPLSQL_VERSION='v3.0.4' VERSION_PLACEHOLDER='X.X.X.X'
48+
- UTPLSQL_VERSION='v3.1.1'
4949

5050
cache:
5151
pip: true
5252
directories:
5353
- $CACHE_DIR
5454
- node_modules
55-
- $MAVEN_CFG
5655

5756
before_install:
58-
59-
60-
install:
6157
# Download Oracle sqlcl
62-
- bash .travis/install_sqlcl.sh
58+
- .travis/install_sqlcl.sh -u ${ORACLE_OTN_USER} -p ${ORACLE_OTN_PASSWORD} -d ${CACHE_DIR} -o ${TRAVIS_BUILD_DIR}
59+
# Check if Oracle sqlcl it is installed correctly
60+
- sql -v
6361

64-
# download latest utPLSQL-cli release
65-
- curl -Lk -o utPLSQL-cli.zip https://github.com/utPLSQL/utPLSQL-cli/releases/download/v${UTPLSQL_CLI_VERSION}/utPLSQL-cli.zip
66-
# and unzip it into utPLSQL-cli directory
62+
# download and unzip utPLSQL-cli release
63+
- curl -Lk -o utPLSQL-cli.zip "https://github.com/utPLSQL/utPLSQL-cli/releases/download/v3.1.6/utPLSQL-cli.zip"
6764
- unzip utPLSQL-cli.zip && chmod -R u+x utPLSQL-cli
68-
# get ojdbc.jar from Oracle using maven --maybe we could copy it from sqlcl ?
69-
# this is needed for utPSLQL-cli
70-
- bash .travis/maven_cfg.sh
71-
# download ORacle Database docker image from private repo and start the DB
72-
- bash .travis/start_db.sh
65+
# copy ojdbc.jar from sqlcl to utPSLQL-cli so it can be visible to utPSLQL-cli
66+
- cp sqlcl/lib/ojdbc8.jar utPLSQL-cli/lib && cp sqlcl/lib/orai18n.jar utPLSQL-cli/lib
7367

7468
# Download specified version of utPLSQL from utPLSQL github repo
75-
# Allows to set any branch name to be used
76-
- git clone --depth=1 --branch=${UTPLSQL_3_VERSION} https://github.com/utPLSQL/utPLSQL.git ${UTPLSQL_DIR}
69+
# Allows any utPLSQL branch/tag name to be used
70+
- git clone --depth=1 --branch=${UTPLSQL_VERSION} https://github.com/utPLSQL/utPLSQL.git ${UTPLSQL_DIR}
7771

7872
# update version placeholder before install
7973
# This is only needed when downloading utPLSQL versions older than 3.1
80-
- if [[ -n ${VERSION_PLACEHOLDER} ]] ; then sed -i "s/${VERSION_PLACEHOLDER}/${UTPLSQL_3_VERSION}/g" ${UTPLSQL_DIR}/source/core/ut_utils.pks; fi
74+
- if [[ -n ${VERSION_PLACEHOLDER} ]] ; then sed -i "s/${VERSION_PLACEHOLDER}/${UTPLSQL_VERSION}/g" ${UTPLSQL_DIR}/source/core/ut_utils.pks; fi
8175

82-
# Install utPLSQL into DB
76+
- docker login -u "${DOCKER_USER}" -p "${DOCKER_PASSWORD}"
77+
# download Oracle Database docker image from private repo and start the DB
78+
- time docker pull ${DOCKHER_HUB_REPO}:${ORACLE_VERSION}
79+
# start the docker container (DB)
80+
- docker run -d --name ${ORACLE_VERSION} ${DOCKER_OPTIONS} -p 1521:1521 ${DOCKHER_HUB_REPO}:${ORACLE_VERSION}
81+
# Wait for DB startup
82+
- time docker logs -f ${ORACLE_VERSION} | grep -m 1 "DATABASE IS READY TO USE!" --line-buffered
83+
84+
# Install utPLSQL into the Database
8385
- .travis/install_utplsql.sh
86+
87+
install:
8488
# Create the demo project DB user account
85-
- .travis/setup_account.sh
89+
- source/setup_db_account.sh
8690
# Install project sources and tests
8791
- source/install.sh
8892
- test/install.sh

.travis/download.sh

Lines changed: 0 additions & 71 deletions
This file was deleted.

.travis/install_sqlcl.sh

Lines changed: 56 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,66 @@
11
#!/bin/bash
22
set -e
33

4+
###############################3
5+
# Declarations
6+
###############################3
7+
SCRIPT_DIR="$( dirname "${BASH_SOURCE[0]}" )"
48
SQLCL_FILE=sqlcl-18.3.0.259.2029.zip
5-
cd .travis
9+
AGREEMENT_URL="http://www.oracle.com/technetwork/developer-tools/sqlcl/downloads/index.html"
10+
DOWNLOAD_URL="https://download.oracle.com/otn/java/sqldeveloper/${SQLCL_FILE}"
11+
ZIP_TARGET_DIR=""
12+
OTN_USER=""
13+
OTN_PASS=""
14+
OUTPUT_DIR=""
615

7-
# Download if not present on cache dir.
8-
if [ ! -f $CACHE_DIR/$SQLCL_FILE ]; then
16+
# Call the casperjs script to return the download url. Then download the file using curl.
17+
downloadFile() {
18+
user=$1
19+
pass=$2
20+
agreementUrl=$3
21+
downloadUrl=$4
22+
outputFile=$5
23+
echo "Signing-in"
24+
downloadUrl=$(exec casperjs ${SCRIPT_DIR}/download.js ${user} ${pass} ${agreementUrl} ${downloadUrl})
25+
downloadUrl=${downloadUrl%$'\r'}
26+
echo "DownloadURL: $downloadUrl"
27+
curl -o ${outputFile} -L "$downloadUrl"
28+
}
29+
30+
###############################3
31+
# Main script
32+
###############################3
33+
34+
#Evaluate script input parameters
35+
while getopts "p:u:d:o:" OPTNAME; do
36+
case "${OPTNAME}" in
37+
"d") ZIP_TARGET_DIR="${OPTARG}" ;;
38+
"u") OTN_USER="${OPTARG}" ;;
39+
"p") OTN_PASS="${OPTARG}" ;;
40+
"o") OUTPUT_DIR="${OPTARG}" ;;
41+
esac
42+
done
43+
44+
#Check parameters
45+
if [[ "${ZIP_TARGET_DIR}" == "" ]]; then
46+
ZIP_TARGET_DIR="."
47+
fi
48+
if [[ "$OTN_USER" == "" ]] || [[ "$OTN_PASS" == "" ]]; then
49+
echo "Error: Oracle OTN username/password not specified."
50+
exit 1
51+
fi
52+
if [[ "$OUTPUT_DIR" == "" ]]; then
53+
echo "Error: Output directory not specified"
54+
exit 1
55+
fi
56+
57+
if [[ ! -f "${ZIP_TARGET_DIR}/${SQLCL_FILE}" ]]; then
958
npm install -g phantomjs-prebuilt casperjs
10-
bash download.sh -p sqlcl
11-
mv $SQLCL_FILE $CACHE_DIR
59+
echo "Downloading sqlcl from Oracle"
60+
downloadFile ${OTN_USER} ${OTN_PASS} ${AGREEMENT_URL} ${DOWNLOAD_URL} "${ZIP_TARGET_DIR}/${SQLCL_FILE}"
1261
else
1362
echo "Installing sqlcl from cache..."
1463
fi;
1564

16-
# Install sqlcl.
17-
unzip -q $CACHE_DIR/$SQLCL_FILE -d $HOME
18-
19-
# Check if it is installed correctly.
20-
$SQLCLI -v
65+
echo "Unzipping sqlcl into: ${ZIP_TARGET_DIR}"
66+
unzip -q "${ZIP_TARGET_DIR}/${SQLCL_FILE}" -d ${OUTPUT_DIR}

.travis/install_utplsql.sh

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22

33
set -ev
44

5-
cd $UTPLSQL_DIR/source
5+
cd ${UTPLSQL_DIR}/source
66

7-
${SQLCLI} -S -L sys/${ORACLE_PWD}@//${CONNECTION_STR} AS SYSDBA @install_headless.sql
8-
9-
#${SQLCLI} -L -S sys/${ORACLE_PWD}@//${CONNECTION_STR} AS SYSDBA <<SQL
10-
#grant select any dictionary to ut3;
11-
#exit
12-
#SQL
7+
sql -S -L sys/${ORACLE_SYS_PASS}@//${CONNECTION_STR} AS SYSDBA @install_headless.sql

.travis/maven_cfg.sh

Lines changed: 0 additions & 18 deletions
This file was deleted.

.travis/pom.xml

Lines changed: 0 additions & 62 deletions
This file was deleted.

0 commit comments

Comments
 (0)