Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .werf/defines/images.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,27 @@ Result:
{{- end -}}
{{- end }}
{{ end }}

{{ define "baseImages" }}
{{- if not (eq (kindOf .) "slice") }}
{{- fail "importPackageImages: invalid type of argument, slice is expected" }}
{{- end }}
{{- $context := index . 0 }}
{{- $imageNames := index . 1 }}
{{- $stage := "install" }}
{{- $toSuffix := "" }}
{{- if gt (len .) 2 }}
{{- $stage = index . 2 }}
{{- end }}
{{- if gt (len .) 3 }}
{{- $toSuffix = index . 3 }}
{{- end }}
{{- range $imageName := $imageNames }}
{{- if ne $imageName "" }}
- image: dev-{{ index $context.Images $imageName }}
add: /out
to: /{{ last (splitList "/" $imageName) }}{{ $toSuffix }}
before: {{ $stage }}
{{- end -}}
{{- end }}
{{ end }}
1 change: 1 addition & 0 deletions .werf/images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ dockerfile: Dockerfile
{{- $_ := set $ctx "SVACE_ANALYZE_SSH_USER" $Root.SVACE_ANALYZE_SSH_USER }}
{{- $_ := set $ctx "SVACE_ANALYZE_HOST" $Root.SVACE_ANALYZE_HOST }}
{{- $_ := set $ctx "SVACE_IMAGE_SUFFIX" $Root.SVACE_IMAGE_SUFFIX }}
{{- $_ := set $ctx "Images" $Root.Images }}


{{- include "module_image_template" $ctx }}
Expand Down
2 changes: 2 additions & 0 deletions build/base-images/deckhouse_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -304,3 +304,5 @@ tools/xfsprogs-v6.16.0: "sha256:bb8b1e677b0be4a2bdf33c61d1e09803126ce32486ebda27
tools/yq: "sha256:035f73ce4ee26186851b039ff6c0afec622354bb6c5f0d6e8859c40a16286c0d" # from: builder/scratch
tools/yq-v4.45.1: "sha256:31262bbc95fc1f9f2c831e1b148402b829f2a7cf8a62611e98543677fe28ff70" # from: builder/scratch
tools/yq-v4.47.1: "sha256:035f73ce4ee26186851b039ff6c0afec622354bb6c5f0d6e8859c40a16286c0d" # from: builder/scratch
libs/libvirt: "sha256:ae60c3483b74bd5d61ea5c16809ee78b4925ea31c9b2a252b15b50533deebff9"
libs/libvirt-10.9.0: "sha256:ae60c3483b74bd5d61ea5c16809ee78b4925ea31c9b2a252b15b50533deebff9"
38 changes: 35 additions & 3 deletions images/virt-launcher/werf.inc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,11 @@ packages:
- glibc nghttp3 ngtcp2 nghttp2 libpsl libidn2 libgmp
- openldap openssl
- e2fsprogs libxcrypt lvm2 libjson-glib
- libvirt
- libffi
- libbrotli libntlm gcc libcap libgpg-error lz4
- libuserspace-rcu lzo dtc
baseImages:
- libs/libvirt
{{- end -}}

{{ $builderDependencies := include "$name" . | fromYaml }}
Expand Down Expand Up @@ -158,10 +159,19 @@ git:
- nsswitch.conf
import:
# Libvirt and QEMU libraries and binaries
- image: {{ .ModuleNamePrefix }}packages/libvirt
add: /libvirt
{{- if $builderDependencies.baseImages }}
{{- range $imageName := $builderDependencies.baseImages }}
{{- $fullName := index $.Images $imageName }}
{{- $simpleName := last (splitList "/" $imageName) }}
{{- if eq $imageName "libs/libvirt" }}
# Libvirt from base_images
- image: dev-{{ $fullName }}
add: /out
to: /libvirt-bins
before: install
{{- end }}
{{- end }}
{{- end }}
- image: {{ .ModuleNamePrefix }}qemu
add: /BINS
to: /qemu-bins
Expand Down Expand Up @@ -209,6 +219,7 @@ import:
- vlctl

{{- include "importPackageImages" (list . $builderDependencies.packages "install") -}}
{{- include "baseImages" (list . $builderDependencies.baseImages "install") -}}

# Statically built.
- image: {{ .ModuleNamePrefix }}packages/openssl
Expand Down Expand Up @@ -264,6 +275,17 @@ shell:
rm -rf /$pkg
done

{{- if $builderDependencies.baseImages }}
echo "Copy base_images"
{{- range $imageName := $builderDependencies.baseImages }}
{{- $simpleName := last (splitList "/" $imageName) }}
if [ -d "/{{ $simpleName }}" ]; then
cp -a "/{{ $simpleName }}" /
rm -rf "/{{ $simpleName }}"
fi
{{- end }}
{{- end }}

echo "Create folder hierarchy in VBINS"
mkdir -p /VBINS/{etc,root}
mkdir -p /VBINS/var/{log/libvirt/qemu,log/swtpm/libvirt/qemu,lib/libvirt/qemu,run/libvirt/qemu,lib/swtpm-localca,lib/libvirt/swtpm}
Expand Down Expand Up @@ -422,6 +444,16 @@ shell:
cp -a /$pkg/. /
rm -rf /$pkg
done
{{- if $builderDependencies.baseImages }}
echo "Copy base_images"
{{- range $imageName := $builderDependencies.baseImages }}
{{- $simpleName := last (splitList "/" $imageName) }}
if [ -d "/{{ $simpleName }}" ]; then
cp -a "/{{ $simpleName }}" /
rm -rf "/{{ $simpleName }}"
fi
{{- end }}
{{- end }}
- mkdir -p /binaries
- export GOPROXY=$(cat /run/secrets/GOPROXY)
- export CGO_ENABLED=1
Expand Down