Use Toolsmith environment for running ATs

This commit is contained in:
Gareth Clay
2021-05-07 13:48:50 +01:00
committed by Gareth Clay
parent a781ffc728
commit bd84a35a8f
4 changed files with 64 additions and 26 deletions

View File

@@ -1,4 +1,4 @@
FROM ubuntu:bionic-20181018
FROM harbor-repo.vmware.com/dockerhub-proxy-cache/library/ubuntu:bionic
RUN apt-get update
RUN apt-get install --no-install-recommends -y ca-certificates net-tools git curl jq
@@ -12,3 +12,7 @@ RUN mkdir -p /opt/openjdk && \
ADD https://raw.githubusercontent.com/spring-io/concourse-java-scripts/v0.0.3/concourse-java.sh /opt/
ADD https://repo.spring.io/libs-release/io/spring/concourse/releasescripts/concourse-release-scripts/0.3.2/concourse-release-scripts-0.3.2.jar /opt/
RUN cd /usr/local/bin && curl -L https://github.com/cloudfoundry-incubator/credhub-cli/releases/download/2.9.0/credhub-linux-2.9.0.tgz | tar xz
RUN curl -L https://github.com/cloudfoundry/bosh-bootloader/releases/download/v8.4.40/bbl-v8.4.40_linux_x86-64 --output /usr/local/bin/bbl && \
chmod +x /usr/local/bin/bbl

View File

@@ -55,13 +55,24 @@ jobs:
- name: run-acceptance-tests
serial: true
plan:
- get: git-repo
passed: [build]
trigger: true
# - task: acceptance-tests
# file: git-repo/ci/tasks/acceptance-tests.yml
- in_parallel:
- get: git-repo
passed: [build]
trigger: true
- put: toolsmith-env
inputs: []
params:
action: claim
- task: acceptance-tests
file: git-repo/ci/tasks/acceptance-tests.yml
on_success:
*slack-success-notification
in_parallel:
- *slack-success-notification
- put: toolsmith-env
params:
action: unclaim
env_file: toolsmith-env/metadata
inputs: [toolsmith-env]
on_failure:
*slack-failure-notification
@@ -224,12 +235,10 @@ resource_types:
repository: ((dockerhub-mirror-registry))/cfcommunity/slack-notification-resource
tag: latest
- name: docker-image-mirror
- name: pcf-pool
type: registry-image
privileged: true
source:
repository: ((dockerhub-mirror-registry))/concourse/docker-image-resource
tag: latest
repository: ((dockerhub-mirror-registry))/cftoolsmiths/toolsmiths-envs-resource
resources:
- name: git-repo
@@ -258,7 +267,7 @@ resources:
paths: ["ci/images/*"]
- name: release-ci-image
type: docker-image-mirror
type: docker-image
source:
repository: ((corporate-harbor-registry))/((dockerhub-organization))/release-ci-image
username: ((corporate-harbor-robot-account.username))
@@ -278,6 +287,14 @@ resources:
source:
url: ((scs-slack-webhook))
- name: toolsmith-env
type: pcf-pool
icon: pool
source:
api_token: ((toolsmith-api-token))
hostname: environments.toolsmiths.cf-app.com
pool_name: cf-deployment
groups:
- name: "build"
jobs:

View File

@@ -2,17 +2,36 @@
set -euo pipefail
readonly API_HOST="${API_HOST:?must be set}"
readonly API_PORT="${API_PORT:?must be set}"
readonly USERNAME="${USERNAME:?must be set}"
readonly PASSWORD="${PASSWORD:?must be set}"
readonly CLIENT_ID="${CLIENT_ID:?must be set}"
readonly CLIENT_SECRET="${CLIENT_SECRET:?must be set}"
readonly TOOLSMITH_ENV_INPUT="${TOOLSMITH_ENV_INPUT:?must be set}"
readonly DEFAULT_ORG="${DEFAULT_ORG:?must be set}"
readonly DEFAULT_SPACE="${DEFAULT_SPACE:?must be set}"
readonly SKIP_SSL_VALIDATION="${SKIP_SSL_VALIDATION:?must be set}"
readonly ONLY_SHOW_STANDARD_STREAMS_ON_TEST_FAILURE="${ONLY_SHOW_STANDARD_STREAMS_ON_TEST_FAILURE:-true}"
declare API_HOST
readonly API_PORT=443
readonly USERNAME="admin"
declare PASSWORD
readonly CLIENT_ID="admin"
declare CLIENT_SECRET
discover_environment() {
local env_name
env_name=$(cat "$TOOLSMITH_ENV_INPUT/name")
eval "$(bbl print-env --metadata-file "$TOOLSMITH_ENV_INPUT/metadata")"
credhub login \
--client-name="$(jq -r .bosh.credhub_client < "$TOOLSMITH_ENV_INPUT/metadata")" \
--client-secret="$(jq -r .bosh.credhub_secret < "$TOOLSMITH_ENV_INPUT/metadata")" \
--server="$(jq -r .bosh.credhub_server < "$TOOLSMITH_ENV_INPUT/metadata")" \
--ca-cert="$(jq -r .bosh.credhub_ca_cert < "$TOOLSMITH_ENV_INPUT/metadata")"
API_HOST="$(jq -r .cf.api_url < "$TOOLSMITH_ENV_INPUT/metadata")"
PASSWORD="$(credhub get -n "/bosh-${env_name}/cf/cf_admin_password" -q)"
CLIENT_SECRET="$(credhub get -n "/bosh-${env_name}/cf/uaa_admin_client_secret" -q)"
}
run_tests() {
export SPRING_CLOUD_APPBROKER_ACCEPTANCETEST_CLOUDFOUNDRY_API_HOST="${API_HOST}"
export SPRING_CLOUD_APPBROKER_ACCEPTANCETEST_CLOUDFOUNDRY_API_PORT="${API_PORT}"
@@ -30,6 +49,8 @@ run_tests() {
}
main() {
discover_environment
echo "Running tests against $API_HOST"
echo

View File

@@ -3,19 +3,15 @@ platform: linux
image_resource:
type: registry-image
source:
repository: openjdk
tag: 8
repository: ((corporate-harbor-registry))/((dockerhub-organization))/release-ci-image
tag: ((release-image-tag))
inputs:
- name: git-repo
- name: toolsmith-env
run:
path: git-repo/ci/scripts/acceptance-tests.sh
params:
API_HOST: ((acceptance-test-api-host))
API_PORT: ((acceptance-test-api-port))
USERNAME: ((acceptance-test-username))
PASSWORD: ((acceptance-test-password))
CLIENT_ID: ((acceptance-test-client-id))
CLIENT_SECRET: ((acceptance-test-client-secret))
TOOLSMITH_ENV_INPUT: toolsmith-env
DEFAULT_ORG: ((acceptance-test-default-org))
DEFAULT_SPACE: ((acceptance-test-default-space))
SKIP_SSL_VALIDATION: ((acceptance-test-skip-ssl-validation))