extract cleanup from integration pipeline

Signed-off-by: Dave Goddard <dave@goddard.id.au>
This commit is contained in:
Keaty Gross 2016-09-29 14:47:44 -04:00 коммит произвёл Steel Toe Team
Родитель 996314bf0c
Коммит 25d00ca4ea
4 изменённых файлов: 45 добавлений и 40 удалений

Просмотреть файл

@ -7,7 +7,7 @@ Config files for Steeltoe CI, (https://ci.shoetree.io).
Change the files, then:
```bash
fly -t shoetree set-pipeline -l <(lpass show --notes 'Shared-Steeltoe/concourse.yml') -p integration -c pipelines/integration.yml
./update.sh
```
## Creating docker images

Просмотреть файл

@ -97,9 +97,6 @@ resources:
organization: integration
groups:
- name: misc
jobs:
- cleanup-pcfdev
- name: music-store
jobs:
- music-store-linux
@ -150,42 +147,6 @@ groups:
- discovery-net451
jobs:
- name: cleanup-pcfdev
plan:
- task: remove-all-spaces
config:
platform: linux
image_resource:
type: docker-image
source:
repository: dgodd/cf-cli
params:
CF_TARGET: {{pcfdev2_target}}
CF_USERNAME: {{pcfdev2_username}}
CF_PASSWORD: {{pcfdev2_password}}
CF_ORGANIZATION: integration
run:
path: sh
args:
- -ec
- |
cf login -a $CF_TARGET -u $CF_USERNAME -p $CF_PASSWORD --skip-ssl-validation -o system -s system
set -x
echo "Remove all integration spaces"
export SPACES=`cf curl "/v2/organizations?q=name%3A${CF_ORGANIZATION}&inline-relations-depth=1" | jq -r '.resources[].entity.spaces|sort_by(.metadata.created_at)|reverse|.[].metadata.guid'`
for space in $SPACES; do
echo $space
cf curl -X DELETE "/v2/spaces/$space?async=true&recursive=true"
done
echo "Remove all spring cloud service instances"
export APPS=`cf curl '/v2/organizations?q=name%3Ap-spring-cloud-services&inline-relations-depth=2' | jq -r '.resources[].entity.spaces[].entity|select(.name|contains("instances"))|.apps[].metadata.guid'`
for app in $APPS; do
echo $app
cf curl -X DELETE "/v2/apps/$app?async=true&recursive=true"
done
- name: postgres-efcore-linux
plan:
- get: steeltoe-ci

37
pipelines/misc.yml Normal file
Просмотреть файл

@ -0,0 +1,37 @@
---
jobs:
- name: cleanup-pcfdev
plan:
- task: remove-all-spaces
config:
platform: linux
image_resource:
type: docker-image
source:
repository: dgodd/cf-cli
params:
CF_TARGET: {{pcfdev2_target}}
CF_USERNAME: {{pcfdev2_username}}
CF_PASSWORD: {{pcfdev2_password}}
CF_ORGANIZATION: integration
run:
path: sh
args:
- -ec
- |
cf login -a $CF_TARGET -u $CF_USERNAME -p $CF_PASSWORD --skip-ssl-validation -o system -s system
set -x
echo "Remove all integration spaces"
export SPACES=`cf curl "/v2/organizations?q=name%3A${CF_ORGANIZATION}&inline-relations-depth=1" | jq -r '.resources[].entity.spaces|sort_by(.metadata.created_at)|reverse|.[].metadata.guid'`
for space in $SPACES; do
echo $space
cf curl -X DELETE "/v2/spaces/$space?async=true&recursive=true"
done
echo "Remove all spring cloud service instances"
export APPS=`cf curl '/v2/organizations?q=name%3Ap-spring-cloud-services&inline-relations-depth=2' | jq -r '.resources[].entity.spaces[].entity|select(.name|contains("instances"))|.apps[].metadata.guid'`
for app in $APPS; do
echo $app
cf curl -X DELETE "/v2/apps/$app?async=true&recursive=true"
done

7
update.sh Executable file
Просмотреть файл

@ -0,0 +1,7 @@
#!/usr/bin/env bash
for file in pipelines/*.yml; do
base=$(basename $file .yml)
echo $base
fly -t shoetree set-pipeline -l <(lpass show --notes 'Shared-Steeltoe/concourse.yml') -p $base -c $file
done