Created
October 24, 2016 18:47
-
-
Save jabley/0eb1bc67ef877616ea9e029e994c1070 to your computer and use it in GitHub Desktop.
Concourse Deployment pipeline
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
platform: linux | |
image_resource: | |
type: docker-image | |
source: | |
repository: maven | |
tag: latest | |
inputs: | |
- name: git-repo | |
- name: version | |
outputs: | |
- name: artifact-dir | |
run: | |
path: sh | |
args: | |
- -c | |
- | | |
mvn -f git-repo/pom.xml -Dmaven.test.skip=true package | |
cp git-repo/target/*.war artifact-dir/`basename git-repo/target/*.war .war`-`cat version/number`.war | |
params: | |
TERM: -dumb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource_types: | |
- name: slack-notification | |
type: docker-image | |
source: | |
repository: cfcommunity/slack-notification-resource | |
tag: latest | |
- name: pull-request | |
type: docker-image | |
source: | |
repository: jtarchie/pr | |
jobs: | |
- name: deploy-to-prod | |
plan: | |
- do: | |
- aggregate: | |
- get: master-repo | |
passed: [deploy-to-stage] | |
- get: release-candidate | |
passed: [deploy-to-stage] | |
- put: deploy-app-cloudfoundry-prod | |
params: | |
current_app_name: {{PROD_APP_NAME}} | |
manifest: master-repo/infra/cloud-foundry/manifests/prod/prod-manifest.yml | |
path: release-candidate/*.war | |
on_failure: | |
put: slack-alert | |
params: | |
silent: true | |
text: Build failed - $BUILD_PIPELINE_NAME on $BUILD_JOB_NAME job. <$ATC_EXTERNAL_URL/teams/the-team/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME|Click here> for details! | |
username: Concourse | |
icon_emoji: ":facepalm:" | |
- name: deploy-to-stage | |
plan: | |
- do: | |
- get: master-repo | |
trigger: true | |
- task: unit | |
file: master-repo/infra/concourse/tasks/unit.yml | |
input_mapping: {git-repo: master-repo} | |
- get: version | |
params: | |
bump: patch | |
- task: package | |
file: master-repo/infra/concourse/tasks/build-artifact.yml | |
input_mapping: {git-repo: master-repo} | |
- put: version | |
params: | |
file: version/number | |
- put: release-candidate | |
params: | |
file: artifact-dir/*.war | |
- put: deploy-app-cloudfoundry-stage | |
params: | |
current_app_name: {{STAGE_APP_NAME}} | |
manifest: master-repo/infra/cloud-foundry/manifests/dev/stage-manifest.yml | |
path: artifact-dir/*.war | |
on_failure: | |
put: slack-alert | |
params: | |
silent: true | |
text: Build failed - $BUILD_PIPELINE_NAME on $BUILD_JOB_NAME job. <$ATC_EXTERNAL_URL/teams/the-team/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME|Click here> for details! | |
username: Concourse | |
icon_emoji: ":facepalm:" | |
- name: deploy-to-dev | |
plan: | |
- do: | |
- get: develop-repo | |
trigger: true | |
- get: version | |
- task: unit | |
file: develop-repo/infra/concourse/tasks/unit.yml | |
input_mapping: {git-repo: develop-repo} | |
- task: package | |
file: develop-repo/infra/concourse/tasks/build-artifact.yml | |
input_mapping: {git-repo: develop-repo} | |
- put: deploy-app-cloudfoundry-dev | |
params: | |
current_app_name: {{DEV_APP_NAME}} | |
manifest: develop-repo/infra/cloud-foundry/manifests/dev/dev-manifest.yml | |
path: artifact-dir/*.war | |
on_failure: | |
put: slack-alert | |
params: | |
silent: true | |
text: Build failed - $BUILD_PIPELINE_NAME on $BUILD_JOB_NAME job. <$ATC_EXTERNAL_URL/teams/the-team/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME|Click here> for details! | |
username: Concourse | |
icon_emoji: ":facepalm:" | |
- name: test-pull-request | |
plan: | |
- get: pr | |
trigger: true | |
- put: pr | |
params: | |
path: pr | |
status: pending | |
- task: unit | |
file: pr/infra/concourse/tasks/unit.yml | |
input_mapping: {git-repo: pr} | |
on_failure: | |
do: | |
- put: pr | |
params: | |
path: pr | |
status: failure | |
- put: slack-alert | |
params: | |
silent: true | |
text: Build failed - $BUILD_PIPELINE_NAME on $BUILD_JOB_NAME job. <$ATC_EXTERNAL_URL/teams/the-team/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME|Click here> for details! | |
username: Concourse | |
icon_emoji: ":facepalm:" | |
- put: pr | |
params: | |
path: pr | |
status: success | |
resources: | |
- name: master-repo | |
type: git | |
source: | |
uri: {{GIT_REPO}} | |
branch: master | |
private_key: {{GIT_PRIVATE_KEY}} | |
- name: develop-repo | |
type: git | |
source: | |
uri: {{GIT_REPO}} | |
branch: develop | |
private_key: {{GIT_PRIVATE_KEY}} | |
- name: pr | |
type: pull-request | |
source: | |
repo: my-org/my-repo-name | |
access_token: {{GIT_ACCESS_TOKEN}} | |
uri: {{GIT_REPO}} | |
private_key: {{GIT_PRIVATE_KEY}} | |
# Since Concourse is stateless, we need a way of storing state and using | |
# them in manually trigger parts of our deployment process. | |
# Here, we're using S3 to keep a semver file | |
- name: version | |
type: semver | |
source: | |
bucket: {{S3_BUCKET}} | |
key: {{CURRENT_VERSION_RESOURCE}} | |
region_name: {{S3_REGION}} | |
access_key_id: {{S3_ACCESS_KEY_ID}} | |
secret_access_key: {{S3_SECRET_ACCESS_KEY}} | |
initial_version: 1.0.0 | |
# Here, we're using S3 to store release candidate artifacts (*.war) | |
- name: release-candidate | |
type: s3 | |
source: | |
bucket: {{S3_BUCKET}} | |
regexp: {{RELEASE_CANDIDATE_REGEX}} | |
region_name: {{S3_REGION}} | |
access_key_id: {{S3_ACCESS_KEY_ID}} | |
secret_access_key: {{S3_SECRET_ACCESS_KEY}} | |
- name: deploy-app-cloudfoundry-dev | |
type: cf | |
source: | |
api: {{CF_API}} | |
username: {{CF_USER}} | |
password: {{CF_PASS}} | |
organization: {{CF_ORG}} | |
space: {{CF_DEV_SPACE}} | |
- name: deploy-app-cloudfoundry-stage | |
type: cf | |
source: | |
api: {{CF_API}} | |
username: {{CF_USER}} | |
password: {{CF_PASS}} | |
organization: {{CF_ORG}} | |
space: {{CF_DEV_SPACE}} | |
- name: deploy-app-cloudfoundry-prod | |
type: cf | |
source: | |
api: {{CF_API}} | |
username: {{CF_USER}} | |
password: {{CF_PASS}} | |
organization: {{CF_ORG}} | |
space: {{CF_PROD_SPACE}} | |
- name: slack-alert | |
type: slack-notification | |
source: | |
url: {{SLACK_HOOK}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
platform: linux | |
image_resource: | |
type: docker-image | |
source: | |
repository: maven | |
tag: latest | |
inputs: | |
- name: git-repo | |
run: | |
path: sh | |
args: | |
- -c | |
- | | |
mvn -f git-repo/pom.xml test | |
params: | |
TERM: -dumb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See also https://flic.kr/p/MtPbPH