-
Notifications
You must be signed in to change notification settings - Fork 3
/
build-helm-chart.yml
50 lines (50 loc) · 1.49 KB
/
build-helm-chart.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Must set the following environment variables in the pipeline:
#
# - DEPLOY_HELM_CHART_PIPELINE_ID
# - CF_CTX_* (Attach Codefresh Helm repo context)
#
version: '1.0'
stages:
- build
- test
- release
steps:
CheckVersions:
image: alpine/git:1.0.4
commands:
- export CHART_VERSION=$(cat helm-charts/rainbow-kitten-surprise/Chart.yaml | grep -m 1 ^version:| awk '{print $2}')
- export PUSH_HELM=$(if [[ "$(git log --format='%H' -n 1 -- helm-charts/rainbow-kitten-surprise/Chart.yaml)" == "${{CF_REVISION}}" ]]; then echo "true"; else echo "false"; fi)
- cf_export CHART_VERSION=$CHART_VERSION PUSH_HELM=$PUSH_HELM
BuildChart:
stage: build
image: codefresh/cfstep-helm:2.11.0
working_directory: helm-charts/
commands:
- helm package rainbow-kitten-surprise
TestChart:
stage: test
image: codefresh/cfstep-helm:2.11.0
working_directory: helm-charts/
commands:
- echo "tests pass"
PushChart:
stage: release
image: codefresh/cfstep-helm:2.11.0
working_directory: helm-charts/
environment:
- ACTION=push
- CHART_REF=rainbow-kitten-surprise
when:
condition:
all:
ChartYamlChanged: '"${{PUSH_HELM}}" == "true"'
TriggerDeploy:
stage: release
image: codefresh/cli:latest
commands:
- export ARGS="-v CHART_VERSION=${{CHART_VERSION}}"
- codefresh run $DEPLOY_HELM_CHART_PIPELINE_ID --detach $ARGS
when:
condition:
all:
ChartYamlChanged: '"${{PUSH_HELM}}" == "true"'