-
Notifications
You must be signed in to change notification settings - Fork 7
141 lines (113 loc) · 5.29 KB
/
chart-publish-preprod.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: Preprod chart publish
on:
push:
branches:
- main
concurrency:
group: ${{ github.ref }}-chart-publish-preprod
jobs:
registry:
name: Publish the chart to the preprod Helm repository
runs-on: ubuntu-latest
env:
HELM_VERSION: "3.7.1"
CHART_VERSION_PREFIX: "0.0.1-preprod"
permissions:
id-token: write
contents: read
steps:
- name: Check out repository code
uses: actions/checkout@main
- name: Install Helm
run: |
curl -s https://get.helm.sh/helm-v${HELM_VERSION}-linux-amd64.tar.gz -o helm-v${HELM_VERSION}-linux-amd64.tar.gz
tar -zxf helm-v${HELM_VERSION}-linux-amd64.tar.gz
sudo mv linux-amd64/helm /usr/local/bin
rm helm-v${HELM_VERSION}-linux-amd64.tar.gz
rm -rf linux-amd64
- name: Install Helm S3 Plugin
run: helm plugin install https://github.com/hypnoglow/helm-s3.git
- name: Create output directory for Spacelift PromEx Chart
run: mkdir -p build/chart/spacelift-promex
- name: Create output directory for Spacelift Worker Pool Chart
run: mkdir -p build/chart/worker-pool
- name: Create output directory for Spacelift VCS Agent Chart
run: mkdir -p build/chart/vcs-agent
- name: Create output directory for spacelift-workerpool-controller Chart
run: mkdir -p build/chart/spacelift-workerpool-controller
- name: Create output directory for spacelift-operator Chart
run: mkdir -p build/chart/spacelift-operator
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ secrets.PREPROD_AWS_REGION }}
role-to-assume: ${{ secrets.PREPROD_AWS_ROLE_TO_ASSUME }}
role-duration-seconds: 900
- name: Add the Spacelift Helm registry
run: helm repo add spacelift s3://${{ secrets.PREPROD_AWS_S3_BUCKET }}/helm
# The first time this step runs the index file won't exist, so allow the step to fail
continue-on-error: true
- name: Set chart version number
run: |
timestamp=$(date +'%s')
echo "CHART_VERSION=${CHART_VERSION_PREFIX}.${timestamp}" >> $GITHUB_ENV
- name: Lint spacelift-promex chart
run: helm lint spacelift-promex/
- name: Lint Spacelift Worker Pool chart
run: helm lint spacelift-worker-pool/
- name: Lint Spacelift VCS Agent chart
run: helm lint vcs-agent/
- name: Lint spacelift-workerpool-controller chart
run: |
helm dependency update spacelift-workerpool-controller/
helm lint spacelift-workerpool-controller/
- name: Lint spacelift-operator chart
run: helm lint spacelift-operator/
- name: Package spacelift-promex chart
run: |
helm package --version "$CHART_VERSION" --destination build/chart/spacelift-promex spacelift-promex/
helm s3 push --relative build/chart/spacelift-promex/spacelift-promex-${CHART_VERSION}.tgz spacelift
- name: Package Spacelift Worker Pool chart
run: |
helm package --version "$CHART_VERSION" --destination build/chart/worker-pool spacelift-worker-pool/
helm s3 push --relative build/chart/worker-pool/spacelift-worker-${CHART_VERSION}.tgz spacelift
- name: Package Spacelift VCS Agent chart
run: |
helm package --version "$CHART_VERSION" --destination build/chart/vcs-agent vcs-agent/
helm s3 push --relative build/chart/vcs-agent/vcs-agent-${CHART_VERSION}.tgz spacelift
- name: Package spacelift-workerpool-controller chart
run: |
helm package --version "$CHART_VERSION" --destination build/chart/spacelift-workerpool-controller spacelift-workerpool-controller/
helm s3 push --relative build/chart/spacelift-workerpool-controller/spacelift-workerpool-controller-${CHART_VERSION}.tgz spacelift
- name: Package spacelift-operator chart
run: |
helm package --version "$CHART_VERSION" --destination build/chart/spacelift-operator spacelift-operator/
helm s3 push --relative build/chart/spacelift-operator/spacelift-operator-${CHART_VERSION}.tgz spacelift
- name: Invalidate cache
run: >-
aws cloudfront create-invalidation
--distribution-id ${{ secrets.PREPROD_DISTRIBUTION }}
--paths "/helm/*"
test-new-version:
name: Test that the new chart version can be pulled
runs-on: ubuntu-latest
needs: [registry]
env:
HELM_VERSION: "3.7.1"
steps:
- name: Install Helm
run: |
curl -s https://get.helm.sh/helm-v${HELM_VERSION}-linux-amd64.tar.gz -o helm-v${HELM_VERSION}-linux-amd64.tar.gz
tar -zxf helm-v${HELM_VERSION}-linux-amd64.tar.gz
sudo mv linux-amd64/helm /usr/local/bin
rm helm-v${HELM_VERSION}-linux-amd64.tar.gz
rm -rf linux-amd64
- name: Pull chart
run: |
helm repo add spacelift https://downloads.spacelift.dev/helm
helm repo update
helm pull --devel spacelift/spacelift-promex
helm pull --devel spacelift/spacelift-worker
helm pull --devel spacelift/vcs-agent
helm pull --devel spacelift/spacelift-workerpool-controller
helm pull --devel spacelift/spacelift-operator