Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: v.oleynikov <[email protected]>
  • Loading branch information
duckhawk committed Apr 24, 2024
1 parent a73cf63 commit d18d23a
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ env:
MODULES_MODULE_SOURCE: ${{ vars.DEV_MODULE_SOURCE }}
MODULES_REGISTRY_LOGIN: ${{ vars.DEV_MODULES_REGISTRY_LOGIN }}
MODULES_REGISTRY_PASSWORD: ${{ secrets.DEV_MODULES_REGISTRY_PASSWORD }}
GOLANG_VERSION: ${{ vars.GOLANG_VERSION }}
GOPROXY: ${{ secrets.GOPROXY }}
SOURCE_REPO: ${{ vars.SOURCE_REPO }}
SOURCE_REPO_TAG: ${{ vars.SOURCE_REPO_TAG }}

on:
pull_request:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/build_prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ env:
MODULES_REGISTRY_LOGIN: ${{ vars.PROD_MODULES_REGISTRY_LOGIN }}
MODULES_REGISTRY_PASSWORD: ${{ secrets.PROD_MODULES_REGISTRY_PASSWORD }}
MODULES_MODULE_TAG: ${{ github.ref_name }}
GOLANG_VERSION: ${{ vars.GOLANG_VERSION }}
GOPROXY: ${{ secrets.GOPROXY }}
SOURCE_REPO: ${{ vars.SOURCE_REPO }}
SOURCE_REPO_TAG: ${{ vars.SOURCE_REPO_TAG }}

on:
push:
Expand Down
78 changes: 78 additions & 0 deletions images/csi-nfs/werf.inc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{{- $_ := set . "BASE_GOLANG_22_ALPINE" "registry.deckhouse.io/base_images/golang:1.22.1-alpine@sha256:0de6cf7cceab6ecbf0718bdfb675b08b78113c3709c5e4b99456cdb2ae8c2495" }}
{{- $_ := set . "BASE_SCRATCH" "registry.deckhouse.io/base_images/scratch@sha256:b054705fcc9f2205777d80a558d920c0b4209efdc3163c22b5bfcb5dda1db5fc" }}
{{- $_ := set . "BASE_ALPINE_DEV" "registry.deckhouse.io/base_images/dev-alpine:3.16.3@sha256:c706fa83cc129079e430480369a3f062b8178cac9ec89266ebab753a574aca8e" }}
{{- $_ := set . "BASE_ALT_DEV" "registry.deckhouse.io/base_images/dev-alt:p10@sha256:76e6e163fa982f03468166203488b569e6d9fc10855d6a259c662706436cdcad" }}

---
image: {{ $.ImageName }}-golang-artifact
from: {{ $.BASE_GOLANG_22_ALPINE }}

mount:
- fromPath: ~/go-pkg-cache
to: /go/pkg
shell:
beforeInstall:
- apk add --no-cache ca-certificates make git
install:
- export GO_VERSION={{ env "GOLANG_VERSION" }}
- export GOPROXY={{ env "GOPROXY" }}
- git clone --depth 1 --branch {{ env "SOURCE_REPO_TAG" }} {{ env "SOURCE_REPO" }}/kubernetes-csi/csi-driver-nfs.git /csi-driver-nfs
- cd /csi-driver-nfs/cmd/nfsplugin
- GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-s -w" -o /nfsplugin
- chmod +x /nfsplugin

---
{{ $csiBinaries := "/bin/mount /bin/umount /sbin/mount.nfs /sbin/mount.nfs4" }}
---
image: {{ $.ImageName }}-binaries-artifact
from: {{ $.BASE_ALT_DEV }}

shell:
install:
- /binary_replace.sh -i "{{ $csiBinaries }}" -o /relocate

---
image: {{ $.ImageName }}-distroless-artifact
from: {{ $.BASE_ALPINE_DEV }}

shell:
install:
- mkdir -p /relocate/bin /relocate/sbin /relocate/etc /relocate/etc/ssl /relocate/usr/bin /relocate/usr/sbin /relocate/usr/share
- cp -pr /tmp /relocate
- cp -pr /etc/passwd /etc/group /etc/hostname /etc/hosts /etc/shadow /etc/protocols /etc/services /etc/nsswitch.conf /relocate/etc
- cp -pr /usr/share/ca-certificates /relocate/usr/share
- cp -pr /usr/share/zoneinfo /relocate/usr/share
- cp -pr etc/ssl/cert.pem /relocate/etc/ssl
- cp -pr /etc/ssl/certs /relocate/etc/ssl
- echo "deckhouse:x:64535:64535:deckhouse:/:/sbin/nologin" >> /relocate/etc/passwd
- echo "deckhouse:x:64535:" >> /relocate/etc/group
- echo "deckhouse:!::0:::::" >> /relocate/etc/shadow

---
image: {{ $.ImageName }}-distroless
from: {{ $.BASE_SCRATCH }}

import:
- image: {{ $.ImageName }}-distroless-artifact
add: /relocate
to: /
before: setup

---
image: {{ $.ImageName }}
fromImage: {{ $.ImageName }}-distroless

import:
- image: {{ $.ImageName }}-golang-artifact
add: /nfsplugin
to: /nfsplugin
before: setup
- image: {{ $.ImageName }}-binaries-artifact
add: /relocate
to: /
before: install
includePaths:
- '**/*'

docker:
ENTRYPOINT: ["/nfsplugin"]
2 changes: 1 addition & 1 deletion templates/csi/controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
name: tmp-dir
{{- end }}

{{- $csiControllerImage := include "helm_lib_module_image" (list . "csiNfsController") }}
{{- $csiControllerImage := include "helm_lib_module_image" (list . "csiNfs") }}

{{- $csiControllerConfig := dict }}
{{- $_ := set $csiControllerConfig "controllerImage" $csiControllerImage }}
Expand Down
7 changes: 6 additions & 1 deletion werf-giterminism.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
giterminismConfigVersion: 1
config:
goTemplateRendering: # The rules for the Go-template functions to be able to pass build context to the release
allowEnvVariables: [ /CI_.+/, MODULES_MODULE_TAG ]
allowEnvVariables: [ /CI_.+/, MODULES_MODULE_TAG, GOLANG_VERSION, GOPROXY, SOURCE_REPO_TAG, SOURCE_REPO ]
stapel:
mount:
allowBuildDir: true
allowFromPaths:
- ~/go-pkg-cache

0 comments on commit d18d23a

Please sign in to comment.