Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Fix Possum branch CI build #182

Merged
merged 10 commits into from Sep 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile
Expand Up @@ -10,7 +10,7 @@ COPY conjur-cli.gemspec conjur-cli.gemspec
COPY lib/conjur/version.rb lib/conjur/version.rb

# Make sure only one version of bundler is available
RUN gem uninstall bundler -i /usr/local/lib/ruby/gems/${RUBY_VERSION}.0 bundler || true && \
gem uninstall bundler -aIx && \
RUN gem uninstall bundler -i /usr/local/lib/ruby/gems/${RUBY_VERSION} bundler || true && \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we have to run gem uninstall bundler twice here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, but it looks like it's once for the currently selected gemset and once for the version-specific gemset. No idea why this is necessary. Could try without the latter, perhaps.

gem uninstall bundler -aIx || true && \
gem install bundler -v 1.11.2 && \
bundle install
2 changes: 1 addition & 1 deletion Gemfile
Expand Up @@ -8,4 +8,4 @@ gemspec

gem 'activesupport', '~> 4.2'

gem 'conjur-api', git: 'https://github.com/conjurinc/api-ruby.git', branch: 'possum'
gem 'conjur-api', '~> 5'
33 changes: 13 additions & 20 deletions Jenkinsfile
Expand Up @@ -3,51 +3,45 @@ pipeline {

options {
timestamps()
buildDiscarder(logRotator(numToKeepStr: '30'))
}
buildDiscarder(logRotator(daysToKeepStr: '30'))
}

stages {
stage('Test 2.2') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should run these stages in parallel. I can add a commit to this PR showing how.

environment {
RUBY_VERSION = '2.2'
RUBY_VERSION = '2.2.8'
}

steps {
milestone(1)

sh './test.sh'

junit 'spec/reports/*.xml, features/reports/*.xml'
}
}

stage('Test 2.3') {
environment {
RUBY_VERSION = '2.3'
RUBY_VERSION = '2.3.5'
}

steps {
sh './test.sh'

junit 'spec/reports/*.xml, features/reports/*.xml'
}
}

stage('Test 2.4') {
environment {
RUBY_VERSION = '2.4'
RUBY_VERSION = '2.4.2'
}

steps {
sh './test.sh'

junit 'spec/reports/*.xml, features/reports/*.xml'
}
}

// Only publish to RubyGems if branch is 'master'
// AND someone confirms this stage within 5 minutes
stage('Publish to RubyGems?') {
agent { label 'releaser-v2' }

when {
allOf {
branch 'master'
Expand All @@ -72,20 +66,19 @@ pipeline {
}
}
steps {
milestone(2)
build(job: 'release-rubygems', parameters: [
string(name: 'GEM_NAME', value: 'conjur-api'),
string(name: 'GEM_BRANCH', value: "${env.BRANCH_NAME}")
])
milestone(3)
sh './publish.sh'
// Clean up this workspace
sh 'docker run -i --rm -v $PWD:/src -w /src alpine/git clean -fxd'
deleteDir()
}
}
}

post {
always {
sh 'docker run -i --rm -v $PWD:/src -w /src alpine/git clean -fxd'
}
deleteDir()
}
failure {
slackSend(color: 'danger', message: "${env.JOB_NAME} #${env.BUILD_NUMBER} FAILURE (<${env.BUILD_URL}|Open>)")
}
Expand Down
2 changes: 1 addition & 1 deletion lib/conjur/version.rb
Expand Up @@ -19,6 +19,6 @@
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
module Conjur
VERSION = '6.0.0.pre'
VERSION = '6.0.0.rc1'
::Version=VERSION
end
7 changes: 4 additions & 3 deletions publish.sh
@@ -1,6 +1,7 @@
#!/bin/bash -e

distribution=$1
component=${2:-`echo $GIT_BRANCH | sed 's/^origin\///' | tr '/' '.'`}
docker pull registry.tld/conjurinc/publish-rubygem

exec summon -f ci/secrets/publish.yml ./ci/publish.sh $distribution $component
summon --yaml "RUBYGEMS_API_KEY: !var rubygems/api-key" \
docker run --rm --env-file @SUMMONENVFILE -v "$(pwd)":/opt/src \
registry.tld/conjurinc/publish-rubygem conjur-cli
17 changes: 9 additions & 8 deletions test.sh
@@ -1,12 +1,15 @@
#!/bin/bash -ex

: ${RUBY_VERSION=2.2}
: ${RUBY_VERSION=2.2.5}

# My local RUBY_VERSION is set to ruby-#.#.# so this allows running locally.
RUBY_VERSION=$(cut -d '-' -f 2 <<< $RUBY_VERSION)

main() {
build

start_possum

run_tests
}

Expand All @@ -15,19 +18,17 @@ main() {
build() {
# we can get rid of this once we upgrade to docker 17.06+
sed "s/\${RUBY_VERSION}/$RUBY_VERSION/" Dockerfile > Dockerfile.$RUBY_VERSION

docker-compose build --pull

docker-compose build --pull
}

start_possum() {
docker-compose pull pg possum

docker-compose pull pg possum

env CONJUR_DATA_KEY="$(docker-compose run -T --no-deps possum data-key generate)" \
docker-compose up -d possum
trap "docker-compose down" EXIT

docker-compose run test ci/wait_for_server.sh
}

Expand Down