This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
myappziugv/.bluemix/pipeline.yml

89 lines
2.0 KiB
YAML

---
stages:
- name: Build Stage
inputs:
- type: git
branch: master
service: ${REPO}
properties:
- name: CF_HOSTNAME
value: "${CF_HOSTNAME}"
type: text
- name: CF_DOMAIN
value: "${CF_DOMAIN}"
type: text
triggers:
- type: commit
jobs:
- name: Build
type: builder
artifact_dir: ''
build_type: shell
script: |-
#!/bin/bash
if [[ -f post_build.sh ]]; then
chmod +x post_build.sh;
echo "executing the post_build script";
sh post_build.sh;
else
echo "the post_build script does not exist";
fi
- name: Deploy Stage
inputs:
- type: job
stage: Build Stage
job: Build
properties:
- name: CF_HOSTNAME
value: "${CF_HOSTNAME}"
type: text
- name: CF_DOMAIN
value: "${CF_DOMAIN}"
type: text
triggers:
- type: stage
jobs:
- name: Deploy
type: deployer
target:
region_id: ${REGION_ID}
organization: ${CF_ORGANIZATION}
space: ${CF_SPACE}
application: ${CF_APP}
api_key: ${API_KEY}
script: |-
#!/bin/bash
cf push "${CF_APP}" --hostname "${CF_HOSTNAME}" -d "${CF_DOMAIN}"
# cf logs "${CF_APP}" --recent
- name: Health Stage
inputs:
- type: job
stage: Build Stage
job: Build
triggers:
- type: stage
permission:
execute: TOOLCHAIN_ADMINS
properties:
- name: CF_HOSTNAME
value: "${CF_HOSTNAME}"
type: text
- name: CF_DOMAIN
value: "${CF_DOMAIN}"
type: text
jobs:
- name: Test
type: tester
script: |-
#!/bin/sh
apk add --no-cache curl
if [ "$(curl -is http://not-used.not-used.net/health --connect-timeout 3 --max-time 5 --retry 3 --retry-max-time 30 | head -n 1 | grep 200)" != "" ]; then
echo "Successfully reached health endpoint"
echo "====================================================================="
else
echo "Could not reach health endpoint: http://not-used.not-used.net/health"
exit 1;
fi;
test_type: customimage
docker_image: alpine