Sha256: 2b83363794f01d4dbf8011beac9f6146365e767e379d2b579fc40ff9a7038c22

Contents?: true

Size: 1.93 KB

Versions: 3

Compression:

Stored size: 1.93 KB

Contents

#!/bin/bash -e

function finish {
  echo 'Removing test environment'
  echo '---'
  docker-compose down --rmi 'local' --volumes
}

trap finish EXIT

function publishToCodeClimate() {
  docker build -f ci/codeclimate.dockerfile -t cyberark/code-climate:latest .
  docker run \
    --rm \
    -e GIT_BRANCH \
    -e GIT_COMMIT \
    -e TRID \
    --volume "$PWD:/src/conjur-api" \
    -w "/src/conjur-api" \
    cyberark/code-climate:latest \
      after-build \
        -r "$(<TRID)" \
        -t "simplecov"
}

function main() {
  # Generate reports folders locally
  mkdir -p spec/reports features/reports features_v4/reports

  startConjur
  runTests_5
  runTests_4
  publishToCodeClimate
}

function startConjur() {
  echo 'Starting Conjur environment'
  echo '-----'

  # We want to pull to make sure we're testing against the newest release;
  # failing to ensure that has caused many mysterious failures in CI.
  # However, unconditionally pulling prevents working offline even
  # with a warm cache. So try to pull, but ignore failures.
  docker-compose pull --ignore-pull-failures

  docker-compose build
  docker-compose up -d pg conjur_4 conjur_5
}

function runTests_5() {
  echo 'Waiting for Conjur v5 to come up, and configuring it...'
  ./ci/configure_v5.sh

  local api_key=$(docker-compose exec -T conjur_5 rake 'role:retrieve-key[cucumber:user:admin]')

  echo 'Running tests'
  echo '-----'
  docker-compose run --rm \
    -e CONJUR_AUTHN_API_KEY="$api_key" \
    tester_5 rake jenkins_init jenkins_spec jenkins_cucumber_v5
}

function runTests_4() {
  echo 'Waiting for Conjur v4 to come up, and configuring it...'
  ./ci/configure_v4.sh

  local api_key=$(docker-compose exec -T conjur_4 su conjur -c "conjur-plugin-service authn env RAILS_ENV=appliance rails r \"puts User['admin'].api_key\" 2>/dev/null")

  echo 'Running tests'
  echo '-----'
  docker-compose run --rm \
    -e CONJUR_AUTHN_API_KEY="$api_key" \
    tester_4 rake jenkins_cucumber_v4
}

main

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
conjur-api-5.3.5 test.sh
conjur-api-5.3.4 test.sh
conjur-api-5.3.3 test.sh