Skip to content

Commit 1804246

Browse files
authored
[internal] Switch to build with base-images (#89)
Signed-off-by: v.oleynikov <[email protected]>
1 parent bf31f42 commit 1804246

37 files changed

+194
-351
lines changed

.github/workflows/build_dev.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ env:
1010
GOLANG_VERSION: ${{ vars.GOLANG_VERSION }}
1111
GOPROXY: ${{ secrets.GOPROXY }}
1212
SOURCE_REPO: ${{ secrets.SOURCE_REPO }}
13+
BASE_IMAGES_VERSION: "v0.4.3"
1314

1415
on:
1516
#pull_request:
@@ -49,6 +50,7 @@ jobs:
4950
env:
5051
DMT_METRICS_URL: ${{ secrets.DMT_METRICS_URL }}
5152
DMT_METRICS_TOKEN: ${{ secrets.DMT_METRICS_TOKEN }}
53+
5254
set_edition:
5355
runs-on: [self-hosted, large]
5456
name: Set edition
@@ -109,6 +111,12 @@ jobs:
109111
echo MODULE_EDITION=$MODULE_EDITION
110112
111113
- uses: actions/checkout@v4
114+
115+
- name: Download base images
116+
run: |
117+
wget https://fox.flant.com/api/v4/projects/deckhouse%2Fbase-images/packages/generic/base_images/$BASE_IMAGES_VERSION/base_images.yml -O base_images.yml
118+
cat base_images.yml
119+
112120
- uses: deckhouse/modules-actions/setup@v2
113121
with:
114122
registry: ${{ vars.DEV_REGISTRY }}

.github/workflows/build_prod.yml

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ env:
1111
GOLANG_VERSION: ${{ vars.GOLANG_VERSION }}
1212
GOPROXY: ${{ secrets.GOPROXY }}
1313
SOURCE_REPO: ${{ secrets.SOURCE_REPO }}
14+
BASE_IMAGES_VERSION: "v0.4.3"
1415

1516
on:
1617
push:
1718
tags:
18-
- '**'
19+
- "**"
1920

2021
jobs:
2122
prod_ce_setup_build:
@@ -36,6 +37,12 @@ jobs:
3637
name: Show vars
3738
3839
- uses: actions/checkout@v4
40+
41+
- name: Download base images
42+
run: |
43+
wget https://fox.flant.com/api/v4/projects/deckhouse%2Fbase-images/packages/generic/base_images/$BASE_IMAGES_VERSION/base_images.yml -O base_images.yml
44+
cat base_images.yml
45+
3946
- uses: deckhouse/modules-actions/setup@v2
4047
with:
4148
registry: ${{ vars.PROD_REGISTRY }}
@@ -71,6 +78,12 @@ jobs:
7178
name: Show vars
7279
7380
- uses: actions/checkout@v4
81+
82+
- name: Download base images
83+
run: |
84+
wget https://fox.flant.com/api/v4/projects/deckhouse%2Fbase-images/packages/generic/base_images/$BASE_IMAGES_VERSION/base_images.yml -O base_images.yml
85+
cat base_images.yml
86+
7487
- uses: deckhouse/modules-actions/setup@v2
7588
with:
7689
registry: ${{ vars.PROD_REGISTRY }}
@@ -106,6 +119,12 @@ jobs:
106119
name: Show vars
107120
108121
- uses: actions/checkout@v4
122+
123+
- name: Download base images
124+
run: |
125+
wget https://fox.flant.com/api/v4/projects/deckhouse%2Fbase-images/packages/generic/base_images/$BASE_IMAGES_VERSION/base_images.yml -O base_images.yml
126+
cat base_images.yml
127+
109128
- uses: deckhouse/modules-actions/setup@v2
110129
with:
111130
registry: ${{ vars.PROD_REGISTRY }}
@@ -141,6 +160,12 @@ jobs:
141160
name: Show vars
142161
143162
- uses: actions/checkout@v4
163+
164+
- name: Download base images
165+
run: |
166+
wget https://fox.flant.com/api/v4/projects/deckhouse%2Fbase-images/packages/generic/base_images/$BASE_IMAGES_VERSION/base_images.yml -O base_images.yml
167+
cat base_images.yml
168+
144169
- uses: deckhouse/modules-actions/setup@v2
145170
with:
146171
registry: ${{ vars.PROD_REGISTRY }}
@@ -176,6 +201,12 @@ jobs:
176201
name: Show vars
177202
178203
- uses: actions/checkout@v4
204+
205+
- name: Download base images
206+
run: |
207+
wget https://fox.flant.com/api/v4/projects/deckhouse%2Fbase-images/packages/generic/base_images/$BASE_IMAGES_VERSION/base_images.yml -O base_images.yml
208+
cat base_images.yml
209+
179210
- uses: deckhouse/modules-actions/setup@v2
180211
with:
181212
registry: ${{ vars.PROD_REGISTRY }}

.github/workflows/go_checks.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,9 @@ jobs:
172172
pseudo_tag=$(echo "$line" | awk '{print $2}')
173173
174174
echo " Cloning repo $repository into $temp_dir"
175-
git clone "$repository" "$temp_dir/$repository" >/dev/null 2>&1
175+
if [ ! -d "$temp_dir/$repository" ]; then
176+
git clone "$repository" "$temp_dir/$repository" >/dev/null 2>&1
177+
fi
176178
177179
cd "$temp_dir/$repository" || continue
178180
@@ -182,9 +184,10 @@ jobs:
182184
commit_date=$(date -u -d "$commit_date" +"%Y%m%d%H%M%S")
183185
actual_pseudo_tag="v0.0.0-"$commit_date"-"$short_hash
184186
pseudo_tag_date=$(echo $pseudo_tag | awk -F'-' '{ print $2 }')
185-
echo " Latest commit in $repository: $short_hash $commit_date"
186-
187-
if [[ "$module_version" != "$commit_date" ]]; then
187+
echo " Latest pseudo tag for $repository: $pseudo_tag"
188+
echo " Actual pseudo tag for $repository: $actual_pseudo_tag"
189+
190+
if [[ "$pseudo_tag" != "$actual_pseudo_tag" ]]; then
188191
echo " Incorrect pseudo tag for repo $repository in file "$go_mod_file" (current: "$pseudo_tag", actual:"$actual_pseudo_tag")"
189192
echo " Incorrect pseudo tag for repo $repository in file "$go_mod_file" (current: "$pseudo_tag", actual:"$actual_pseudo_tag")" >> $temp_dir"/incorrect_alert"
190193
fi

.werf/base-images.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Base Images
2+
{{- $baseImages := .Files.Get "base_images.yml" | fromYaml }}
3+
{{- range $k, $v := $baseImages }}
4+
{{ $baseImagePath := (printf "%s@%s" $baseImages.REGISTRY_PATH (trimSuffix "/" $v)) }}
5+
{{- if ne $k "REGISTRY_PATH" }}
6+
{{- $_ := set $baseImages $k $baseImagePath }}
7+
{{- end }}
8+
{{- end }}
9+
{{- $_ := unset $baseImages "REGISTRY_PATH" }}
10+
11+
{{- $_ := set . "Images" $baseImages }}
12+
# base images artifacts
13+
{{- range $k, $v := .Images }}
14+
---
15+
image: {{ $k }}
16+
from: {{ $v }}
17+
final: false
18+
{{- end }}
19+

.werf/bundle.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Bundle image, stored in your.registry.io/modules/<module-name>:<semver>
22
---
33
image: bundle
4-
from: {{ $.BASE_SCRATCH }}
4+
fromImage: builder/scratch
55
import:
66
# Rendering .werf/images-digests.yaml is required!
77
- image: images-digests

.werf/choice-edition.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# TODO comment here
22
---
33
image: choice-edition
4-
from: {{ $.BASE_ALT_P11 }}
4+
fromImage: builder/alt
55

66
git:
77
- add: /

.werf/consts.yaml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
# base images
2-
{{- $_ := set . "BASE_GOLANG_1_23" "registry.deckhouse.io/base_images/golang:1.23.6-alpine3.20@sha256:3058c63e0e2532881949c4186414baa24a0f9a8f9349b1853daa49be816f42e9" }}
3-
{{- $_ := set . "BASE_SCRATCH" "registry.deckhouse.io/base_images/scratch@sha256:653ae76965c98c8cd1c8c9ff7725316d2983986f896655b30e0f44d2f8b2dd7e" }}
4-
{{- $_ := set . "BASE_ALT_P11" "registry.deckhouse.io/base_images/alt:p11@sha256:b630220d83798057e1c67fe6f712a49e9c3abb377f0bd7183bba0ba541fc4081" }}
5-
{{- $_ := set . "BASE_ALPINE_3_16" "registry.deckhouse.io/base_images/alpine:3.16.3" }}
6-
{{- $_ := set . "BASE_ALPINE_3_20" "registry.deckhouse.io/base_images/alpine:3.20.3@sha256:41628df7c9b935d248f64542634e7a843f9bc7f2252d7f878e77f7b79a947466" }}
7-
81
# Edition module settings, default ee
92
{{- $_ := set . "MODULE_EDITION" (env "MODULE_EDITION" "ee") }}
103

.werf/images-digests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# Images Digest: a files with all image digests to be able to use them in helm templates of a module
1414
---
1515
image: images-digests
16-
from: {{ $.BASE_ALPINE_3_20 }}
16+
fromImage: builder/alpine
1717
dependencies:
1818
{{- range $ImageID := $ImagesIDList }}
1919
{{- $ImageNameCamel := $ImageID | splitList "/" | last | camelcase | untitle }}

.werf/python-deps.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Python deps image, required to download dependencies and put it to the final module image (bundle)
22
---
33
image: python-dependencies
4-
from: {{ $.BASE_ALPINE_3_16 }}
4+
fromImage: builder/alpine
55
fromCacheVersion: 2024-05-26
66
git:
77
- add: /

.werf/release.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Release image, stored in your.registry.io/modules/<module-name>/release:<semver>
22
---
33
image: release-channel-version-artifact
4-
from: {{ $.BASE_ALPINE_3_20 }}
4+
fromImage: builder/alpine
55
final: false
66
shell:
77
beforeInstall:
@@ -13,7 +13,7 @@ shell:
1313
yq n version "{{ env "CI_COMMIT_REF_NAME" }}" | yq r - -j > version.json
1414
---
1515
image: release-channel-version
16-
from: {{ $.BASE_SCRATCH }}
16+
fromImage: builder/scratch
1717
import:
1818
- image: release-channel-version-artifact
1919
add: /

0 commit comments

Comments
 (0)