Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

helm deploy in concourse pipeline using kite resource #95

Merged
merged 1 commit into from
Nov 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 55 additions & 37 deletions tpl/service/%output_path%/pipelines/review.yml.tt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,19 @@ resource_types:
source:
repository: jtarchie/pr

- name: kite
type: docker-image
source:
repository: heliostech/kite
tag: v0.2.0

resources:
- name: k8s
type: kite
source:
json_key: ((gcr_password))
kubeconfig: ((kubeconfig))

- name: <%= @name %>-repository
type: git
source:
Expand Down Expand Up @@ -68,7 +80,8 @@ jobs:
path: pull-requests
status: pending
- task: run-tests
file: pull-requests/<%= @output %>/pipelines/tasks/run-pr-tests.yml
image: <%= @name %>-image
file: pull-requests/<%= @output %>/pipelines/tasks/run-unit.yml
on_success:
do:
- put: pull-requests
Expand Down Expand Up @@ -119,16 +132,18 @@ jobs:
params:
build: <%= @name %>-repository
tag: tag/name
<% unless @slack.nil? or @slack.empty? -%>
- put: slack-alert
params:
channel: '#<%= @slack %>'
text: |
<%= @name %> master branch was built and pushed!
Check it out at:
$ATC_EXTERNAL_URL/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME
or at:
$ATC_EXTERNAL_URL/builds/$BUILD_ID
<% unless @slack.to_s.empty? -%>
on_success:
try:
put: slack-alert
params:
channel: '#<%= @slack %>'
text: |
<%= @name %> master branch was built and pushed!
Check it out at:
$ATC_EXTERNAL_URL/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME
or at:
$ATC_EXTERNAL_URL/builds/$BUILD_ID
<% end -%>

- name: master-unit
Expand All @@ -141,18 +156,20 @@ jobs:
passed: [master-build]
trigger: true
- task: run-tests
file: <%= @name %>-repository/<%= @output %>/pipelines/tasks/run-master-tests.yml
<% unless @slack.nil? or @slack.empty? -%>
image: <%= @name %>-image
file: <%= @name %>-repository/<%= @output %>/pipelines/tasks/run-unit.yml
<% unless @slack.to_s.empty? -%>
on_success:
put: slack-alert
params:
channel: '#<%= @slack %>'
text: |
<%= @name %> master tests have passed! :thumbsup_all:
Check it out at:
$ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME
or at:
$ATC_EXTERNAL_URL/builds/$BUILD_ID
try:
put: slack-alert
params:
channel: '#<%= @slack %>'
text: |
<%= @name %> master tests have passed! :thumbsup_all:
Check it out at:
$ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME
or at:
$ATC_EXTERNAL_URL/builds/$BUILD_ID

on_failure:
put: slack-alert
Expand All @@ -166,24 +183,25 @@ jobs:
$ATC_EXTERNAL_URL/builds/$BUILD_ID
<% end -%>

- name: helm-deploy
- name: master-deploy
serial: true
plan:
- get: <%= @name %>-repository
- task: helm-deploy
file: <%= @name %>-repository/<%= @output %>/pipelines/tasks/helm-deploy.yml
passed: [master-unit]
trigger: true
- put: k8s
params:
GOOGLE_APPLICATION_JSON: ((gcr_password))
KUBECONFIG_FILE: ((kubeconfig))
<% unless @slack.nil? or @slack.empty? -%>
command: "bash -xc 'cd /tmp/build/put/<%= @name %>-repository && VERSION=$(git rev-parse --short=8 HEAD) make deploy'"
<% unless @slack.to_s.empty? -%>
on_success:
put: slack-alert
params:
channel: '#<%= @slack %>'
text: |
<%= @name %> deployment has succeeded! :thumbsup_all:
Check it out at:
$ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME
or at:
$ATC_EXTERNAL_URL/builds/$BUILD_ID
try:
put: slack-alert
params:
channel: '#<%= @slack %>'
text: |
<%= @name %> deployment has succeeded! :thumbsup_all:
Check it out at:
$ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME
or at:
$ATC_EXTERNAL_URL/builds/$BUILD_ID
<% end -%>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ platform: linux
image_resource:
type: docker-image
source:
repository: alpine/git
repository: heliostech/kite
run:
path: sh
args: ['-xc', 'cd pull-requests && git rev-parse --short=8 HEAD > ../tag/name']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ platform: linux
image_resource:
type: docker-image
source:
repository: alpine/git
repository: heliostech/kite
run:
path: sh
args: ['-xc', 'cd <%= @name %>-repository && git rev-parse --short=8 HEAD > ../tag/name']
Expand Down
22 changes: 0 additions & 22 deletions tpl/service/%output_path%/pipelines/tasks/helm-deploy.yml.tt

This file was deleted.

12 changes: 0 additions & 12 deletions tpl/service/%output_path%/pipelines/tasks/run-master-tests.yml.tt

This file was deleted.

12 changes: 0 additions & 12 deletions tpl/service/%output_path%/pipelines/tasks/run-pr-tests.yml.tt

This file was deleted.

7 changes: 7 additions & 0 deletions tpl/service/%output_path%/pipelines/tasks/run-unit.yml.tt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
platform: linux

run:
path: sh
args: ["-exc", "cd /app && npm test"]

2 changes: 1 addition & 1 deletion tpl/service/Makefile.tt
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ ci:
@fly -t ci set-pipeline -p <%= @name %> -c <%= @output %>/pipelines/review.yml -n
@fly -t ci unpause-pipeline -p <%= @name %>

deploy: push
deploy:
@helm install ./<%= @output %>/charts/<%= @name %> --set "image.tag=$(VERSION)"