Skip to content

Commit

Permalink
feat(release): add channel version images (#6565)
Browse files Browse the repository at this point in the history
Signed-off-by: Evgeniy Frolov <evgeniy.frolov@flant.com>
Signed-off-by: Aleksei Igrychev <aleksei.igrychev@palark.com>
Co-authored-by: Aleksei Igrychev <aleksei.igrychev@palark.com>
  • Loading branch information
Fral738 and alexey-igrychev authored Jan 24, 2025
1 parent a8a7091 commit eb28dd2
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 24 deletions.
7 changes: 5 additions & 2 deletions docs/pages_en/reference/werf_images.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ The images follow the naming convention:

- `registry.werf.io/werf/werf:<group>` (e.g., `registry.werf.io/werf/werf:2`);
- `registry.werf.io/werf/werf:<group>-<channel>` (e.g., `registry.werf.io/werf/werf:2-stable`);
- `registry.werf.io/werf/werf:<group>-<channel>-<os>` (e.g., `registry.werf.io/werf/werf:2-stable-alpine`).
- `registry.werf.io/werf/werf:<group>-<channel>-<os>` (e.g., `registry.werf.io/werf/werf:2-stable-alpine`);
- `registry.werf.io/werf/werf:<version>` (e.g., `registry.werf.io/werf/werf:2.16.2`);
- `registry.werf.io/werf/werf:<version>-<os>` (e.g., `registry.werf.io/werf/werf:2.16.2-alpine`).

Where:

- `<group>`: version group, such as `1.2` or `2` (default);
- `<channel>`: release channel, such as `alpha`, `beta`, `ea`, `stable` (default), or `rock-solid`;
- `<os>`: operating system, such as `alpine` (default), `ubuntu`, or `fedora`.
- `<os>`: operating system, such as `alpine` (default), `ubuntu`, or `fedora`;
- `<version>`: version (e.g., `2.16.2`). If the release version includes `+fix` (e.g., `2.16.2+fix1`), it will be converted to `2.16.2.fix1` version.
17 changes: 10 additions & 7 deletions docs/pages_ru/reference/werf_images.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,21 @@ title: Образы werf
permalink: reference/werf_images.html
---

[Релизный процесс]({{ site.url }}/about/release_channels.html) werf включает публикацию образов с werf, необходимыми утилитами и предустановленными настройками для сборки со сборочным бэкендом Buildah.
[Релизный процесс]({{ site.url }}/about/release_channels.html) werf включает публикацию образов с werf, необходимыми утилитами и предустановленными настройками для сборки со сборочным бэкендом Buildah.

> Примеры использования образов werf можно посмотреть в разделе [Быстрый старт]({{ site.url }}/getting_started/).
Поддерживаются образы, публикуемые по следующему принципу:

* `registry.werf.io/werf/werf:<group>` (например, `registry.werf.io/werf/werf:2`);
* `registry.werf.io/werf/werf:<group>-<channel>` (например, `registry.werf.io/werf/werf:2-stable`);
* `registry.werf.io/werf/werf:<group>-<channel>-<os>` (например, `registry.werf.io/werf/werf:2-stable-alpine`).
- `registry.werf.io/werf/werf:<group>` (например, `registry.werf.io/werf/werf:2`);
- `registry.werf.io/werf/werf:<group>-<channel>` (например, `registry.werf.io/werf/werf:2-stable`);
- `registry.werf.io/werf/werf:<group>-<channel>-<os>` (например, `registry.werf.io/werf/werf:2-stable-alpine`);
- `registry.werf.io/werf/werf:<version>` (например, `registry.werf.io/werf/werf:2.16.2`);
- `registry.werf.io/werf/werf:<version>-<os>` (например, `registry.werf.io/werf/werf:2.16.2-alpine`).

Где:

* `<group>`: группа `1.2` или `2` (по умолчанию);
* `<channel>`: канал выпуска `alpha`, `beta`, `ea`, `stable` (по умолчанию) или `rock-solid`;
* `<os>`: операционная система `alpine` (по умолчанию), `ubuntu` или `fedora`.
- `<group>`: группа `1.2` или `2` (по умолчанию);
- `<channel>`: канал выпуска `alpha`, `beta`, `ea`, `stable` (по умолчанию) или `rock-solid`;
- `<os>`: операционная система `alpine` (по умолчанию), `ubuntu` или `fedora`.
- `<version>`: версия (например, `2.16.2`). Если версия релиза содержит `+fix` (например, `2.16.2+fix1`), то версия будет приведена к `2.16.2.fix1`.
25 changes: 17 additions & 8 deletions scripts/werf-in-image/.werf/templates/artifact.tmpl
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{{- define "artifact" }}
{{- $image_name := index . 0 }}
{{- $group_name := index . 1 }}
{{- $channel_name := index . 2 }}
{{- $distro_name := index . 3 }}
{{- $ctx := index . 4 }}
{{- $distro_name := index . 2 }}
{{- $ctx := index . 3 }}
{{- $source_image_name := (printf "trdl-%s-%s" $ctx.App $ctx.ChannelVersion) }}
{{- $base_image_name := (printf "%s-%s" $ctx.App $distro_name) }}

Expand All @@ -23,25 +22,35 @@ dependencies:

{{ define "latest" }}
{{- $image_name := "latest" }}
{{- include "artifact" (list $image_name $.DefaultGroupName $.DefaultChannelName $.DefaultDistroName $) }}
{{- include "artifact" (list $image_name $.DefaultGroupName $.DefaultDistroName $) }}
{{- end }}

{{- define "<group>" }}
{{- $image_name := $.GroupName }}
{{- include "artifact" (list $image_name $.GroupName $.DefaultChannelName $.DefaultDistroName $) }}
{{- include "artifact" (list $image_name $.GroupName $.DefaultDistroName $) }}
{{- end }}

{{ define "<group>-<channel>" }}
{{- $image_name := (printf "%s-%s" $.GroupName $.ChannelName) }}
{{- include "artifact" (list $image_name $.GroupName $.ChannelName $.DefaultDistroName $) }}
{{- include "artifact" (list $image_name $.GroupName $.DefaultDistroName $) }}
{{- end}}

{{- define "<group>-<distro>" }}
{{- $image_name := (printf "%s-%s" $.GroupName $.DistroName) }}
{{- include "artifact" (list $image_name $.GroupName $.DefaultChannelName $.DistroName $) }}
{{- include "artifact" (list $image_name $.GroupName $.DistroName $) }}
{{- end }}

{{ define "<group>-<channel>-<distro>" }}
{{- $image_name := (printf "%s-%s-%s" $.GroupName $.ChannelName $.DistroName) }}
{{- include "artifact" (list $image_name $.GroupName $.ChannelName $.DistroName $) }}
{{- include "artifact" (list $image_name $.GroupName $.DistroName $) }}
{{- end }}

{{ define "<version>" }}
{{- $image_name := $.normalizedChannelVersion }}
{{- include "artifact" (list $image_name $.GroupName $.DefaultDistroName $) }}
{{- end }}

{{ define "<version>-<distro>" }}
{{- $image_name := (printf "%s-%s" $.normalizedChannelVersion $.DistroName) }}
{{- include "artifact" (list $image_name $.GroupName $.DistroName $) }}
{{- end }}
24 changes: 17 additions & 7 deletions scripts/werf-in-image/.werf/templates/base_config.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ build:
- linux/arm64
---

{{- $uniqueVersions := list -}}
{{- $uniqueChannelVersions := list -}}
{{- $uniqueArtifactVersions := list -}}

{{/* set up default channel version */}}
{{- $trdlChannelsValues := .Files.Get "../../trdl_channels.yaml" | fromYaml -}}
Expand Down Expand Up @@ -37,14 +38,18 @@ build:
{{/* # 1.0 is a non-supported group. */}}
{{- if (eq $.GroupName "1.0") }}{{- continue }}{{- end }}

{{- include "<group>" $ }}

{{- range $_, $channelObject := $groupObject.channels }}
{{- if not (has $channelObject.version $uniqueVersions) }}
{{ $uniqueVersions = append $uniqueVersions $channelObject.version }}
{{- if not (has $channelObject.version $uniqueArtifactVersions) }}
{{ $uniqueArtifactVersions = append $uniqueArtifactVersions $channelObject.version }}
{{ $_ := set $ "ChannelName" $channelObject.name }}
{{ $_ := set $ "ChannelVersion" $channelObject.version }}
{{- include "trdl-<app>-<version>" $ }}
{{- if contains "+" $.ChannelVersion }}
{{ $_ := set $ "normalizedChannelVersion" ($.ChannelVersion | replace "+" ".") }}
{{- else }}
{{ $_ := set $ "normalizedChannelVersion" $.ChannelVersion }}
{{- end}}
{{- include "<version>" $ }}
{{- end }}

{{ $_ := set $ "ChannelName" $channelObject.name }}
Expand All @@ -53,7 +58,11 @@ build:
{{- include "<group>-<channel>" $ }}

{{- range $distroInd, $distroName := $.Distros }}
{{ $_ := set $ "DistroName" $distroName }}
{{ $_ := set $ "DistroName" $distroName }}
{{- if not (has (printf "%s-%s" $.ChannelVersion $.DistroName) $uniqueChannelVersions) }}
{{ $uniqueChannelVersions = append $uniqueChannelVersions (printf "%s-%s" $.ChannelVersion $.DistroName) }}
{{- include "<version>-<distro>" $ }}
{{- end }}

{{- include "<group>-<channel>-<distro>" $ }}
{{- end }}
Expand All @@ -64,4 +73,5 @@ build:

{{- include "<group>-<distro>" $ }}
{{- end }}
{{- end }}
{{- include "<group>" $ }}
{{- end }}

0 comments on commit eb28dd2

Please sign in to comment.