Skip to content

Commit

Permalink
Be specific about which Conjur image targeting during build/test/push…
Browse files Browse the repository at this point in the history
… [CON-4493] (#494)

* Pass through version tag for docker image to avoid image shadowing

* Move junit collection to post always section, collect coverage

* add required param reportTitles to publishHTML

* publishHTML doesnt support default params :(
  • Loading branch information
dustinmm80 authored and apotterri committed Dec 4, 2017
1 parent 419b22b commit e0ec479
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 17 deletions.
4 changes: 2 additions & 2 deletions Dockerfile.test
@@ -1,4 +1,4 @@
FROM conjur
ARG VERSION=latest
FROM conjur:${VERSION}

RUN bundle --no-deployment --without ''
RUN ln -sf /src/conjur-server/bin/conjurctl /usr/local/bin/conjurctl
6 changes: 4 additions & 2 deletions Jenkinsfile
Expand Up @@ -24,9 +24,11 @@ pipeline {
stage('Test Docker image') {
steps {
sh './test.sh'

junit 'spec/reports/*.xml,cucumber/api/features/reports/**/*.xml,cucumber/policy/features/reports/**/*.xml,scaling_features/reports/**/*.xml,reports/*.xml'
}
post { always {
junit 'spec/reports/*.xml,cucumber/api/features/reports/**/*.xml,cucumber/policy/features/reports/**/*.xml'
publishHTML([reportDir: 'coverage', reportFiles: 'index.html', reportName: 'Coverage Report', reportTitles: '', allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false])
}}
}

stage('Push Docker image') {
Expand Down
13 changes: 5 additions & 8 deletions build.sh
Expand Up @@ -16,16 +16,13 @@ esac
shift # past argument or value
done

echo "Building conjur Docker image"
docker build -t conjur .
echo "Building image conjur:$TAG"
docker build -t "conjur:$TAG" .

echo "Tagging conjur:$TAG"
docker tag conjur "conjur:$TAG"

echo "Building test container"
docker build -t conjur-test -f Dockerfile.test .
echo "Building image conjur-test:$TAG container"
docker build --build-arg "VERSION=$TAG" -t "conjur-test:$TAG" -f Dockerfile.test .

if [[ $RUN_DEV = true ]]; then
echo "Building dev container"
echo "Building image conjur-dev"
docker build -t conjur-dev -f Dockerfile.dev .
fi
2 changes: 1 addition & 1 deletion push-image.sh
Expand Up @@ -7,7 +7,7 @@

TAG="${1:-$(< VERSION)-$(git rev-parse --short HEAD)}"

SOURCE_IMAGE='conjur'
SOURCE_IMAGE="conjur:$TAG"
INTERNAL_IMAGE='registry.tld/conjur'
INTERNAL_IMAGE_NEW='registry.tld/cyberark/conjur' # We'll transition to this
DOCKERHUB_IMAGE='cyberark/conjur'
Expand Down
10 changes: 6 additions & 4 deletions test.sh
@@ -1,12 +1,14 @@
#!/bin/bash -ex

TAG="$(< VERSION)-$(git rev-parse --short HEAD)"

function finish {
docker rm -f $pg_cid
docker rm -f $server_cid
}
trap finish EXIT

export CONJUR_DATA_KEY="$(docker run --rm conjur data-key generate)"
export CONJUR_DATA_KEY="$(docker run --rm conjur:$TAG data-key generate)"

pg_cid=$(docker run -d postgres:9.3)

Expand All @@ -18,7 +20,7 @@ server_cid=$(docker run -d \
--link $pg_cid:pg \
-e DATABASE_URL=postgres://postgres@pg/postgres \
-e RAILS_ENV=test \
conjur server)
conjur:$TAG server)

cat << "TEST" | docker run \
-i \
Expand All @@ -31,7 +33,7 @@ cat << "TEST" | docker run \
-e CONJUR_APPLIANCE_URL=http://conjur \
-e CONJUR_ADMIN_PASSWORD=admin \
--entrypoint bash \
conjur-test
conjur-test:$TAG
#!/bin/bash -ex
for i in $(seq 10); do
Expand All @@ -47,5 +49,5 @@ rm -rf spec/reports/*
rm -rf cucumber/api/features/reports/*
rm -rf cucumber/policy/features/reports/*
bundle exec rake jenkins || true
bundle exec rake jenkins
TEST

0 comments on commit e0ec479

Please sign in to comment.