Create test orgs and spaces before ATs run

* Also remove unnecessary `credhub login` step
This commit is contained in:
Gareth Clay
2021-05-07 16:57:07 +01:00
parent 2cf7747b1c
commit 57799f71a7
3 changed files with 24 additions and 8 deletions

View File

@@ -1,7 +1,11 @@
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
RUN apt-get update && apt-get install --no-install-recommends -y ca-certificates net-tools git curl jq gnupg
RUN curl -L https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | apt-key add -
RUN echo "deb https://packages.cloudfoundry.org/debian stable main" | tee /etc/apt/sources.list.d/cloudfoundry-cli.list
RUN apt-get update && apt-get install cf-cli
RUN rm -rf /var/lib/apt/lists/*
ENV JAVA_HOME /opt/openjdk
@@ -14,5 +18,6 @@ ADD https://raw.githubusercontent.com/spring-io/concourse-java-scripts/v0.0.3/co
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

@@ -65,6 +65,8 @@ jobs:
action: claim
- task: acceptance-tests
file: git-repo/ci/tasks/acceptance-tests.yml
vars:
release-image-tag: ((release-image-tag))
on_success:
in_parallel:
- *slack-success-notification

View File

@@ -21,17 +21,24 @@ discover_environment() {
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)"
}
prepare_environment() {
local test_instances_org
test_instances_org="$DEFAULT_ORG-instances"
cf login -a "$API_HOST" -u "$USERNAME" -p "$PASSWORD" -o system --skip-ssl-validation "$SKIP_SSL_VALIDATION"
cf create-org "$DEFAULT_ORG"
cf create-space "$DEFAULT_SPACE" -o "$DEFAULT_ORG"
cf create-org "$test_instances_org"
cf create-space "$DEFAULT_SPACE" -o "$test_instances_org"
}
run_tests() {
export SPRING_CLOUD_APPBROKER_ACCEPTANCETEST_CLOUDFOUNDRY_API_HOST="${API_HOST}"
export SPRING_CLOUD_APPBROKER_ACCEPTANCETEST_CLOUDFOUNDRY_API_PORT="${API_PORT}"
@@ -54,6 +61,8 @@ main() {
echo "Running tests against $API_HOST"
echo
prepare_environment
pushd "git-repo" > /dev/null
run_tests
popd > /dev/null