Skip to content

Commit 2a413c7

Browse files
authored
ci: add manifest for images generated by main branch (#92)
Automatically generate a manifest.yaml file that can be applied to evaluate the content of the latest commit of the main branch. Signed-off-by: Francesco Canovai <[email protected]>
1 parent 17dae37 commit 2a413c7

File tree

3 files changed

+929
-2
lines changed

3 files changed

+929
-2
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,5 @@ go.work
3939
test/e2e/bin
4040
# Test registry certificates
4141
certs/
42+
# Utility dir for manifest build
43+
manifest-build/

Taskfile.yml

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ tasks:
5050
uncommitted:
5151
desc: Check for uncommitted changes
5252
deps:
53-
- controller-gen
53+
- manifest-main
5454
env:
5555
# renovate: datasource=git-refs depName=uncommitted lookupName=https://github.com/cloudnative-pg/daggerverse currentValue=main
5656
DAGGER_UNCOMMITTED_SHA: fa2e604b785c0ff9252a807097fc1215e10df486
@@ -269,8 +269,23 @@ tasks:
269269
generates:
270270
- ./api/v1/zz_generated.deepcopy.go
271271

272+
manifest-main:
273+
deps:
274+
- controller-gen
275+
desc: Generate the manifest for the main branch
276+
vars:
277+
GITHUB_REPOSITORY: '{{ default "cloudnative-pg/plugin-barman-cloud" .GITHUB_REPOSITORY }}'
278+
GITHUB_REF: main
279+
GITHUB_REF_NAME: main
280+
cmds:
281+
- task: manifest-internal
282+
vars:
283+
GITHUB_REPOSITORY: '{{.GITHUB_REPOSITORY}}'
284+
GITHUB_REF: '{{.GITHUB_REF}}'
285+
GITHUB_REF_NAME: '{{.GITHUB_REF_NAME}}'
286+
272287
manifest:
273-
desc: Update the image in the Kustomization
288+
desc: Generate the manifest to be uploaded to the release or as a workflow artifact
274289
deps:
275290
- controller-gen
276291
requires:
@@ -281,6 +296,22 @@ tasks:
281296
- GITHUB_REPOSITORY
282297
- GITHUB_REF
283298
- GITHUB_REF_NAME
299+
cmds:
300+
- task: manifest-internal
301+
vars:
302+
GITHUB_REPOSITORY: '{{.GITHUB_REPOSITORY}}'
303+
GITHUB_REF: '{{.GITHUB_REF}}'
304+
GITHUB_REF_NAME: '{{.GITHUB_REF_NAME}}'
305+
306+
manifest-internal:
307+
desc: Update the image in the Kustomization
308+
label: manifest-internal-{{.GITHUB_REF_NAME}}
309+
internal: true
310+
requires:
311+
vars:
312+
- GITHUB_REPOSITORY
313+
- GITHUB_REF
314+
- GITHUB_REF_NAME
284315
vars:
285316
PLUGIN_IMAGE_NAME: ghcr.io/{{.GITHUB_REPOSITORY}}{{if not (hasPrefix "refs/tags/v" .GITHUB_REF)}}-testing{{end}}
286317
SIDECAR_IMAGE_NAME: ghcr.io/{{.GITHUB_REPOSITORY}}-sidecar{{if not (hasPrefix "refs/tags/v" .GITHUB_REF)}}-testing{{end}}
@@ -301,6 +332,11 @@ tasks:
301332
- >
302333
dagger -s call -m github.com/sagikazarmark/daggerverse/kustomize@${DAGGER_KUSTOMIZE_SHA}
303334
build --source . --dir manifest-build export --path manifest.yaml
335+
sources:
336+
- ./config/**/*.yaml
337+
- ./kubernetes/**/*.yaml
338+
generates:
339+
- ./manifest.yaml
304340

305341
upload-manifest-to-release:
306342
desc: Upload the manifest to the release

0 commit comments

Comments
 (0)