File tree Expand file tree Collapse file tree 9 files changed +78
-20
lines changed Expand file tree Collapse file tree 9 files changed +78
-20
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ cmd="python3 examples/postman/postman_env_setup.py"
5656arg=" "
5757
5858if [[ local_env -eq 1 ]]; then
59- ensure_conjur_up
59+ ensure_conjur_up latest
6060
6161 export CONJUR_AUTHN_API_KEY=" $( docker-compose exec conjur conjurctl role retrieve-key dev:user:admin | tr -d ' \r' ) "
6262
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22source bin/util
33
4+ print_help () {
5+ cat << EOF
6+ This script starts Conjur Open Source in a docker-compose environment.
7+
8+ USAGE
9+ ./bin/start_conjur [options]
10+
11+ OPTIONS
12+ -h|--help Print help message.
13+ -s|--stable Start the latest stable version of Conjur Open Source.
14+ By default, the 'edge' version is used, which includes as yet
15+ unreleased content.
16+ EOF
17+ }
18+
19+ conjur_tag=" "
20+
21+ while test $# -gt 0
22+ do
23+ param=$1
24+ shift
25+ case " $param " in
26+ -h|--help)
27+ print_help
28+ exit 0
29+ ;;
30+ -s|--stable)
31+ conjur_tag=" latest"
32+ ;;
33+ * )
34+ break
35+ ;;
36+ esac
37+ done
38+
439cleanup () {
540 echo " Cleaning up..."
641 docker-compose rm --stop --force -v
@@ -23,6 +58,7 @@ echo "Building services..."
2358docker-compose build pg conjur conjur-https
2459
2560# Start Conjur server
61+ export CONJUR_OPEN_SOURCE_IMAGE_TAG=" ${conjur_tag:- $CONJUR_OPEN_SOURCE_IMAGE_TAG } "
2662echo " Starting Conjur..."
2763docker-compose up -d conjur conjur-https
2864docker-compose exec -T conjur conjurctl wait
Original file line number Diff line number Diff line change 22source bin/util
33
44endpoint_flag=" "
5+ conjur_tag=" latest"
56
67while test $# -gt 0; do
78 case " $1 " in
@@ -16,6 +17,7 @@ while test $# -gt 0; do
1617 echo
1718 echo " -h, --help show help"
1819 echo " -e, --endpoint <path> test endpoints starting with the given path"
20+ echo " -s, --stable test against the latest stable version of Conjur Open Source"
1921 exit 0
2022 ;;
2123 -e|--endpoint)
@@ -27,6 +29,10 @@ while test $# -gt 0; do
2729 fi
2830 shift
2931 ;;
32+ -s|--stable)
33+ conjur_tag=" edge"
34+ shift
35+ ;;
3036 * )
3137 break
3238 ;;
3541
3642if [[ -z " $( docker-compose ps -q) " ]]; then
3743 announce " Environment not found. Spinning up..."
44+ export CONJUR_OPEN_SOURCE_IMAGE_TAG=" $conjur_tag "
3845 ./bin/start_conjur 1> /dev/null
3946 echo
4047fi
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ OPTIONS
2727 This option does not maintaing Conjur Enterprise.
2828 WARNING: may cause failing test cases.
2929--no-regen-client Prevent the script from re-generating the client library.
30+ -s|--stable Runs tests against the latest stable version of Conjur Open Source.
3031-t|--test <test> Runs a given test in a client test suite.
3132EOF
3233}
@@ -42,6 +43,7 @@ enterprise=0
4243appliance=" oss"
4344enterprise_params=" "
4445docker_network=" openapi-spec"
46+ conjur_open_source_tag=" edge"
4547
4648no_regen_client=0
4749no_rebuid_conjur=0
8789 --no-regen-client)
8890 no_regen_client=1
8991 ;;
92+ -s|--stable)
93+ conjur_open_source_tag=" latest"
94+ ;;
9095 -t|--test)
9196 test=" $1 "
9297 shift
@@ -197,11 +202,12 @@ if [[ $no_rebuild_conjur -eq 0 ||
197202( $( conjur_alive) -eq 1 && $enterprise -eq 0 ) ||
198203( $( enterprise_alive) -eq 1 && $enterprise -eq 1 ) ]]; then
199204 if [[ $enterprise -eq 0 ]]; then
200- announce " Starting Conjur OSS"
201- bin/start_conjur
205+ announce " Starting Conjur OSS"
206+ export CONJUR_OPEN_SOURCE_IMAGE_TAG=" $conjur_open_source_tag "
207+ bin/start_conjur
202208 else
203209 announce " Starting Conjur Enterprise"
204- bin/start_enterprise
210+ bin/start_enterprise
205211
206212 pushd ./test/dap-intro
207213 # Create the parameter to import volumes from the Enterprise container so we have its certificates
Original file line number Diff line number Diff line change @@ -41,11 +41,21 @@ function ensure_client_is_generated(){
4141}
4242
4343function ensure_conjur_up(){
44+ desired_tag=" $1 "
45+ export CONJUR_OPEN_SOURCE_IMAGE_TAG=" $desired_tag "
4446 if [ -z $( docker-compose ps -q conjur) ]; then
4547 announce " Starting Conjur container"
4648 ./bin/start_conjur
4749 else
48- announce " Conjur already up!"
50+ docker ps | grep openapi | grep cyberark/conjur | grep $desired_tag > /dev/null
51+ desired_tag_deployed=" $? "
52+ if [[ " $desired_tag_deployed " == " 0" ]]; then
53+ announce " Conjur already up!"
54+ else
55+ announce " Conjur not deployed with tag $desired_tag . Re-deploying..."
56+ ./bin/stop
57+ ./bin/start_conjur
58+ fi
4959 fi
5060}
5161
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ services:
66 POSTGRES_HOST_AUTH_METHOD : trust
77
88 conjur :
9- image : cyberark/conjur:edge
9+ image : cyberark/conjur:${CONJUR_OPEN_SOURCE_IMAGE_TAG:- edge}
1010 command : server -a dev -f /policy/policy.yaml
1111 environment :
1212 CONJUR_DATA_KEY : ' OyXV68Mip14xj33huGaQKewmmS+gKtDlp6ECZ2iATpU='
Original file line number Diff line number Diff line change @@ -39,27 +39,30 @@ announce "Ensure Kong Gateway is active"
3939if [[ -z $( curl -s http://localhost:8001/services/Conjur | grep ' "name":"Conjur"' ) ]]; then
4040 echo " Kong setup failed"
4141 exit 1
42- else
43- echo " Kong setup successful"
4442fi
4543
4644announce " Making requests to Conjur through Kong Gateway"
4745
48- ensure_conjur_up
46+ set +e
47+ ensure_conjur_up latest
4948sleep 10
49+ set -e
5050
5151admin_api_key=" $( docker-compose exec -T conjur conjurctl role retrieve-key dev:user:admin | tr -d ' \r' ) "
5252token=" $( curl -s http://localhost:8000/authn/dev/admin/authenticate \
5353 --header " Accept-Encoding: base64" \
5454 --data $admin_api_key ) "
5555
56- secret_data=" Hello World!"
56+ curl -X POST http://localhost:8000/policies/dev/policy/root \
57+ -H " Authorization: Token token=\" $token \" " \
58+ --data " $( < examples/config/policy.yml) " 1> /dev/null
5759
58- curl -is http://localhost:8000/secrets/dev/variable/testSecret \
60+ secret_data=" Hello World!"
61+ curl -is http://localhost:8000/secrets/dev/variable/sampleSecret \
5962 -H " Authorization: Token token=\" $token \" " \
6063 --data " $secret_data "
6164
62- retrieved_secret=" $( curl http://localhost:8000/secrets/dev/variable/testSecret \
65+ retrieved_secret=" $( curl http://localhost:8000/secrets/dev/variable/sampleSecret \
6366 -H " Authorization: Token token=\" $token \" " ) "
6467
6568if [ " $secret_data " == " $retrieved_secret " ]; then
Original file line number Diff line number Diff line change 11#! /bin/bash
2- set -e
3-
42source ./bin/util
53
6- ensure_client_is_generated python conjur
7- ensure_conjur_up
4+ ensure_client_is_generated python oss
5+ ensure_conjur_up latest
86
97export CONJUR_ADMIN_API_KEY=$( get_conjur_admin_api_key)
108
Original file line number Diff line number Diff line change 11#! /bin/bash
2- set -e
3-
42source ./bin/util
53
6- ensure_client_is_generated ruby conjur
7- ensure_conjur_up
4+ ensure_client_is_generated ruby oss
5+ ensure_conjur_up latest
86
97# Remove the gem if it is already built so we dont create a gemfile
108# which contains itself when we build
You can’t perform that action at this time.
0 commit comments