-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstart_oss
executable file
·77 lines (63 loc) · 1.94 KB
/
start_oss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash -ex
set -x
rm -rf .env
get_container_logs(){
mkdir -p logs
docker compose ps --format json \
|jq -s -r '.[]|.Name' \
|while read -r container; do \
docker logs "${container}" &> "logs/${container}.log"
done
}
trap get_container_logs EXIT
docker compose down -v
docker compose pull conjur pg proxy openssl
docker compose build
docker compose up -d proxy # Don't need to specify conjur here, as proxy depends on conjur
docker compose exec -T conjur conjurctl wait -r 240
admin_api_key=$(docker compose exec -T conjur conjurctl role retrieve-key dev:user:admin | tr -d '\r')
export CONJUR_AUTHN_API_KEY=$admin_api_key
conjur_host_port=$(docker compose port conjur 80)
conjur_port="${conjur_host_port##*:}"
# Remove files from tmp but avoid recreating the folder to
# avoid cache busting
mkdir -p tmp
rm -rf tmp/*
echo "${admin_api_key}" > api_key
export CONJUR_AUTHN_TOKEN_FILE="/api_key"
cat <<ENV > .env
CONJUR_APPLIANCE_URL=https://proxy
CONJUR_ACCOUNT=dev
CONJUR_AUTHN_LOGIN=admin
CONJUR_AUTHN_API_KEY=$admin_api_key
CONJUR_CERT_FILE="/conjur-dev.pem"
CONJUR_AUTHN_TOKEN_FILE="/api_key"
ENV
source .env
docker compose run \
--volume "${PWD}:${PWD}" \
--workdir "${PWD}" \
--rm \
--no-deps \
client \
-ec '
yes yes | conjur init -u https://proxy -a dev --self-signed
conjur variable set -i db/password -v secret
conjur variable set -i db/dbuserName -v 123456
conjur variable set -i db/dbpassWord -v 7890123
conjur variable set -i db/key -v 456789
conjur variable set -i "my var" -v othersecret
'
sleep 2
docker compose run \
--volume "$(git rev-parse --show-toplevel):/repo" \
--volume "${PWD}/maven_cache":/root/.m2 \
--volume "${PWD}/api_key:/api_key" \
--volume "${PWD}/conjur-dev.pem:/conjur-dev.pem" \
-e CONJUR_AUTHN_TOKEN_FILE \
--workdir "/repo" \
--no-deps \
--rm \
--entrypoint sh \
conjur-mule-image \
-ec 'mvn --batch-mode -f pom.xml jacoco:prepare-agent test jacoco:report'