From 2041d3a9ade988126b50907fb39ab3f6f53c8451 Mon Sep 17 00:00:00 2001 From: "v.oleynikov" Date: Tue, 11 Jun 2024 11:45:04 +0300 Subject: [PATCH] Fix Signed-off-by: v.oleynikov --- images/csi-huawei/werf.inc.yaml | 99 +++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 images/csi-huawei/werf.inc.yaml diff --git a/images/csi-huawei/werf.inc.yaml b/images/csi-huawei/werf.inc.yaml new file mode 100644 index 0000000..fa566b4 --- /dev/null +++ b/images/csi-huawei/werf.inc.yaml @@ -0,0 +1,99 @@ +{{- $_ := 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 }} +fromCacheVersion: "2024-05-14.1" +git: + - add: /images/{{ $.ImageName }} + to: / + stageDependencies: + setup: + - "**/*" + includePaths: + - patches + +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" }}/Huawei/eSDK_K8S_Plugin.git /esdb_k8s_plugin + - cd /esdb_k8s_plugin + - GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-s -w" -o /huawei-csi ./csi + - GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-s -w" -o /storage-backend-controller ./cmd/storage-backend-controller + - GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-s -w" -o /storage-backend-sidecar ./cmd/storage-backend-sidecar + - GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-s -w" -o /oceanctl ./cli + - chmod +x /csi + - chmod +x /storage-backend-controller + - chmod +x /storage-backend-sidecar + - chmod +x /oceanctl + +--- +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: /csi + to: /csi + before: setup + - image: {{ $.ImageName }}-golang-artifact + add: /storage-backend-controller + to: /storage-backend-controller + before: setup + - image: {{ $.ImageName }}-golang-artifact + add: /storage-backend-sidecar + to: /storage-backend-sidecar + before: setup + - image: {{ $.ImageName }}-golang-artifact + add: /oceanctl + to: /oceanctl + before: setup + - image: {{ $.ImageName }}-binaries-artifact + add: /relocate + to: / + before: install + includePaths: + - '**/*' + - image: {{ $.ImageName }}-binaries-artifact + add: /lib64 + to: /lib64 + before: install + includePaths: + - 'libresolv*' + - 'libnss_dns*'