Skip to content

Commit

Permalink
chore(ci): Add SOURCE_REPO env (#433)
Browse files Browse the repository at this point in the history
Add SOURCE_REPO. It is git repo prefix for building 3-rd party images.
pcre builder not needed anymore.
---------

Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
  • Loading branch information
universal-itengineer authored Oct 17, 2024
1 parent 8bb34f4 commit 03e66b4
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 29 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/dev_module_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ env:
MODULES_REGISTRY_LOGIN: ${{ vars.DEV_MODULES_REGISTRY_LOGIN }}
MODULES_REGISTRY_PASSWORD: ${{ secrets.DEV_MODULES_REGISTRY_PASSWORD }}
GO_VERSION: "1.22.7"
SOURCE_REPO: "${{secrets.SOURCE_REPO}}"

on:
workflow_dispatch:
pull_request:
types: [opened, edited, synchronize]
types: [opened, synchronize]
push:
branches:
- main
Expand Down
2 changes: 1 addition & 1 deletion images/cdi-artifact/werf.inc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ shell:
- rm --recursive --force /var/lib/apt/lists/ftp.altlinux.org* /var/cache/apt/*.bin

install:
- git clone --depth 1 --branch v{{ $version }} https://github.com/kubevirt/containerized-data-importer.git /containerized-data-importer
- git clone --depth 1 --branch v{{ $version }} {{ .SOURCE_REPO }}/kubevirt/containerized-data-importer.git /containerized-data-importer
- cd /containerized-data-importer
- |
for p in /patches/*.patch ; do
Expand Down
31 changes: 5 additions & 26 deletions images/virt-launcher/werf.inc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import:
- edk2-ovmf-20231115-alt1.noarch.rpm

# After install stage.
# Add libxcrypto library.
# Add libxcrypto library.
- image: {{ $.ImageName }}-libxcrypt-builder
add: /usr/local/lib/
to: /lib64
Expand All @@ -29,14 +29,6 @@ import:
- libcrypto.so.3
- libssl.so.3

# Add pcre libraries.
- image: {{ $.ImageName }}-pcre-builder
add: /usr/local/lib/
to: /lib64
after: install
includePaths:
- libpcre.so.1.2.13

# Add liboverride library.
- image: {{ $.ImageName }}-liboverride-builder
add: /liboverride/
Expand Down Expand Up @@ -110,6 +102,7 @@ shell:
- |
apt-get update && apt-get install --yes \
acl \
pcre \
ethtool \
nftables \
xorriso \
Expand Down Expand Up @@ -160,7 +153,7 @@ shell:
- groupadd --gid 107 qemu && useradd qemu --uid 107 --gid 107 --shell /bin/bash --create-home
# Create links to required for virt-launcher libs.
- ln -s /lib64/libcrypt.so.2.0.0 /lib64/libcrypt.so.2
- ln -s /lib64/libpcre.so.1.2.13 /lib64/libpcre.so.1
# - ln -s /lib64/libpcre.so.1.2.13 /lib64/libpcre.so.1
- |
[[ ! -e /usr/bin/cp ]] && ln -s /bin/cp /usr/bin/cp
- mkdir -p /init/usr/bin && ln -s /usr/bin/container-disk /init/usr/bin/container-disk
Expand Down Expand Up @@ -195,7 +188,7 @@ fromImage: {{ $.ImageName }}-lib-builder
shell:
beforeInstall:
# Download libxcrypt sources.
- git clone --branch v4.4.36 https://github.com/besser82/libxcrypt.git /tmp/libxcrypt
- git clone --branch v4.4.36 {{ $.SOURCE_REPO }}/besser82/libxcrypt.git /tmp/libxcrypt
install:
# Build libcrypt.so.2.
- cd /tmp/libxcrypt
Expand All @@ -209,27 +202,13 @@ fromImage: {{ $.ImageName }}-lib-builder
shell:
beforeInstall:
# Download OpenSSL sources.
- git clone --branch openssl-3.3.1 https://github.com/openssl/openssl.git /tmp/openssl
- git clone --branch openssl-3.3.1 {{ $.SOURCE_REPO }}/openssl/openssl.git /tmp/openssl
install:
# Build libcrypto.so.3 and libssl.so.3.
- cd /tmp/openssl
- ./config no-docs
- make && make install
---
image: {{ $.ImageName }}-pcre-builder
final: false
fromImage: {{ $.ImageName }}-lib-builder
shell:
beforeInstall:
# Download PCRE sources.
- wget -O /tmp/pcre.tar.gz https://sourceforge.net/projects/pcre/files/pcre/8.45/pcre-8.45.tar.gz/download
install:
# Build libpcre.so.1.
- tar -xf /tmp/pcre.tar.gz -C /tmp
- cd /tmp/pcre-8.45
- ./configure --enable-utf --enable-unicode-properties
- make && make install
---
image: {{ $.ImageName }}-liboverride-builder
final: false
fromImage: {{ $.ImageName }}-lib-builder
Expand Down
2 changes: 1 addition & 1 deletion werf-giterminism.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
giterminismConfigVersion: 1
config:
goTemplateRendering: # The rules for the Go-template functions
allowEnvVariables: [ /CI_.+/, MODULES_MODULE_TAG ]
allowEnvVariables: [ /CI_.+/, MODULES_MODULE_TAG, SOURCE_REPO ]
stapel:
mount:
allowBuildDir: true
Expand Down
7 changes: 7 additions & 0 deletions werf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,13 @@ configVersion: 1
{{- end }}

{{- end }}

# Source repo settings
{{- $_ := set . "SOURCE_REPO" (env "SOURCE_REPO" | default "https://github.com") }}

# Modules_images
{{- define "module_image_template" }}

{{- if eq .ImageInstructionType "Dockerfile" }}
---
image: images/{{ .ImageName }}
Expand All @@ -49,6 +54,7 @@ dockerfile: Dockerfile
{{- else }}
{{ tpl .ImageBuildData . }}
{{- end }}

{{- end }}

{{- $Root := . }}
Expand All @@ -68,6 +74,7 @@ dockerfile: Dockerfile
{{- $_ := set $ctx "ImageName" $ImageData._1 }}
{{- $_ := set $ctx "ImageBuildData" $content }}
{{- $_ := set $ctx "Images" $Root.Images }}
{{- $_ := set $ctx "SOURCE_REPO" $Root.SOURCE_REPO }}

{{- include "module_image_template" $ctx }}
{{- range $ImageYamlMainfest := regexSplit "\n?---[ \t]*\n" (include "module_image_template" $ctx) -1 }}
Expand Down

0 comments on commit 03e66b4

Please sign in to comment.