forked from deckhouse/deckhouse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
modules_images_werf.yaml
73 lines (69 loc) · 2.7 KB
/
modules_images_werf.yaml
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
project: deckhouse-modules-images
configVersion: 1
cleanup:
keepPolicies:
- references:
branch: /.*/
limit:
in: 720h
- references:
tag: /.*/
limit:
in: 720h
gitWorktree:
forceShallowClone: true
{{- $Root := . }}
{{- $CandiVersionMap := .Files.Get "candi/version_map.yml" | fromYaml }}
# Collect EE and FE images if desired
{{ $files := .Files.Glob "modules/*/images/*/{Dockerfile,werf.inc.yaml}" }}
{{- if eq .Env "EE" }}
{{ $files = merge $files (.Files.Glob "ee/modules/*/images/*/{Dockerfile,werf.inc.yaml}") }}
{{- end }}
{{- if eq .Env "FE" }}
{{ $files = merge $files (.Files.Glob "ee/modules/*/images/*/{Dockerfile,werf.inc.yaml}") }}
{{ $files = merge $files (.Files.Glob "ee/fe/modules/*/images/*/{Dockerfile,werf.inc.yaml}") }}
{{- end }}
{{- range $path, $content := $files }}
{{- $ctx := dict }}
{{- if regexMatch "/werf.inc.yaml$" $path }}
{{- $_ := set $ctx "ImageInstructionType" "Stapel" }}
{{- else }}
{{- $_ := set $ctx "ImageInstructionType" "Dockerfile" }}
{{- end }}
{{- $ImageData := regexReplaceAll "^(.*)modules/([0-9]+)-([a-z-]+)/images/([0-9a-z-_]+)/(Dockerfile|werf.inc.yaml)$" $path "${1}#${2}#${3}#${4}" | split "#" }}
{{- $_ := set $ctx "CandiVersionMap" $CandiVersionMap }}
{{- $_ := set $ctx "ModulePath" $ImageData._0 }}
{{- $_ := set $ctx "ModulePriority" $ImageData._1 }}
{{- $_ := set $ctx "ModuleName" $ImageData._2 }}
{{- $_ := set $ctx "ImageName" $ImageData._3 }}
{{- $_ := set $ctx "ImageBuildData" $content }}
{{- $_ := set $ctx "Files" $Root.Files }}
{{- $_ := set $ctx "Env" $Root.Env }}
---
{{ include "module_image_template" $ctx }}
{{- end }}
{{- define "module_image_template" }}
{{- if eq .ImageInstructionType "Dockerfile" }}
image: {{ .ModuleName }}/{{ .ImageName }}
context: {{ .ModulePath }}modules/{{ .ModulePriority }}-{{ .ModuleName }}/images/{{ .ImageName }}
dockerfile: Dockerfile
args:
BASE_ALPINE: {{ env "BASE_ALPINE" }}
BASE_ALPINE_3_15: {{ env "BASE_ALPINE_3_15" }}
BASE_DEBIAN: {{ env "BASE_DEBIAN" }}
BASE_GOLANG_ALPINE: {{ env "BASE_GOLANG_ALPINE" }}
BASE_GOLANG_16_ALPINE: {{ env "BASE_GOLANG_16_ALPINE" }}
BASE_GOLANG_17_ALPINE: {{ env "BASE_GOLANG_17_ALPINE" }}
BASE_GOLANG_BUSTER: {{ env "BASE_GOLANG_BUSTER" }}
BASE_GOLANG_16_BUSTER: {{ env "BASE_GOLANG_16_BUSTER" }}
BASE_GOLANG_17_BUSTER: {{ env "BASE_GOLANG_17_BUSTER" }}
BASE_NGINX_ALPINE: {{ env "BASE_NGINX_ALPINE" }}
BASE_NODE_16_ALPINE: {{ env "BASE_NODE_16_ALPINE" }}
BASE_PYTHON_ALPINE: {{ env "BASE_PYTHON_ALPINE" }}
BASE_SHELL_OPERATOR: {{ env "BASE_SHELL_OPERATOR" }}
BASE_UBUNTU: {{ env "BASE_UBUNTU" }}
BASE_JEKYLL: {{ env "BASE_JEKYLL" }}
{{- else }}
{{ tpl .ImageBuildData . }}
{{- end }}
{{- end }}