Adding concourse pipeline for ATs
This commit is contained in:
committed by
Alberto Ríos
parent
f0d9c53de6
commit
283819aeec
3
.gitignore
vendored
3
.gitignore
vendored
@@ -21,4 +21,5 @@ director-vars-file.yml
|
||||
bbl-env.sh
|
||||
bbl-env-creds.sh
|
||||
bosh-env-*/
|
||||
*key.json
|
||||
*key.json
|
||||
secrets.yml
|
||||
3
ci/config-concourse.yml
Normal file
3
ci/config-concourse.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
app-broker-github-url: https://github.com/spring-cloud/spring-cloud-app-broker
|
||||
app-broker-git-branch-current: master
|
||||
scs-slack-failure-channel: "#sc-app-broker"
|
||||
60
ci/pipeline.yml
Normal file
60
ci/pipeline.yml
Normal file
@@ -0,0 +1,60 @@
|
||||
---
|
||||
aliases:
|
||||
- &slack-failure-notification
|
||||
put: alert
|
||||
params:
|
||||
icon_emoji: ":animal:"
|
||||
username: concourse
|
||||
channel: {{scs-slack-failure-channel}}
|
||||
text: <!here> Build <https://scs.ci.springapps.io/builds/$BUILD_ID|$BUILD_NAME> of job $BUILD_JOB_NAME in the $BUILD_PIPELINE_NAME pipeline has failed!
|
||||
|
||||
jobs:
|
||||
- name: build
|
||||
plan:
|
||||
- get: app-broker
|
||||
trigger: true
|
||||
- task: build
|
||||
file: app-broker/ci/tasks/build.yml
|
||||
on_failure:
|
||||
*slack-failure-notification
|
||||
|
||||
- name: run-acceptance-tests
|
||||
serial: true
|
||||
disable_manual_trigger: true
|
||||
plan:
|
||||
- get: app-broker
|
||||
passed: [build]
|
||||
trigger: true
|
||||
- task: acceptance-tests
|
||||
file: app-broker/ci/tasks/acceptance-tests.yml
|
||||
params:
|
||||
API_HOST: {{API_HOST}}
|
||||
API_PORT: {{API_PORT}}
|
||||
USERNAME: {{USERNAME}}
|
||||
PASSWORD: {{PASSWORD}}
|
||||
CLIENT_ID: {{CLIENT_ID}}
|
||||
CLIENT_SECRET: {{CLIENT_SECRET}}
|
||||
DEFAULT_ORG: {{DEFAULT_ORG}}
|
||||
DEFAULT_SPACE: {{DEFAULT_SPACE}}
|
||||
SKIP_SSL_VALIDATION: {{SKIP_SSL_VALIDATION}}
|
||||
on_failure:
|
||||
*slack-failure-notification
|
||||
|
||||
resource_types:
|
||||
- name: slack-notification
|
||||
type: docker-image
|
||||
source:
|
||||
repository: cfcommunity/slack-notification-resource
|
||||
tag: latest
|
||||
|
||||
resources:
|
||||
- name: app-broker
|
||||
type: git
|
||||
source:
|
||||
uri: {{app-broker-github-url}}
|
||||
branch: {{app-broker-git-branch-current}}
|
||||
|
||||
- name: alert
|
||||
type: slack-notification
|
||||
source:
|
||||
url: {{scs-slack-webhook}}
|
||||
35
ci/scripts/set-pipelines.sh
Executable file
35
ci/scripts/set-pipelines.sh
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
readonly SCS_SECRETS_LAST_PASS_ID="1938546022346916823"
|
||||
readonly SCS_ENVIRONMENT_LAST_PASS_ID="4685111791412820196"
|
||||
|
||||
secrets_file=$(mktemp).yml
|
||||
|
||||
fetch_secrets() {
|
||||
lpass show --notes "${SCS_ENVIRONMENT_LAST_PASS_ID}" > "${secrets_file}"
|
||||
lpass show --notes "${SCS_SECRETS_LAST_PASS_ID}" >> "${secrets_file}"
|
||||
}
|
||||
|
||||
set_app_broker_pipeline() {
|
||||
echo "Setting app-broker-1.0.x pipeline..."
|
||||
fly -t scs set-pipeline -p app-broker-1.0.x -c pipeline.yml -l config-concourse.yml -l "${secrets_file}"
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
rm "${secrets_file}"
|
||||
}
|
||||
|
||||
trap "cleanup" EXIT
|
||||
|
||||
main() {
|
||||
fly -t scs sync
|
||||
|
||||
pushd "$(dirname $0)/.." > /dev/null
|
||||
fetch_secrets
|
||||
set_app_broker_pipeline
|
||||
popd > /dev/null
|
||||
}
|
||||
|
||||
main
|
||||
40
ci/tasks/acceptance-tests.sh
Executable file
40
ci/tasks/acceptance-tests.sh
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
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 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}"
|
||||
|
||||
build() {
|
||||
./gradlew assemble -x test
|
||||
}
|
||||
|
||||
run_tests() {
|
||||
export SPRING_CLOUD_APPBROKER_ACCEPTANCETEST_CLOUDFOUNDRY_API_HOST="${API_HOST}"
|
||||
export SPRING_CLOUD_APPBROKER_ACCEPTANCETEST_CLOUDFOUNDRY_API_PORT="${API_PORT}"
|
||||
export SPRING_CLOUD_APPBROKER_ACCEPTANCETEST_CLOUDFOUNDRY_USERNAME="${USERNAME}"
|
||||
export SPRING_CLOUD_APPBROKER_ACCEPTANCETEST_CLOUDFOUNDRY_PASSWORD="${PASSWORD}"
|
||||
export SPRING_CLOUD_APPBROKER_ACCEPTANCETEST_CLOUDFOUNDRY_CLIENT_ID="${CLIENT_ID}"
|
||||
export SPRING_CLOUD_APPBROKER_ACCEPTANCETEST_CLOUDFOUNDRY_CLIENT_SECRET="${CLIENT_SECRET}"
|
||||
export SPRING_CLOUD_APPBROKER_ACCEPTANCETEST_CLOUDFOUNDRY_DEFAULT_ORG="${DEFAULT_ORG}"
|
||||
export SPRING_CLOUD_APPBROKER_ACCEPTANCETEST_CLOUDFOUNDRY_DEFAULT_SPACE="${DEFAULT_SPACE}"
|
||||
export SPRING_CLOUD_APPBROKER_ACCEPTANCETEST_CLOUDFOUNDRY_SKIP_SSL_VALIDATION="${SKIP_SSL_VALIDATION}"
|
||||
export TESTS_BROKERAPPPATH=build/libs/spring-cloud-app-broker-acceptance-tests.jar
|
||||
./gradlew clean assemble check -PacceptanceTests -b spring-cloud-app-broker-acceptance-tests/build.gradle
|
||||
}
|
||||
|
||||
main() {
|
||||
pushd "app-broker" > /dev/null
|
||||
build
|
||||
run_tests
|
||||
popd > /dev/null
|
||||
}
|
||||
|
||||
main
|
||||
25
ci/tasks/acceptance-tests.yml
Normal file
25
ci/tasks/acceptance-tests.yml
Normal file
@@ -0,0 +1,25 @@
|
||||
---
|
||||
platform: linux
|
||||
|
||||
image_resource:
|
||||
type: docker-image
|
||||
source:
|
||||
repository: openjdk
|
||||
tag: 8
|
||||
|
||||
inputs:
|
||||
- name: app-broker
|
||||
|
||||
run:
|
||||
path: app-broker/ci/tasks/acceptance-tests.sh
|
||||
|
||||
params:
|
||||
API_HOST:
|
||||
API_PORT:
|
||||
USERNAME:
|
||||
PASSWORD:
|
||||
CLIENT_ID:
|
||||
CLIENT_SECRET:
|
||||
DEFAULT_ORG:
|
||||
DEFAULT_SPACE:
|
||||
SKIP_SSL_VALIDATION:
|
||||
15
ci/tasks/build.sh
Executable file
15
ci/tasks/build.sh
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
build() {
|
||||
./gradlew --no-daemon --no-parallel check
|
||||
}
|
||||
|
||||
main() {
|
||||
pushd "app-broker" > /dev/null
|
||||
build
|
||||
popd > /dev/null
|
||||
}
|
||||
|
||||
main
|
||||
14
ci/tasks/build.yml
Normal file
14
ci/tasks/build.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
---
|
||||
platform: linux
|
||||
|
||||
image_resource:
|
||||
type: docker-image
|
||||
source:
|
||||
repository: openjdk
|
||||
tag: 8
|
||||
|
||||
inputs:
|
||||
- name: app-broker
|
||||
|
||||
run:
|
||||
path: app-broker/ci/tasks/build.sh
|
||||
@@ -12,7 +12,6 @@ The tests require the following properties to be set:
|
||||
|
||||
* `spring.cloud.appbroker.acceptance-test.cloudfoundry.api-host` - The CF API host where the tests are going to run.
|
||||
* `spring.cloud.appbroker.acceptance-test.cloudfoundry.api-port` - The CF API port where the tests are going to run.
|
||||
* `spring.cloud.appbroker.acceptance-test.cloudfoundry.apps-domain` - The CF apps domain where the tests are going to run.
|
||||
* `spring.cloud.appbroker.acceptance-test.cloudfoundry.default-org` - The CF organization where the tests are going to run.
|
||||
* `spring.cloud.appbroker.acceptance-test.cloudfoundry.default-space` - The CF space where the tests are going to run.
|
||||
* `spring.cloud.appbroker.acceptance-test.cloudfoundry.skip-ssl-validation` - If SSL validation should be skipped.
|
||||
@@ -34,9 +33,11 @@ Also, the flag acceptanceTests must be provided as `-PacceptanceTests`.
|
||||
$ ./gradlew test -PacceptanceTests \
|
||||
-Dspring.cloud.appbroker.acceptance-test.cloudfoundry.api-host=api.cf.my.cf.io \
|
||||
-Dspring.cloud.appbroker.acceptance-test.cloudfoundry.api-port=443 \
|
||||
-Dspring.cloud.appbroker.acceptance-test.cloudfoundry.username=admin \
|
||||
-Dspring.cloud.appbroker.acceptance-test.cloudfoundry.password=password \
|
||||
-Dspring.cloud.appbroker.acceptance-test.cloudfoundry.default-org=test \
|
||||
-Dspring.cloud.appbroker.acceptance-test.cloudfoundry.default-space=development \
|
||||
-Dspring.cloud.appbroker.acceptance-test.cloudfoundry.skip-ssl-validation=true
|
||||
-Dspring.cloud.appbroker.acceptance-test.cloudfoundry.skip-ssl-validation=true \
|
||||
-Dspring.cloud.appbroker.acceptance-test.cloudfoundry.username=admin \
|
||||
-Dspring.cloud.appbroker.acceptance-test.cloudfoundry.password=password \
|
||||
-Dspring.cloud.appbroker.acceptance-test.cloudfoundry.client-id=admin \
|
||||
-Dspring.cloud.appbroker.acceptance-test.cloudfoundry.client-secret=secret
|
||||
----
|
||||
@@ -54,7 +54,7 @@ bootJar {
|
||||
}
|
||||
|
||||
test {
|
||||
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
|
||||
maxParallelForks = Runtime.runtime.availableProcessors() - 1 ?: 1
|
||||
|
||||
// Only run the tests if acceptanceTests is specified
|
||||
onlyIf {
|
||||
|
||||
Reference in New Issue
Block a user