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"
56
56
arg=" "
57
57
58
58
if [[ local_env -eq 1 ]]; then
59
- ensure_conjur_up
59
+ ensure_conjur_up latest
60
60
61
61
export CONJUR_AUTHN_API_KEY=" $( docker-compose exec conjur conjurctl role retrieve-key dev:user:admin | tr -d ' \r' ) "
62
62
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
source bin/util
3
3
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
+
4
39
cleanup () {
5
40
echo " Cleaning up..."
6
41
docker-compose rm --stop --force -v
@@ -23,6 +58,7 @@ echo "Building services..."
23
58
docker-compose build pg conjur conjur-https
24
59
25
60
# Start Conjur server
61
+ export CONJUR_OPEN_SOURCE_IMAGE_TAG=" ${conjur_tag:- $CONJUR_OPEN_SOURCE_IMAGE_TAG } "
26
62
echo " Starting Conjur..."
27
63
docker-compose up -d conjur conjur-https
28
64
docker-compose exec -T conjur conjurctl wait
Original file line number Diff line number Diff line change 2
2
source bin/util
3
3
4
4
endpoint_flag=" "
5
+ conjur_tag=" latest"
5
6
6
7
while test $# -gt 0; do
7
8
case " $1 " in
@@ -16,6 +17,7 @@ while test $# -gt 0; do
16
17
echo
17
18
echo " -h, --help show help"
18
19
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"
19
21
exit 0
20
22
;;
21
23
-e|--endpoint)
@@ -27,6 +29,10 @@ while test $# -gt 0; do
27
29
fi
28
30
shift
29
31
;;
32
+ -s|--stable)
33
+ conjur_tag=" edge"
34
+ shift
35
+ ;;
30
36
* )
31
37
break
32
38
;;
35
41
36
42
if [[ -z " $( docker-compose ps -q) " ]]; then
37
43
announce " Environment not found. Spinning up..."
44
+ export CONJUR_OPEN_SOURCE_IMAGE_TAG=" $conjur_tag "
38
45
./bin/start_conjur 1> /dev/null
39
46
echo
40
47
fi
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ OPTIONS
27
27
This option does not maintaing Conjur Enterprise.
28
28
WARNING: may cause failing test cases.
29
29
--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.
30
31
-t|--test <test> Runs a given test in a client test suite.
31
32
EOF
32
33
}
@@ -42,6 +43,7 @@ enterprise=0
42
43
appliance=" oss"
43
44
enterprise_params=" "
44
45
docker_network=" openapi-spec"
46
+ conjur_open_source_tag=" edge"
45
47
46
48
no_regen_client=0
47
49
no_rebuid_conjur=0
87
89
--no-regen-client)
88
90
no_regen_client=1
89
91
;;
92
+ -s|--stable)
93
+ conjur_open_source_tag=" latest"
94
+ ;;
90
95
-t|--test)
91
96
test=" $1 "
92
97
shift
@@ -197,11 +202,12 @@ if [[ $no_rebuild_conjur -eq 0 ||
197
202
( $( conjur_alive) -eq 1 && $enterprise -eq 0 ) ||
198
203
( $( enterprise_alive) -eq 1 && $enterprise -eq 1 ) ]]; then
199
204
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
202
208
else
203
209
announce " Starting Conjur Enterprise"
204
- bin/start_enterprise
210
+ bin/start_enterprise
205
211
206
212
pushd ./test/dap-intro
207
213
# 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(){
41
41
}
42
42
43
43
function ensure_conjur_up(){
44
+ desired_tag=" $1 "
45
+ export CONJUR_OPEN_SOURCE_IMAGE_TAG=" $desired_tag "
44
46
if [ -z $( docker-compose ps -q conjur) ]; then
45
47
announce " Starting Conjur container"
46
48
./bin/start_conjur
47
49
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
49
59
fi
50
60
}
51
61
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ services:
6
6
POSTGRES_HOST_AUTH_METHOD : trust
7
7
8
8
conjur :
9
- image : cyberark/conjur:edge
9
+ image : cyberark/conjur:${CONJUR_OPEN_SOURCE_IMAGE_TAG:- edge}
10
10
command : server -a dev -f /policy/policy.yaml
11
11
environment :
12
12
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"
39
39
if [[ -z $( curl -s http://localhost:8001/services/Conjur | grep ' "name":"Conjur"' ) ]]; then
40
40
echo " Kong setup failed"
41
41
exit 1
42
- else
43
- echo " Kong setup successful"
44
42
fi
45
43
46
44
announce " Making requests to Conjur through Kong Gateway"
47
45
48
- ensure_conjur_up
46
+ set +e
47
+ ensure_conjur_up latest
49
48
sleep 10
49
+ set -e
50
50
51
51
admin_api_key=" $( docker-compose exec -T conjur conjurctl role retrieve-key dev:user:admin | tr -d ' \r' ) "
52
52
token=" $( curl -s http://localhost:8000/authn/dev/admin/authenticate \
53
53
--header " Accept-Encoding: base64" \
54
54
--data $admin_api_key ) "
55
55
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
57
59
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 \
59
62
-H " Authorization: Token token=\" $token \" " \
60
63
--data " $secret_data "
61
64
62
- retrieved_secret=" $( curl http://localhost:8000/secrets/dev/variable/testSecret \
65
+ retrieved_secret=" $( curl http://localhost:8000/secrets/dev/variable/sampleSecret \
63
66
-H " Authorization: Token token=\" $token \" " ) "
64
67
65
68
if [ " $secret_data " == " $retrieved_secret " ]; then
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
- set -e
3
-
4
2
source ./bin/util
5
3
6
- ensure_client_is_generated python conjur
7
- ensure_conjur_up
4
+ ensure_client_is_generated python oss
5
+ ensure_conjur_up latest
8
6
9
7
export CONJUR_ADMIN_API_KEY=$( get_conjur_admin_api_key)
10
8
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
- set -e
3
-
4
2
source ./bin/util
5
3
6
- ensure_client_is_generated ruby conjur
7
- ensure_conjur_up
4
+ ensure_client_is_generated ruby oss
5
+ ensure_conjur_up latest
8
6
9
7
# Remove the gem if it is already built so we dont create a gemfile
10
8
# which contains itself when we build
You can’t perform that action at this time.
0 commit comments