Skip to content

Commit af03009

Browse files
Prepare to CSE build (#97)
Signed-off-by: v.oleynikov <[email protected]> Signed-off-by: Aleksey Gavrilov <[email protected]> Co-authored-by: Aleksey Gavrilov <[email protected]>
1 parent 77542b4 commit af03009

File tree

21 files changed

+284
-247
lines changed

21 files changed

+284
-247
lines changed

.github/workflows/build_dev.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ env:
1111
GOPROXY: ${{ secrets.GOPROXY }}
1212
SOURCE_REPO: ${{ secrets.SOURCE_REPO }}
1313
SOURCE_REPO_SSH_KEY: ${{ secrets.SOURCE_REPO_SSH_KEY }}
14-
BASE_IMAGES_VERSION: "v0.4.3"
14+
BASE_IMAGES_VERSION: "v0.5.6"
1515

1616
on:
1717
#pull_request:
@@ -129,4 +129,4 @@ jobs:
129129
module_name: ${{ vars.MODULE_NAME }}
130130
module_tag: ${{ env.MODULES_MODULE_TAG }}
131131
source_repo: ${{ secrets.SOURCE_REPO }}
132-
source_repo_ssh_key: ${{ secrets.SOURCE_REPO_SSH_KEY }}
132+
source_repo_ssh_key: ${{ secrets.SOURCE_REPO_SSH_KEY }}

.github/workflows/build_prod.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ env:
1212
GOPROXY: ${{ secrets.GOPROXY }}
1313
SOURCE_REPO: ${{ secrets.SOURCE_REPO }}
1414
SOURCE_REPO_SSH_KEY: ${{ secrets.SOURCE_REPO_SSH_KEY }}
15-
BASE_IMAGES_VERSION: "v0.4.3"
15+
BASE_IMAGES_VERSION: "v0.5.6"
1616

1717
on:
1818
push:
@@ -233,4 +233,4 @@ jobs:
233233
module_tag: ${{ github.ref_name }}
234234
secondary_repo: "${{ vars.DEV_MODULE_SOURCE }}/${{ vars.MODULE_NAME }}"
235235
source_repo: ${{ secrets.SOURCE_REPO }}
236-
source_repo_ssh_key: ${{ secrets.SOURCE_REPO_SSH_KEY }}
236+
source_repo_ssh_key: ${{ secrets.SOURCE_REPO_SSH_KEY }}

.werf/bundle.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import:
1616
after: setup
1717
# Rendering .werf/go-hooks.yaml is required!
1818
- image: go-hooks-artifact
19-
add: /usr/local/bin/go-hooks
19+
add: /go-hooks
2020
to: /hooks/go-hooks
2121
after: setup
2222
# Rendering .werf/choose-edition.yaml is required!

.werf/choose-edition.yaml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@ fromImage: builder/alt
44
fromCacheVersion: {{ div .Commit.Date.Unix (mul 60 60 24 30) }}
55

66
git:
7-
- add: /
8-
to: /
9-
includePaths:
10-
- openapi
7+
- add: /openapi
8+
to: /openapi
119
stageDependencies:
1210
setup:
13-
- openapi/values_*.yaml
11+
- '**/*'
1412
shell:
1513
setup:
1614
- cd /openapi
17-
- if [[ {{ .MODULE_EDITION }} == "ce" ]]; then cp -v values_ce.yaml values.yaml; else cp -v values_ee.yaml values.yaml; fi
15+
- if [[ {{ .MODULE_EDITION }} == "ce" ]]; then cp -fv values_ce.yaml values.yaml; fi
1816
- rm -rf values_*.yaml

.werf/consts.yaml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,4 @@
77
{{- $_ := set $versions "KTLS_UTILS" "ktls-utils-0.11" }}
88
{{- $_ := set $versions "CSI_DRIVER_NFS" "v4.7.0" }}
99
{{- $_ := set $versions "NFS_UTILS" "nfs-utils-2-7-1" }} # must match the nfs-utils package from BASE_ALT_P11
10-
{{- $_ := set $ "VERSIONS" $versions }}
11-
12-
# custom constants
13-
{{- $_ := set $ "DEV_PACKAGES" "make automake pkg-config gcc libtool git curl" }}
14-
{{- $_ := set $ "DECKHOUSE_UID_GID" "64535" }}
15-
{{- $_ := set $ "ALT_BASE_PACKAGES" "openssl libtirpc tzdata" }}
16-
{{- $_ := set $ "ALT_CLEANUP_CMD" "rm -rf /var/lib/apt/lists/* /var/cache/apt/* && mkdir -p /var/lib/apt/lists/partial /var/cache/apt/archives/partial" }}
10+
{{- $_ := set . "VERSIONS" $versions }}

.werf/defines/golang.tmpl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
{{- define "mount points for golang builds" }}
3+
- from: tmp_dir
4+
to: /go/pkg
5+
- from: tmp_dir
6+
to: /root/go/pkg
7+
- from: tmp_dir
8+
to: /root/.cache/go-build
9+
{{- end }}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
{{- define "alt packages proxy" }}
3+
{{- end }}

.werf/images.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
{{- $ImagesBuildFiles := .Files.Glob "images/*/{Dockerfile,werf.inc.yaml}" }}
22

33
{{- range $path, $content := $ImagesBuildFiles }}
4-
{{ $ctx := (dict "ImageName" ($path | split "/")._1 "Root" $ "Versions" $.VERSIONS) }}
4+
{{- $ctx := dict }}
5+
{{- $_ := set $ctx "ImageName" ($path | split "/")._1 }}
6+
{{- $_ := set $ctx "SOURCE_REPO" (env "SOURCE_REPO" "https://github.com") }}
7+
{{- $_ := set $ctx "MODULE_EDITION" $.MODULE_EDITION }}
8+
{{- $_ := set $ctx "Versions" $.VERSIONS }}
9+
{{- $_ := set $ctx "ImagePath" (printf "/images/%s" $ctx.ImageName) }}
10+
{{- $_ := set $ctx "ModuleNamePrefix" "" }}
11+
{{- $_ := set $ctx "ModuleDir" "/" }}
12+
{{- $_ := set $ctx "GOPROXY" (env "GOPROXY" "https://proxy.golang.org,direct") }}
513
---
614
{{- /* For Dockerfile just render it from the folder. */ -}}
715
{{- if not (regexMatch "/werf.inc.yaml$" $path) }}

images/controller/werf.inc.yaml

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
# do not remove this image: used in external audits (DKP CSE)
3-
image: {{ $.ImageName }}-src-artifact
3+
image: {{ .ModuleNamePrefix }}{{ .ImageName }}-src-artifact
44
fromImage: builder/src
55
final: false
66
git:
7-
- add: /
7+
- add: {{ .ModuleDir }}
88
to: /src
99
includePaths:
1010
- api
@@ -18,32 +18,39 @@ shell:
1818
- rm -rf /src/.git
1919

2020
---
21-
image: {{ $.ImageName }}-golang-artifact
21+
image: {{ .ModuleNamePrefix }}{{ .ImageName }}-golang-artifact
2222
fromImage: builder/golang-alpine
2323
final: false
24+
2425
import:
25-
- image: {{ $.ImageName }}-src-artifact
26+
- image: {{ .ModuleNamePrefix }}{{ .ImageName }}-src-artifact
2627
add: /src
2728
to: /src
28-
before: setup
29+
before: install
30+
2931
mount:
30-
- fromPath: ~/go-pkg-cache
31-
to: /go/pkg
32+
{{ include "mount points for golang builds" . }}
33+
34+
secrets:
35+
- id: GOPROXY
36+
value: {{ .GOPROXY }}
37+
3238
shell:
3339
setup:
3440
- cd /src/images/{{ $.ImageName }}/cmd
35-
- export CGO_ENABLED=0 GOOS=linux GOARCH=amd64
36-
- go build -ldflags="-s -w" -tags {{ $.Root.MODULE_EDITION }} -o /{{ $.ImageName }}
41+
- GOPROXY=$(cat /run/secrets/GOPROXY) go mod download
42+
- GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-s -w" -tags {{ .MODULE_EDITION }} -o /{{ $.ImageName }}
3743
- chmod +x /{{ $.ImageName }}
3844

3945
---
40-
image: {{ $.ImageName }}
46+
image: {{ .ModuleNamePrefix }}{{ .ImageName }}
4147
fromImage: base/distroless
4248
import:
43-
- image: {{ $.ImageName }}-golang-artifact
49+
- image: {{ .ModuleNamePrefix }}{{ .ImageName }}-golang-artifact
4450
add: /{{ $.ImageName }}
4551
to: /{{ $.ImageName }}
4652
before: setup
47-
docker:
48-
ENTRYPOINT: ["/{{ $.ImageName }}"]
49-
USER: deckhouse:deckhouse
53+
54+
imageSpec:
55+
config:
56+
entrypoint: ["/{{ $.ImageName }}"]
Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
# do not remove this image: used in external audits (DKP CSE)
3-
image: {{ $.ImageName }}-src-artifact
3+
image: {{ .ModuleNamePrefix }}{{ .ImageName }}-src-artifact
44
fromImage: builder/src
55
final: false
66
git:
7-
- add: /
7+
- add: {{ .ModuleDir }}
88
to: /src
99
includePaths:
1010
- api
@@ -18,33 +18,40 @@ shell:
1818
- rm -rf /src/.git
1919

2020
---
21-
image: {{ $.ImageName }}-golang-artifact
21+
image: {{ .ModuleNamePrefix }}{{ .ImageName }}-golang-artifact
2222
fromImage: builder/golang-alpine
2323
final: false
24+
2425
import:
25-
- image: {{ $.ImageName }}-src-artifact
26+
- image: {{ .ModuleNamePrefix }}{{ .ImageName }}-src-artifact
2627
add: /src
2728
to: /src
28-
before: setup
29+
before: install
30+
2931
mount:
30-
- fromPath: ~/go-pkg-cache
31-
to: /go/pkg
32+
{{ include "mount points for golang builds" . }}
33+
34+
secrets:
35+
- id: GOPROXY
36+
value: {{ .GOPROXY }}
37+
3238
shell:
3339
setup:
3440
- cd /src/images/{{ $.ImageName }}/cmd
35-
- export CGO_ENABLED=0 GOOS=linux GOARCH=amd64
41+
- GOPROXY=$(cat /run/secrets/GOPROXY) go mod download
3642
- GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-s -w" -o /{{ $.ImageName }}
3743
- chmod +x /{{ $.ImageName }}
3844

3945
---
40-
image: {{ $.ImageName }}
46+
image: {{ .ModuleNamePrefix }}{{ .ImageName }}
4147
fromImage: base/distroless
4248

4349
import:
44-
- image: {{ $.ImageName }}-golang-artifact
50+
- image: {{ .ModuleNamePrefix }}{{ .ImageName }}-golang-artifact
4551
add: /{{ $.ImageName }}
4652
to: /{{ $.ImageName }}
4753
before: setup
48-
docker:
49-
ENTRYPOINT: ["/{{ $.ImageName }}"]
50-
USER: deckhouse:deckhouse
54+
55+
imageSpec:
56+
config:
57+
entrypoint: ["/{{ $.ImageName }}"]

0 commit comments

Comments
 (0)