Skip to content

Commit

Permalink
Simplify opt-in/out of Oracle when building (digital-asset#9515)
Browse files Browse the repository at this point in the history
* Simplify opt-in/out of Oracle when building

- defines Oracle-related environment variables as part of dev-env so that it's the same across CI and dev
- adds a Bazel 'oracle' configuration so that --config=oracle pulls all required environment

changelog_begin
changelog_end

* Address digital-asset#9515 (comment)

* Also use `$ORACLE_USERNAME` instead of `system` in the `sqlplus` connection string

* Address digital-asset#9515 (comment)
  • Loading branch information
stefanobaghino-da authored Apr 28, 2021
1 parent d761853 commit e1e878a
Showing 4 changed files with 12 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -21,6 +21,8 @@ fetch:scala_2_13 --repo_env=DAML_SCALA_VERSION=2.13.3
query:scala_2_13 --repo_env=DAML_SCALA_VERSION=2.13.3
sync:scala_2_13 --repo_env=DAML_SCALA_VERSION=2.13.3

test:oracle --repo_env DAML_ORACLE_TESTING=true --test_env ORACLE_USERNAME --test_env ORACLE_PORT --test_env ORACLE_PWD

# Improve remote cache hit rate by exluding environment variables from the
# sandbox that are not whitelisted using --action_env.
# This will become the default in a future Bazel release.
8 changes: 3 additions & 5 deletions ci/build.yml
Original file line number Diff line number Diff line change
@@ -212,8 +212,6 @@ jobs:
- bash: |
set -euo pipefail
eval "$(./dev-env/bin/dade-assist)"
export ORACLE_PORT=1521
export ORACLE_PWD=hunter2
docker login --username "$DOCKER_LOGIN" --password "$DOCKER_PASSWORD"
IMAGE=digitalasset/oracle:enterprise-19.3.0-preloaded-20210325-22-be14fb7
docker pull $IMAGE
@@ -230,16 +228,16 @@ jobs:
}
trap cleanup EXIT
testConnection() {
docker exec oracle bash -c 'sqlplus -L system/'"$ORACLE_PWD"'@//localhost:1521/ORCLPDB1 <<< "select * from dba_users;"; exit $?' >/dev/null
docker exec oracle bash -c 'sqlplus -L '"$ORACLE_USERNAME"'/'"$ORACLE_PWD"'@//localhost:'"$ORACLE_PORT"'/ORCLPDB1 <<< "select * from dba_users;"; exit $?' >/dev/null
}
until testConnection
do
echo "Could not connect to Oracle, trying again..."
sleep 1
done
# Actually run some tests
DAML_ORACLE_TESTING=true bazel test \
--test_env ORACLE_USERNAME=system --test_env ORACLE_PORT --test_env ORACLE_PWD \
bazel test \
--config=oracle \
//ledger-service/http-json-oracle/... \
//triggers/service:test-oracle \
//ledger/participant-integration-api:participant-integration-api-tests-oracle
2 changes: 2 additions & 0 deletions compatibility/.bazelrc
Original file line number Diff line number Diff line change
@@ -21,6 +21,8 @@ fetch:scala_2_13 --repo_env=DAML_SCALA_VERSION=2.13.3
query:scala_2_13 --repo_env=DAML_SCALA_VERSION=2.13.3
sync:scala_2_13 --repo_env=DAML_SCALA_VERSION=2.13.3

test:oracle --repo_env DAML_ORACLE_TESTING=true --test_env ORACLE_USERNAME --test_env ORACLE_PORT --test_env ORACLE_PWD

# Improve remote cache hit rate by exluding environment variables from the
# sandbox that are not whitelisted using --action_env.
# This will become the default in a future Bazel release.
5 changes: 5 additions & 0 deletions dev-env/lib/dade-dump-profile
Original file line number Diff line number Diff line change
@@ -128,3 +128,8 @@ fi
echo "export LC_ALL=en_US.UTF-8"
echo "export LANG=en_US.UTF-8"

echo "# Used when running Bazel commands with --config=oracle"
echo "export ORACLE_USERNAME=system"
echo "export ORACLE_PWD=hunter2"
echo "export ORACLE_PORT=1521"

0 comments on commit e1e878a

Please sign in to comment.