From 6cd944822fc96bfdda34daa13ab54a7d5fdb0e17 Mon Sep 17 00:00:00 2001 From: Nadezhda Fedorova Date: Fri, 8 Nov 2024 14:38:12 +0300 Subject: [PATCH 01/24] fix arches for podman building according to https://pkg.go.dev/internal/platform --- .gitea/workflows/wf_full_sis.yaml | 2 +- .gitea/workflows/wf_single.yaml | 2 +- build.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/wf_full_sis.yaml b/.gitea/workflows/wf_full_sis.yaml index 2a347be..b2edc9f 100644 --- a/.gitea/workflows/wf_full_sis.yaml +++ b/.gitea/workflows/wf_full_sis.yaml @@ -54,7 +54,7 @@ jobs: - name: Run building script id: build-script run: | - build_args="-b $BR -o $ORG --skip-images alt/distroless-devel --arches amd64 386 arm64 loongarch64" + build_args="-b $BR -o $ORG --skip-images alt/distroless-devel --arches amd64 386 arm64 loong64" if [[ $ORG == 'k8s' ]]; then build_args="$build_args --tags tags.toml --overwrite-organization $ORG-$BR --skip-images k8s/kube-apiserver k8s/kube-controller-manager k8s/kube-proxy k8s/kube-scheduler"; fi echo "build.py $build_args" ${{ gitea.workspace }}/build.py $build_args diff --git a/.gitea/workflows/wf_single.yaml b/.gitea/workflows/wf_single.yaml index 7319242..8c583b9 100644 --- a/.gitea/workflows/wf_single.yaml +++ b/.gitea/workflows/wf_single.yaml @@ -76,7 +76,7 @@ jobs: id: build-script run: | if [[ "$IM" == *"k8s"* ]]; then k8sarg="--tags=tags.toml --overwrite-organization $ORG-$BR"; else k8sarg=""; fi - if [[ "$BR" = "sisyphus" ]]; then arches="--arches amd64 386 arm64 loongarch64"; else arches="--arches amd64 386 arm64"; fi + if [[ "$BR" = "sisyphus" ]]; then arches="--arches amd64 386 arm64 loong64"; else arches="--arches amd64 386 arm64"; fi echo "build.py -i $IM -b $BR" ${{ gitea.workspace }}/build.py -i $IM -b $BR $arches $k8sarg env: diff --git a/build.py b/build.py index ef1bc9a..7808f91 100755 --- a/build.py +++ b/build.py @@ -638,7 +638,7 @@ class ImagesInfo: def parse_args(): stages = ["build", "remove_dockerfiles", "render_dockerfiles", "push"] - arches = ["amd64", "386", "arm64", "loongarch64", "riscv64"] + arches = ["amd64", "386", "arm64", "loong64", "riscv64"] branches = ["p11", "p10", "sisyphus", "c10f1", "c10f2"] organizations = list(ORG_DIR.iterdir()) images = [f"{o.name}/{i.name}" for o in organizations for i in o.iterdir()] From b046b4ec48f96b85a3324d60f1214bd823cb83f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B0=D0=B4=D0=B5=D0=B6=D0=B4=D0=B0=20=D0=A4=D0=B5?= =?UTF-8?q?=D0=B4=D0=BE=D1=80=D0=BE=D0=B2=D0=B0?= Date: Fri, 8 Nov 2024 15:38:37 +0300 Subject: [PATCH 02/24] fix arch name according to https://pkg.go.dev/internal/platform --- images-info.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images-info.toml b/images-info.toml index 0146e88..b3cecfe 100644 --- a/images-info.toml +++ b/images-info.toml @@ -8,5 +8,5 @@ skip-arches = [ "386" ] skip-branches = [ "c10f2", "c10f1", "p10" ] ["alt/systemd"] -skip-arches = [ "loongarch64" ] +skip-arches = [ "loong64" ] From 5108c6c04cd365602612ebef448db581313c9ae7 Mon Sep 17 00:00:00 2001 From: Alexander Stepchenko Date: Wed, 23 Oct 2024 13:13:53 +0300 Subject: [PATCH 03/24] try automatic package version detection --- build.py | 81 ++++++++++++++++++++++++++++---- org/k8s/kube-apiserver/info.yaml | 5 ++ 2 files changed, 76 insertions(+), 10 deletions(-) create mode 100644 org/k8s/kube-apiserver/info.yaml diff --git a/build.py b/build.py index 7808f91..b7df857 100755 --- a/build.py +++ b/build.py @@ -6,25 +6,56 @@ import json import re import subprocess import textwrap +from dataclasses import dataclass from graphlib import TopologicalSorter from pathlib import Path +import requests import tomli +import yaml from jinja2 import Template - ORG_DIR = Path("org") +PKG_VERSION: str = "" + +@dataclass class Image: - def __init__(self, canonical_name): + canonical_name: str + is_versioned: bool | None + source_packages_list: list[str] | None + + def __init__(self, canonical_name: str): self.canonical_name = canonical_name self.path = ORG_DIR / canonical_name self.base_name = re.sub("^[^/]+/", "", canonical_name) - def __str__(self): - return (f'Image(canonical_name="{self.canonical_name}", ' - f'path="{self.path}", base_name="{self.base_name}")') + info_file = self.path / "info.yaml" + if not info_file.exists(): + self.is_versioned = None + self.source_packages_list = None + return + + info: dict = yaml.safe_load(info_file.read_text()) + + if "is_versioned" not in info: + raise RuntimeError( + f"info.yaml for {self.canonical_name} doesn't contain 'is_versioned' key" + ) + + if "source_packages_list" not in info: + raise RuntimeError( + f"info.yaml for {self.canonical_name} doesn't contain 'source_packages_list' key" + ) + + self.is_versioned = info["is_versioned"] + self.source_packages_list = info["source_packages_list"] + + if self.is_versioned and not self.source_packages_list: + raise RuntimeError( + f"source_packages_list for {self.canonical_name} doesn't contain any values" + ) class Tasks: @@ -49,18 +80,40 @@ class Tasks: ] +def api_get_source_package_version(branch: str, package_name: str) -> str: + api_url = "https://rdb.altlinux.org/api/site/package_versions_from_tasks" + params = {"branch": branch, "name": package_name} + response = requests.get(api_url, params) + if response.status_code != 200: + print(response) + raise RuntimeError( + f"failed to retrieve package version: package {package_name!r}, branch {branch!r} " + ) + + result = response.json() + + return result["versions"][0]["version"] + + class Tags: - def __init__(self, tags_file, latest): + def __init__(self, tags_file: str | None, latest: str): if tags_file is None: self._tags = None else: - tags_file = Path(tags_file) - self._tags = tomli.loads(tags_file.read_text()) + self._tags = tomli.loads(Path(tags_file).read_text()) self._latest = latest - def tags(self, branch, image: Image): + def tags(self, branch: str, image: Image): if self._tags is None: - tags = [branch] + if image.is_versioned and image.source_packages_list: + package_name = image.source_packages_list[0] + if "{version}" in package_name: + assert PKG_VERSION is not None + package_name = package_name.format(version=PKG_VERSION) + version = api_get_source_package_version(branch, package_name) + tags = [version] + else: + tags = [branch] else: tags = self._tags[image.canonical_name][branch].copy() if branch == self._latest: @@ -578,6 +631,7 @@ class DockerBuilder: "--force-rm", f"--manifest={manifest}", f"--platform={platforms}", + f"--build-arg=PKG_VERSION={PKG_VERSION}", ".", ] self.run(build_cmd, cwd=image.path) @@ -749,6 +803,10 @@ def parse_args(): choices=stages, help="list of stages to skip", ) + parser.add_argument( + "--package-version", + help="from which package to build", + ) args = parser.parse_args() args.stages = set(args.stages) - set(args.skip_stages) @@ -760,7 +818,10 @@ def parse_args(): def main(): + global PKG_VERSION + args = parse_args() + PKG_VERSION = args.package_version arches = args.arches images_info = ImagesInfo() tags = Tags(args.tags, args.latest) diff --git a/org/k8s/kube-apiserver/info.yaml b/org/k8s/kube-apiserver/info.yaml new file mode 100644 index 0000000..ad7b709 --- /dev/null +++ b/org/k8s/kube-apiserver/info.yaml @@ -0,0 +1,5 @@ +--- +is_versioned: true +source_packages_list: + - kubernetes{version} +... From 4e076b90fb256524fedafeac2f99aeb61f06f7e1 Mon Sep 17 00:00:00 2001 From: Alexander Stepchenko Date: Wed, 23 Oct 2024 16:15:16 +0300 Subject: [PATCH 04/24] add templating for tag and package name in info.yaml --- build.py | 33 ++++++++++++++++++---------- org/k8s/flannel-cni-plugin/info.yaml | 6 +++++ org/k8s/kube-apiserver/info.yaml | 5 +++-- 3 files changed, 30 insertions(+), 14 deletions(-) create mode 100644 org/k8s/flannel-cni-plugin/info.yaml diff --git a/build.py b/build.py index b7df857..6386507 100755 --- a/build.py +++ b/build.py @@ -24,7 +24,8 @@ PKG_VERSION: str = "" class Image: canonical_name: str is_versioned: bool | None - source_packages_list: list[str] | None + verion_template: str | None + source_packages: list[str] | None def __init__(self, canonical_name: str): self.canonical_name = canonical_name @@ -34,7 +35,7 @@ class Image: info_file = self.path / "info.yaml" if not info_file.exists(): self.is_versioned = None - self.source_packages_list = None + self.source_packages = None return info: dict = yaml.safe_load(info_file.read_text()) @@ -44,19 +45,23 @@ class Image: f"info.yaml for {self.canonical_name} doesn't contain 'is_versioned' key" ) - if "source_packages_list" not in info: + if "source_packages" not in info: raise RuntimeError( - f"info.yaml for {self.canonical_name} doesn't contain 'source_packages_list' key" + f"info.yaml for {self.canonical_name} doesn't contain 'source_packages' key" ) self.is_versioned = info["is_versioned"] - self.source_packages_list = info["source_packages_list"] + self.source_packages = info["source_packages"] - if self.is_versioned and not self.source_packages_list: + if self.is_versioned and not self.source_packages: raise RuntimeError( - f"source_packages_list for {self.canonical_name} doesn't contain any values" + f"source_packages for {self.canonical_name} doesn't contain any values" ) + self.version_template = None + if "version_template" in info: + self.version_template = info["version_template"] + class Tasks: def __init__(self, tasks): @@ -87,7 +92,7 @@ def api_get_source_package_version(branch: str, package_name: str) -> str: if response.status_code != 200: print(response) raise RuntimeError( - f"failed to retrieve package version: package {package_name!r}, branch {branch!r} " + f"failed to retrieve source package version: source package {package_name!r}, branch {branch!r} " ) result = response.json() @@ -105,12 +110,16 @@ class Tags: def tags(self, branch: str, image: Image): if self._tags is None: - if image.is_versioned and image.source_packages_list: - package_name = image.source_packages_list[0] - if "{version}" in package_name: + if image.is_versioned and image.source_packages: + package_name = image.source_packages[0] + if mat := re.search("{{.*}}", package_name): assert PKG_VERSION is not None - package_name = package_name.format(version=PKG_VERSION) + package_name = Template(package_name).render(version=PKG_VERSION) version = api_get_source_package_version(branch, package_name) + + if image.version_template is not None: + version = Template(image.version_template).render(version=version) + tags = [version] else: tags = [branch] diff --git a/org/k8s/flannel-cni-plugin/info.yaml b/org/k8s/flannel-cni-plugin/info.yaml new file mode 100644 index 0000000..4036b6c --- /dev/null +++ b/org/k8s/flannel-cni-plugin/info.yaml @@ -0,0 +1,6 @@ +--- +is_versioned: true +version_template: v{{ version.rsplit('.', 1) | first }}-flannel{{ version.rsplit('.', 1) | last }} +source_packages: + - cni-plugin-flannel +... diff --git a/org/k8s/kube-apiserver/info.yaml b/org/k8s/kube-apiserver/info.yaml index ad7b709..61b1ec9 100644 --- a/org/k8s/kube-apiserver/info.yaml +++ b/org/k8s/kube-apiserver/info.yaml @@ -1,5 +1,6 @@ --- is_versioned: true -source_packages_list: - - kubernetes{version} +version_template: v{{ version }} +source_packages: + - kubernetes{{ version }} ... From 78b55a0422d08730c1e8001d18ae694be2e0632a Mon Sep 17 00:00:00 2001 From: Alexander Stepchenko Date: Wed, 6 Nov 2024 19:51:40 +0300 Subject: [PATCH 05/24] strip whitespace from rendered tag --- build.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build.py b/build.py index 6386507..5751abb 100755 --- a/build.py +++ b/build.py @@ -118,7 +118,9 @@ class Tags: version = api_get_source_package_version(branch, package_name) if image.version_template is not None: - version = Template(image.version_template).render(version=version) + version = ( + Template(image.version_template).render(version=version).strip() + ) tags = [version] else: From 7e8573d3191f9d07c1d3548876dd8d8eae27f482 Mon Sep 17 00:00:00 2001 From: Alexander Stepchenko Date: Wed, 6 Nov 2024 19:52:27 +0300 Subject: [PATCH 06/24] fix installed package for kubernetes images --- org/k8s/coredns/Dockerfile.template | 7 +++++++ org/k8s/kube-apiserver/Dockerfile.template | 4 +++- org/k8s/kube-controller-manager/Dockerfile.template | 4 +++- org/k8s/kube-proxy/Dockerfile.template | 4 +++- org/k8s/kube-scheduler/Dockerfile.template | 4 +++- 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/org/k8s/coredns/Dockerfile.template b/org/k8s/coredns/Dockerfile.template index 6c1d529..82c20f9 100644 --- a/org/k8s/coredns/Dockerfile.template +++ b/org/k8s/coredns/Dockerfile.template @@ -8,6 +8,13 @@ LABEL org.opencontainers.image.source="https://github.com/coredns/coredns" LABEL org.opencontainers.image.licenses="Apache-2.0" LABEL org.opencontainers.image.vendor="ALT Linux Team" +ARG PKG_VERSION + +{% if branch in ["sisyphus", "p11", "c10f2"] %} +{{ install_packages("coredns${PKG_VERSION}") }} +{% else %} {{ install_packages("coredns") }} +{% endif %} + ENTRYPOINT ["/usr/bin/coredns"] diff --git a/org/k8s/kube-apiserver/Dockerfile.template b/org/k8s/kube-apiserver/Dockerfile.template index aa66fef..005a9b6 100644 --- a/org/k8s/kube-apiserver/Dockerfile.template +++ b/org/k8s/kube-apiserver/Dockerfile.template @@ -2,7 +2,9 @@ FROM {{ registry }}{{ alt_image }}:{{ branch }} MAINTAINER alt-cloud -{{ install_packages("kubernetes-master") }} +ARG PKG_VERSION + +{{ install_packages("kubernetes${PKG_VERSION}-master") }} ENTRYPOINT ["/usr/bin/kube-apiserver"] diff --git a/org/k8s/kube-controller-manager/Dockerfile.template b/org/k8s/kube-controller-manager/Dockerfile.template index 9f02488..5acefd4 100644 --- a/org/k8s/kube-controller-manager/Dockerfile.template +++ b/org/k8s/kube-controller-manager/Dockerfile.template @@ -2,7 +2,9 @@ FROM {{ registry }}{{ alt_image }}:{{ branch }} MAINTAINER alt-cloud -{{ install_packages("kubernetes-master") }} +ARG PKG_VERSION + +{{ install_packages("kubernetes${PKG_VERSION}-master") }} ENTRYPOINT ["/usr/bin/kube-controller-manager"] diff --git a/org/k8s/kube-proxy/Dockerfile.template b/org/k8s/kube-proxy/Dockerfile.template index b3a0e41..cacbd8f 100644 --- a/org/k8s/kube-proxy/Dockerfile.template +++ b/org/k8s/kube-proxy/Dockerfile.template @@ -2,7 +2,9 @@ FROM {{ registry }}{{ alt_image }}:{{ branch }} MAINTAINER alt-cloud -{{ install_packages("kubernetes-node") }} +ARG PKG_VERSION + +{{ install_packages("kubernetes${PKG_VERSION}-node") }} RUN ln -s /usr/bin/kube-proxy /usr/local/bin/kube-proxy diff --git a/org/k8s/kube-scheduler/Dockerfile.template b/org/k8s/kube-scheduler/Dockerfile.template index d3fae72..a5bf431 100644 --- a/org/k8s/kube-scheduler/Dockerfile.template +++ b/org/k8s/kube-scheduler/Dockerfile.template @@ -2,7 +2,9 @@ FROM {{ registry }}{{ alt_image }}:{{ branch }} MAINTAINER alt-cloud -{{ install_packages("kubernetes-master") }} +ARG PKG_VERSION + +{{ install_packages("kubernetes${PKG_VERSION}-master") }} ENTRYPOINT ["/usr/bin/kube-scheduler"] From dbe4a3c590e6229e9ab991045642f819cebc8d30 Mon Sep 17 00:00:00 2001 From: Alexander Stepchenko Date: Wed, 6 Nov 2024 20:27:00 +0300 Subject: [PATCH 07/24] add info.yaml files for k8s images --- README.md | 58 +++++++++++++++++++ org/k8s/cert-manager-acmesolver/info.yaml | 6 ++ org/k8s/cert-manager-cainjector/info.yaml | 6 ++ org/k8s/cert-manager-controller/info.yaml | 6 ++ .../cert-manager-startupapicheck/info.yaml | 6 ++ org/k8s/cert-manager-webhook/info.yaml | 6 ++ org/k8s/coredns/info.yaml | 6 ++ org/k8s/etcd/info.yaml | 12 ++++ org/k8s/flannel/info.yaml | 4 ++ org/k8s/kube-controller-manager/info.yaml | 6 ++ org/k8s/kube-proxy/info.yaml | 6 ++ org/k8s/kube-scheduler/info.yaml | 6 ++ org/k8s/kubelet/info.yaml | 6 ++ org/k8s/pause/info.yaml | 5 ++ org/k8s/trivy-node-collector/info.yaml | 6 ++ 15 files changed, 145 insertions(+) create mode 100644 org/k8s/cert-manager-acmesolver/info.yaml create mode 100644 org/k8s/cert-manager-cainjector/info.yaml create mode 100644 org/k8s/cert-manager-controller/info.yaml create mode 100644 org/k8s/cert-manager-startupapicheck/info.yaml create mode 100644 org/k8s/cert-manager-webhook/info.yaml create mode 100644 org/k8s/coredns/info.yaml create mode 100644 org/k8s/etcd/info.yaml create mode 100644 org/k8s/flannel/info.yaml create mode 100644 org/k8s/kube-controller-manager/info.yaml create mode 100644 org/k8s/kube-proxy/info.yaml create mode 100644 org/k8s/kube-scheduler/info.yaml create mode 100644 org/k8s/kubelet/info.yaml create mode 100644 org/k8s/pause/info.yaml create mode 100644 org/k8s/trivy-node-collector/info.yaml diff --git a/README.md b/README.md index d2673dd..4236e63 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,64 @@ the organization ``, run: ``` If you push to the users repository, then organiztion is your username. +## info.yaml format + +- `is_versioned`: **bool** (REQUIRED) + + Whether to use package version as a tag for this image + +- `source_packages`: **list of strings** (REQUIRED) + + List of source packages (src.rpm) this image depends on. + If contains jinja2 template syntax, `--package-version` + CLI option must be specified. + +- `version_template`: **string** (OPTIONAL) + + template to apply when construction the tag, + `version` string variable is available in the template + +### examples + + +#### org/k8s/flannel-cni-plugin + +```yaml +is_versioned: true +version_template: v{{ version.rsplit('.', 1) | first }}-flannel{{ version.rsplit('.', 1) | last }} +source_packages: + - cni-plugin-flannel +``` + +```bash +./build.py -i k8s/flannel-cni-plugin +``` + +#### org/k8s/kube-apiserver + +```yaml +is_versioned: true +version_template: v{{ version }} +source_packages: + - kubernetes{{ version }} +``` + +```bash +./build.py -i k8s/kube-apiserver --package-version 1.31 +``` + +#### org/k8s/pause + +```yaml +is_versioned: true +source_packages: + - kubernetes-pause +``` + +```bash +./build.py -i k8s/pause +``` + ## Dependencies On x86_64 machine using p10 branch you need: - `python3-module-tomli` diff --git a/org/k8s/cert-manager-acmesolver/info.yaml b/org/k8s/cert-manager-acmesolver/info.yaml new file mode 100644 index 0000000..4062c23 --- /dev/null +++ b/org/k8s/cert-manager-acmesolver/info.yaml @@ -0,0 +1,6 @@ +--- +is_versioned: true +version_template: v{{ version }} +source_packages: + - cert-manager +... diff --git a/org/k8s/cert-manager-cainjector/info.yaml b/org/k8s/cert-manager-cainjector/info.yaml new file mode 100644 index 0000000..4062c23 --- /dev/null +++ b/org/k8s/cert-manager-cainjector/info.yaml @@ -0,0 +1,6 @@ +--- +is_versioned: true +version_template: v{{ version }} +source_packages: + - cert-manager +... diff --git a/org/k8s/cert-manager-controller/info.yaml b/org/k8s/cert-manager-controller/info.yaml new file mode 100644 index 0000000..4062c23 --- /dev/null +++ b/org/k8s/cert-manager-controller/info.yaml @@ -0,0 +1,6 @@ +--- +is_versioned: true +version_template: v{{ version }} +source_packages: + - cert-manager +... diff --git a/org/k8s/cert-manager-startupapicheck/info.yaml b/org/k8s/cert-manager-startupapicheck/info.yaml new file mode 100644 index 0000000..4062c23 --- /dev/null +++ b/org/k8s/cert-manager-startupapicheck/info.yaml @@ -0,0 +1,6 @@ +--- +is_versioned: true +version_template: v{{ version }} +source_packages: + - cert-manager +... diff --git a/org/k8s/cert-manager-webhook/info.yaml b/org/k8s/cert-manager-webhook/info.yaml new file mode 100644 index 0000000..4062c23 --- /dev/null +++ b/org/k8s/cert-manager-webhook/info.yaml @@ -0,0 +1,6 @@ +--- +is_versioned: true +version_template: v{{ version }} +source_packages: + - cert-manager +... diff --git a/org/k8s/coredns/info.yaml b/org/k8s/coredns/info.yaml new file mode 100644 index 0000000..4c6f718 --- /dev/null +++ b/org/k8s/coredns/info.yaml @@ -0,0 +1,6 @@ +--- +is_versioned: true +version_template: v{{ version }} +source_packages: + - coredns{{ version }} +... diff --git a/org/k8s/etcd/info.yaml b/org/k8s/etcd/info.yaml new file mode 100644 index 0000000..2d5c430 --- /dev/null +++ b/org/k8s/etcd/info.yaml @@ -0,0 +1,12 @@ +--- +is_versioned: true +version_template: > + {% set version_patch = version.split(".")[2] | int %} + {% if version_patch < 16 %} + {{ version }}-0 + {% else %} + v{{ version }} + {% endif %} +source_packages: + - etcd +... diff --git a/org/k8s/flannel/info.yaml b/org/k8s/flannel/info.yaml new file mode 100644 index 0000000..7e8b75a --- /dev/null +++ b/org/k8s/flannel/info.yaml @@ -0,0 +1,4 @@ +is_versioned: true +version_template: v{{ version }} +source_packages: + - flannel diff --git a/org/k8s/kube-controller-manager/info.yaml b/org/k8s/kube-controller-manager/info.yaml new file mode 100644 index 0000000..61b1ec9 --- /dev/null +++ b/org/k8s/kube-controller-manager/info.yaml @@ -0,0 +1,6 @@ +--- +is_versioned: true +version_template: v{{ version }} +source_packages: + - kubernetes{{ version }} +... diff --git a/org/k8s/kube-proxy/info.yaml b/org/k8s/kube-proxy/info.yaml new file mode 100644 index 0000000..61b1ec9 --- /dev/null +++ b/org/k8s/kube-proxy/info.yaml @@ -0,0 +1,6 @@ +--- +is_versioned: true +version_template: v{{ version }} +source_packages: + - kubernetes{{ version }} +... diff --git a/org/k8s/kube-scheduler/info.yaml b/org/k8s/kube-scheduler/info.yaml new file mode 100644 index 0000000..61b1ec9 --- /dev/null +++ b/org/k8s/kube-scheduler/info.yaml @@ -0,0 +1,6 @@ +--- +is_versioned: true +version_template: v{{ version }} +source_packages: + - kubernetes{{ version }} +... diff --git a/org/k8s/kubelet/info.yaml b/org/k8s/kubelet/info.yaml new file mode 100644 index 0000000..61b1ec9 --- /dev/null +++ b/org/k8s/kubelet/info.yaml @@ -0,0 +1,6 @@ +--- +is_versioned: true +version_template: v{{ version }} +source_packages: + - kubernetes{{ version }} +... diff --git a/org/k8s/pause/info.yaml b/org/k8s/pause/info.yaml new file mode 100644 index 0000000..b676a6f --- /dev/null +++ b/org/k8s/pause/info.yaml @@ -0,0 +1,5 @@ +--- +is_versioned: true +source_packages: + - kubernetes-pause +... diff --git a/org/k8s/trivy-node-collector/info.yaml b/org/k8s/trivy-node-collector/info.yaml new file mode 100644 index 0000000..61b1ec9 --- /dev/null +++ b/org/k8s/trivy-node-collector/info.yaml @@ -0,0 +1,6 @@ +--- +is_versioned: true +version_template: v{{ version }} +source_packages: + - kubernetes{{ version }} +... From 755192850870ab83634db4c4e1f3dd5a38f3e524 Mon Sep 17 00:00:00 2001 From: Alexander Stepchenko Date: Wed, 6 Nov 2024 20:48:24 +0300 Subject: [PATCH 08/24] make PKG_VERSION into a dictionary of PKG_VERSIONS --- README.md | 2 +- build.py | 24 ++++++++++++++++-------- org/k8s/trivy-node-collector/info.yaml | 3 +-- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 4236e63..e57c409 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ source_packages: ``` ```bash -./build.py -i k8s/kube-apiserver --package-version 1.31 +./build.py -b sisyphus -i k8s/kube-apiserver --package-version '{"k8s/kube-apiserver": "1.31"}' ``` #### org/k8s/pause diff --git a/build.py b/build.py index 5751abb..b60191d 100755 --- a/build.py +++ b/build.py @@ -17,7 +17,7 @@ from jinja2 import Template ORG_DIR = Path("org") -PKG_VERSION: str = "" +PKG_VERSIONS: dict = {} @dataclass @@ -113,8 +113,10 @@ class Tags: if image.is_versioned and image.source_packages: package_name = image.source_packages[0] if mat := re.search("{{.*}}", package_name): - assert PKG_VERSION is not None - package_name = Template(package_name).render(version=PKG_VERSION) + assert PKG_VERSIONS is not None + package_name = Template(package_name).render( + version=PKG_VERSIONS[image.canonical_name] + ) version = api_get_source_package_version(branch, package_name) if image.version_template is not None: @@ -642,9 +644,14 @@ class DockerBuilder: "--force-rm", f"--manifest={manifest}", f"--platform={platforms}", - f"--build-arg=PKG_VERSION={PKG_VERSION}", ".", ] + + if PKG_VERSIONS is not None and image.canonical_name in PKG_VERSIONS: + build_cmd.insert( + -1, f"--build-arg=PKG_VERSION={PKG_VERSIONS[image.canonical_name]}" + ) + self.run(build_cmd, cwd=image.path) for tag in tags[1:]: @@ -815,8 +822,9 @@ def parse_args(): help="list of stages to skip", ) parser.add_argument( - "--package-version", - help="from which package to build", + "--package-versions", + type=json.loads, + help="json string where key is image name, value is the package version", ) args = parser.parse_args() @@ -829,10 +837,10 @@ def parse_args(): def main(): - global PKG_VERSION + global PKG_VERSIONS args = parse_args() - PKG_VERSION = args.package_version + PKG_VERSIONS = args.package_versions arches = args.arches images_info = ImagesInfo() tags = Tags(args.tags, args.latest) diff --git a/org/k8s/trivy-node-collector/info.yaml b/org/k8s/trivy-node-collector/info.yaml index 61b1ec9..791a0ee 100644 --- a/org/k8s/trivy-node-collector/info.yaml +++ b/org/k8s/trivy-node-collector/info.yaml @@ -1,6 +1,5 @@ --- is_versioned: true -version_template: v{{ version }} source_packages: - - kubernetes{{ version }} + - k8s-trivy-node-collector ... From 4ea046dcf8ae27d9e8aede7580ec59621e0e07f0 Mon Sep 17 00:00:00 2001 From: Alexander Stepchenko Date: Wed, 6 Nov 2024 21:23:24 +0300 Subject: [PATCH 09/24] define ARG only if needed, allow jinja2 control flow in package names --- build.py | 23 +++++++++++++++++++++-- org/k8s/coredns/Dockerfile.template | 2 +- org/k8s/coredns/info.yaml | 7 ++++++- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/build.py b/build.py index b60191d..ffc05ee 100755 --- a/build.py +++ b/build.py @@ -17,7 +17,7 @@ from jinja2 import Template ORG_DIR = Path("org") -PKG_VERSIONS: dict = {} +PKG_VERSIONS: dict | None = None @dataclass @@ -112,8 +112,27 @@ class Tags: if self._tags is None: if image.is_versioned and image.source_packages: package_name = image.source_packages[0] + + if mat := re.search("{%.*%}", package_name): + package_name = Template(package_name).render(branch=branch).strip() + print(f"{package_name=}") + if mat := re.search("{{.*}}", package_name): - assert PKG_VERSIONS is not None + if PKG_VERSIONS is None: + raise RuntimeError( + f"--package-versions option is not specified, required for {image.canonical_name!r}" + ) + + if image.canonical_name not in PKG_VERSIONS: + raise RuntimeError( + f"--package-versions option does not contain version for image {image.canonical_name!r}" + ) + + if not PKG_VERSIONS[image.canonical_name]: + raise RuntimeError( + f"invalid version for image {image.canonical_name!r}: {PKG_VERSIONS[image.canonical_name]!r}" + ) + package_name = Template(package_name).render( version=PKG_VERSIONS[image.canonical_name] ) diff --git a/org/k8s/coredns/Dockerfile.template b/org/k8s/coredns/Dockerfile.template index 82c20f9..11e0631 100644 --- a/org/k8s/coredns/Dockerfile.template +++ b/org/k8s/coredns/Dockerfile.template @@ -8,9 +8,9 @@ LABEL org.opencontainers.image.source="https://github.com/coredns/coredns" LABEL org.opencontainers.image.licenses="Apache-2.0" LABEL org.opencontainers.image.vendor="ALT Linux Team" +{% if branch in ["sisyphus", "p11", "c10f2"] %} ARG PKG_VERSION -{% if branch in ["sisyphus", "p11", "c10f2"] %} {{ install_packages("coredns${PKG_VERSION}") }} {% else %} {{ install_packages("coredns") }} diff --git a/org/k8s/coredns/info.yaml b/org/k8s/coredns/info.yaml index 4c6f718..431ee02 100644 --- a/org/k8s/coredns/info.yaml +++ b/org/k8s/coredns/info.yaml @@ -2,5 +2,10 @@ is_versioned: true version_template: v{{ version }} source_packages: - - coredns{{ version }} + - > + {% if branch in ["sisyphus", "p11", "c10f2"] %} + {% raw %}coredns{{ version }}{% endraw %} + {% else %} + coredns + {% endif %} ... From 3b99b6eed2e4c6b46514abcdc3e70b7b13de1b20 Mon Sep 17 00:00:00 2001 From: Alexander Stepchenko Date: Wed, 6 Nov 2024 21:25:14 +0300 Subject: [PATCH 10/24] remove unused variables --- build.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.py b/build.py index ffc05ee..51a40bc 100755 --- a/build.py +++ b/build.py @@ -113,11 +113,11 @@ class Tags: if image.is_versioned and image.source_packages: package_name = image.source_packages[0] - if mat := re.search("{%.*%}", package_name): + if re.search("{%.*%}", package_name): package_name = Template(package_name).render(branch=branch).strip() print(f"{package_name=}") - if mat := re.search("{{.*}}", package_name): + if re.search("{{.*}}", package_name): if PKG_VERSIONS is None: raise RuntimeError( f"--package-versions option is not specified, required for {image.canonical_name!r}" From f772e861eff91bfe5fd00a7d8f6007d128400ccb Mon Sep 17 00:00:00 2001 From: Nadezhda Fedorova Date: Mon, 11 Nov 2024 12:27:59 +0300 Subject: [PATCH 11/24] add new argument to run building k8s --- .gitea/workflows/wf_full_sis.yaml | 14 +++++++------- .gitea/workflows/wf_single.yaml | 26 +++++++++++++++----------- images-info.toml | 3 --- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/.gitea/workflows/wf_full_sis.yaml b/.gitea/workflows/wf_full_sis.yaml index b2edc9f..c20371a 100644 --- a/.gitea/workflows/wf_full_sis.yaml +++ b/.gitea/workflows/wf_full_sis.yaml @@ -35,19 +35,19 @@ jobs: apt-get install -y qemu-user-static-binfmt-aarch64 qemu-user-static-binfmt-arm qemu-user-static-binfmt-ppc qemu-user-static-binfmt-riscv qemu-user-static-binfmt-loongarch - name: Check out current repo uses: actions/checkout@v4 - - name: Parse target branch and tag from events context, save to env + - name: Parse target branch and tag from events context, save to env env: - EV: ${{ toJson(gitea.event) }} + EV: ${{ toJson(gitea.event) }} run: | echo $EV | jq '.ref' -r | sed "s/refs\/tags\//BRANCH=/g" | cut -d '_' -f 1 echo $EV | jq '.ref' -r | sed "s/refs\/tags\//BRANCH=/g" | cut -d '_' -f 1 >> ${GITHUB_ENV} org=$(echo $EV | jq '.ref' -r | sed 's/refs\/tags\///g' | cut -d '_' -f 2) - echo "ORG=$org" >> ${GITHUB_ENV} + echo "ORG=$org" >> ${GITHUB_ENV} echo "ORG=$org" - name: Login podman gitea run: | echo "podman login ${{ env.URL }}" - podman login --username $P_USER --password $P_PASS ${{ env.URL }} + podman login --username $P_USER --password $P_PASS ${{ env.URL }} env: P_USER: ${{ secrets.PODMAN_USER }} P_PASS: ${{ secrets.PODMAN_PASS }} @@ -55,7 +55,7 @@ jobs: id: build-script run: | build_args="-b $BR -o $ORG --skip-images alt/distroless-devel --arches amd64 386 arm64 loong64" - if [[ $ORG == 'k8s' ]]; then build_args="$build_args --tags tags.toml --overwrite-organization $ORG-$BR --skip-images k8s/kube-apiserver k8s/kube-controller-manager k8s/kube-proxy k8s/kube-scheduler"; fi + if [[ $ORG == 'k8s' ]]; then build_args="$build_args --overwrite-organization $ORG-$BR --package-versions '{"k8s/kube-apiserver": "1.31", "k8s/kube-scheduler": "1.31","k8s/kube-controller-manager": "1.31","k8s/kube-proxy": "1.31","k8s/coredns": "1.11.3"}'"; fi echo "build.py $build_args" ${{ gitea.workspace }}/build.py $build_args env: @@ -78,7 +78,7 @@ jobs: run: | tagname=$(echo $EV | jq '.ref' -r | sed "s/refs\/tags\///g") curl -X 'DELETE' "$URL/api/v1/repos/$REPO/image-forge/tags/$tagname?token=$T" -H 'accept: application/json' -s - echo "tag $tagname is deleted" + echo "tag $tagname is deleted" env: T: ${{ secrets.TOKEN }} BR: ${{ env.BRANCH }} @@ -87,7 +87,7 @@ jobs: EV: ${{ toJson(gitea.event) }} test-process: needs: build-process - if: ${{ needs.build-process.outputs.buildres == 'success' }} + if: ${{ needs.build-process.outputs.buildres == 'success' && needs.build-process.outputs.org != 'k8s' }} runs-on: alt-sisyphus steps: - name: Update apt diff --git a/.gitea/workflows/wf_single.yaml b/.gitea/workflows/wf_single.yaml index 8c583b9..7178468 100644 --- a/.gitea/workflows/wf_single.yaml +++ b/.gitea/workflows/wf_single.yaml @@ -2,7 +2,7 @@ name: Building alt images on: push: tags: - - '*_*/*' + - '*_*/*_*' jobs: build-process: @@ -52,35 +52,39 @@ jobs: P_PASS: ${{ secrets.PODMAN_PASS }} - name: Check files in the repository run: | - ls -a ${{ gitea.workspace }} + ls -a ${{ gitea.workspace }} - name: Parse target branch and tag from events context, save to env env: - EV: ${{ toJson(gitea.event) }} + EV: ${{ toJson(gitea.event) }} run: | echo $EV | jq '.ref' -r | sed "s/refs\/tags\//BRANCH=/g" | cut -d '_' -f 1 echo $EV | jq '.ref' -r | sed "s/refs\/tags\//BRANCH=/g" | cut -d '_' -f 1 >> ${GITHUB_ENV} localimage=$(echo $EV | jq '.ref' -r | sed 's/refs\/tags\///g' | cut -d '_' -f 2) - echo "IMAGE=$localimage" >> ${GITHUB_ENV} + echo "IMAGE=$localimage" >> ${GITHUB_ENV} echo "IMAGE=$localimage" org=$(echo "$localimage" | cut -d '/' -f 1) echo "ORG=$org" >> ${GITHUB_ENV} echo "ORG=$org" + ver=$(echo $EV | jq '.ref' -r | sed 's/refs\/tags\///g' | cut -d '_' -f 3) + echo "VER=$ver" >> ${GITHUB_ENV} + echo "VER=$ver" - name: Get test for image run: | if test -f ${{ gitea.workspace }}/org/$IM/test; then testscript=$(cat ${{ gitea.workspace }}/org/$IM/test); else testscript=""; fi - echo "TEST=$testscript" >> ${GITHUB_ENV} - env: + echo "TEST=$testscript" >> ${GITHUB_ENV} + env: IM: ${{ env.IMAGE }} BR: ${{ env.BRANCH }} - name: Run building script id: build-script run: | - if [[ "$IM" == *"k8s"* ]]; then k8sarg="--tags=tags.toml --overwrite-organization $ORG-$BR"; else k8sarg=""; fi + if [[ "$IM" == *"k8s"* ]]; then k8sarg="--overwrite-organization $ORG-$BR --package-versions '{\"$IM\":\"$VER\"}'"; else k8sarg=""; fi if [[ "$BR" = "sisyphus" ]]; then arches="--arches amd64 386 arm64 loong64"; else arches="--arches amd64 386 arm64"; fi echo "build.py -i $IM -b $BR" - ${{ gitea.workspace }}/build.py -i $IM -b $BR $arches $k8sarg + ${{ gitea.workspace }}/build.py -i $IM -b $BR $arches $k8sarg env: IM: ${{ env.IMAGE }} + VER: ${{ env.VER }} BR: ${{ env.BRANCH }} ORG: ${{ env.ORG }} continue-on-error: true @@ -90,7 +94,7 @@ jobs: issueid=1 body="Building image $IM finish with some errors." curl -X 'POST' "$URL/api/v1/repos/$REPO/image-forge/issues/$issueid/comments?token=$T" -H 'accept: application/json' -H 'Content-Type: application/json' -d "{ \"body\": \"$body\" }" -s - echo "notification about test error is sent to issue $issueid" + echo "notification about test error is sent to issue $issueid" env: T: ${{ secrets.TOKEN }} BR: ${{ env.BRANCH }} @@ -101,7 +105,7 @@ jobs: run: | tagname=$(echo $EV | jq '.ref' -r | sed "s/refs\/tags\///g") curl -X 'DELETE' "$URL/api/v1/repos/$REPO/image-forge/tags/$tagname?token=$T" -H 'accept: application/json' -s - echo "tag $tagname is deleted" + echo "tag $tagname is deleted" env: T: ${{ secrets.TOKEN }} BR: ${{ env.BRANCH }} @@ -125,7 +129,7 @@ jobs: continue-on-error: true run: | if [[ "$IM" == *"k8s"* ]]; then echo "skip tests for k8s images"; else podman run --rm --entrypoint="/bin/sh" $URL/$IM:$BR -c "$TEST"; fi - env: + env: IM: ${{ needs.build-process.outputs.image }} BR: ${{ needs.build-process.outputs.branch }} URL: ${{ needs.build-process.outputs.url }} diff --git a/images-info.toml b/images-info.toml index b3cecfe..2788122 100644 --- a/images-info.toml +++ b/images-info.toml @@ -7,6 +7,3 @@ skip-arches = [ "386" ] ["alt/ansible"] skip-branches = [ "c10f2", "c10f1", "p10" ] -["alt/systemd"] -skip-arches = [ "loong64" ] - From c947762e9e6565b4ca2fce6a6f43fe3a93ff69d4 Mon Sep 17 00:00:00 2001 From: Nadezhda Fedorova Date: Mon, 11 Nov 2024 16:13:38 +0300 Subject: [PATCH 12/24] fix workflow commands quotes bug --- .gitea/workflows/wf_full_sis.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/wf_full_sis.yaml b/.gitea/workflows/wf_full_sis.yaml index c20371a..a48e1d4 100644 --- a/.gitea/workflows/wf_full_sis.yaml +++ b/.gitea/workflows/wf_full_sis.yaml @@ -55,7 +55,7 @@ jobs: id: build-script run: | build_args="-b $BR -o $ORG --skip-images alt/distroless-devel --arches amd64 386 arm64 loong64" - if [[ $ORG == 'k8s' ]]; then build_args="$build_args --overwrite-organization $ORG-$BR --package-versions '{"k8s/kube-apiserver": "1.31", "k8s/kube-scheduler": "1.31","k8s/kube-controller-manager": "1.31","k8s/kube-proxy": "1.31","k8s/coredns": "1.11.3"}'"; fi + if [[ $ORG == 'k8s' ]]; then build_args="$build_args --overwrite-organization $ORG-$BR --package-versions '{\"k8s/kube-apiserver\": \"1.31\", \"k8s/kube-scheduler\": \"1.31\",\"k8s/kube-controller-manager\": \"1.31\",\"k8s/kube-proxy\": \"1.31\",\"k8s/coredns\": \"1.11.3\"}'"; fi echo "build.py $build_args" ${{ gitea.workspace }}/build.py $build_args env: From 10eee3896fc07e637aa07aa978df048e68fc6c04 Mon Sep 17 00:00:00 2001 From: Nadezhda Fedorova Date: Mon, 11 Nov 2024 16:37:04 +0300 Subject: [PATCH 13/24] add new python modules to workflows --- .gitea/workflows/wf_full_p10.yaml | 4 ++-- .gitea/workflows/wf_full_p11.yaml | 4 ++-- .gitea/workflows/wf_full_sis.yaml | 4 ++-- .gitea/workflows/wf_single.yaml | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.gitea/workflows/wf_full_p10.yaml b/.gitea/workflows/wf_full_p10.yaml index d5b5823..a5581a9 100644 --- a/.gitea/workflows/wf_full_p10.yaml +++ b/.gitea/workflows/wf_full_p10.yaml @@ -36,8 +36,8 @@ jobs: uses: actions/init-alt-env@v1 - name: Install requires run: | - echo "apt-get install -y python3-module-tomli python3-module-jinja2 podman buildah jq curl" - apt-get install -y python3-module-tomli python3-module-jinja2 podman buildah jq curl + echo "apt-get install -y python3-module-tomli python3-module-jinja2 python3-module-yaml python3-module-requests podman buildah jq curl" + apt-get install -y python3-module-tomli python3-module-jinja2 python3-module-yaml python3-module-requests podman buildah jq curl echo "apt-get install -y qemu-user-static-binfmt-aarch64 qemu-user-static-binfmt-arm qemu-user-static-binfmt-ppc qemu-user-static-binfmt-riscv qemu-user-static-binfmt-loongarch" apt-get install -y qemu-user-static-binfmt-aarch64 qemu-user-static-binfmt-arm qemu-user-static-binfmt-ppc qemu-user-static-binfmt-riscv qemu-user-static-binfmt-loongarch - name: Check out current repo diff --git a/.gitea/workflows/wf_full_p11.yaml b/.gitea/workflows/wf_full_p11.yaml index 25addd1..358a5c1 100644 --- a/.gitea/workflows/wf_full_p11.yaml +++ b/.gitea/workflows/wf_full_p11.yaml @@ -36,8 +36,8 @@ jobs: uses: actions/init-alt-env@v1 - name: Install requires run: | - echo "apt-get install -y python3-module-tomli python3-module-jinja2 podman buildah jq curl" - apt-get install -y python3-module-tomli python3-module-jinja2 podman buildah jq curl + echo "apt-get install -y python3-module-tomli python3-module-jinja2 python3-module-yaml python3-module-requests podman buildah jq curl" + apt-get install -y python3-module-tomli python3-module-jinja2 python3-module-yaml python3-module-requests podman buildah jq curl echo "apt-get install -y qemu-user-static-binfmt-aarch64 qemu-user-static-binfmt-arm qemu-user-static-binfmt-ppc qemu-user-static-binfmt-riscv qemu-user-static-binfmt-loongarch" apt-get install -y qemu-user-static-binfmt-aarch64 qemu-user-static-binfmt-arm qemu-user-static-binfmt-ppc qemu-user-static-binfmt-riscv qemu-user-static-binfmt-loongarch - name: Check out current repo diff --git a/.gitea/workflows/wf_full_sis.yaml b/.gitea/workflows/wf_full_sis.yaml index a48e1d4..91487c4 100644 --- a/.gitea/workflows/wf_full_sis.yaml +++ b/.gitea/workflows/wf_full_sis.yaml @@ -29,8 +29,8 @@ jobs: uses: actions/init-alt-env@v1 - name: Install requires run: | - echo "apt-get install -y python3-module-tomli python3-module-jinja2 podman buildah jq curl" - apt-get install -y python3-module-tomli python3-module-jinja2 podman buildah jq curl + echo "apt-get install -y python3-module-tomli python3-module-jinja2 python3-module-yaml python3-module-requests podman buildah jq curl" + apt-get install -y python3-module-tomli python3-module-jinja2 python3-module-yaml python3-module-requests podman buildah jq curl echo "apt-get install -y qemu-user-static-binfmt-aarch64 qemu-user-static-binfmt-arm qemu-user-static-binfmt-ppc qemu-user-static-binfmt-riscv qemu-user-static-binfmt-loongarch" apt-get install -y qemu-user-static-binfmt-aarch64 qemu-user-static-binfmt-arm qemu-user-static-binfmt-ppc qemu-user-static-binfmt-riscv qemu-user-static-binfmt-loongarch - name: Check out current repo diff --git a/.gitea/workflows/wf_single.yaml b/.gitea/workflows/wf_single.yaml index 7178468..ff6b5a3 100644 --- a/.gitea/workflows/wf_single.yaml +++ b/.gitea/workflows/wf_single.yaml @@ -37,8 +37,8 @@ jobs: uses: actions/init-alt-env@v1 - name: Install requires run: | - echo "apt-get install -y python3-module-tomli python3-module-jinja2 podman buildah jq curl" - apt-get install -y python3-module-tomli python3-module-jinja2 podman buildah jq curl + echo "apt-get install -y python3-module-tomli python3-module-jinja2 python3-module-yaml python3-module-requests podman buildah jq curl" + apt-get install -y python3-module-tomli python3-module-jinja2 python3-module-yaml python3-module-requests podman buildah jq curl echo "apt-get install -y qemu-user-static-binfmt-aarch64 qemu-user-static-binfmt-arm qemu-user-static-binfmt-ppc qemu-user-static-binfmt-riscv qemu-user-static-binfmt-loongarch" apt-get install -y qemu-user-static-binfmt-aarch64 qemu-user-static-binfmt-arm qemu-user-static-binfmt-ppc qemu-user-static-binfmt-riscv qemu-user-static-binfmt-loongarch - name: Check out current repo From a34788f70176bbea6b98389619101be8654556d5 Mon Sep 17 00:00:00 2001 From: Nadezhda Fedorova Date: Mon, 11 Nov 2024 17:12:15 +0300 Subject: [PATCH 14/24] fix run new build process --- .gitea/workflows/wf_full_sis.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/wf_full_sis.yaml b/.gitea/workflows/wf_full_sis.yaml index 91487c4..aeff94b 100644 --- a/.gitea/workflows/wf_full_sis.yaml +++ b/.gitea/workflows/wf_full_sis.yaml @@ -55,7 +55,7 @@ jobs: id: build-script run: | build_args="-b $BR -o $ORG --skip-images alt/distroless-devel --arches amd64 386 arm64 loong64" - if [[ $ORG == 'k8s' ]]; then build_args="$build_args --overwrite-organization $ORG-$BR --package-versions '{\"k8s/kube-apiserver\": \"1.31\", \"k8s/kube-scheduler\": \"1.31\",\"k8s/kube-controller-manager\": \"1.31\",\"k8s/kube-proxy\": \"1.31\",\"k8s/coredns\": \"1.11.3\"}'"; fi + if [[ $ORG == 'k8s' ]]; then build_args="$build_args --overwrite-organization $ORG-$BR --package-versions '{"k8s/kube-apiserver": "1.31", "k8s/kube-scheduler": "1.31","k8s/kube-controller-manager": "1.31","k8s/kube-proxy": "1.31","k8s/coredns": "1.11.3"}'"; fi echo "build.py $build_args" ${{ gitea.workspace }}/build.py $build_args env: From 34bdff67552719f8f5980da81d3f52dad07145bc Mon Sep 17 00:00:00 2001 From: Nadezhda Fedorova Date: Mon, 11 Nov 2024 17:32:27 +0300 Subject: [PATCH 15/24] fix run new build process --- .gitea/workflows/wf_full_sis.yaml | 2 +- .gitea/workflows/wf_single.yaml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/wf_full_sis.yaml b/.gitea/workflows/wf_full_sis.yaml index aeff94b..a72030f 100644 --- a/.gitea/workflows/wf_full_sis.yaml +++ b/.gitea/workflows/wf_full_sis.yaml @@ -55,7 +55,7 @@ jobs: id: build-script run: | build_args="-b $BR -o $ORG --skip-images alt/distroless-devel --arches amd64 386 arm64 loong64" - if [[ $ORG == 'k8s' ]]; then build_args="$build_args --overwrite-organization $ORG-$BR --package-versions '{"k8s/kube-apiserver": "1.31", "k8s/kube-scheduler": "1.31","k8s/kube-controller-manager": "1.31","k8s/kube-proxy": "1.31","k8s/coredns": "1.11.3"}'"; fi + if [[ $ORG == 'k8s' ]]; then build_args="$build_args --overwrite-organization $ORG-$BR --package-versions {\"k8s/kube-apiserver\":\"1.31\",\"k8s/kube-scheduler\":\"1.31\",\"k8s/kube-controller-manager\":\"1.31\",\"k8s/kube-proxy\":\"1.31\",\"k8s/coredns\":\"1.11.3\"}"; fi echo "build.py $build_args" ${{ gitea.workspace }}/build.py $build_args env: diff --git a/.gitea/workflows/wf_single.yaml b/.gitea/workflows/wf_single.yaml index ff6b5a3..1333d54 100644 --- a/.gitea/workflows/wf_single.yaml +++ b/.gitea/workflows/wf_single.yaml @@ -48,7 +48,7 @@ jobs: echo "podman login ${{ env.URL }}" podman login --username $P_USER --password $P_PASS ${{ env.URL }} env: - P_USER: ${{ secrets.PODMAN_USER }} + P_USER: ${{ secrets.PODMAN_USER }}' P_PASS: ${{ secrets.PODMAN_PASS }} - name: Check files in the repository run: | @@ -78,7 +78,7 @@ jobs: - name: Run building script id: build-script run: | - if [[ "$IM" == *"k8s"* ]]; then k8sarg="--overwrite-organization $ORG-$BR --package-versions '{\"$IM\":\"$VER\"}'"; else k8sarg=""; fi + if [[ "$IM" == *"k8s"* ]]; then k8sarg="--overwrite-organization $ORG-$BR --package-versions {\"$IM\":\"$VER\"}"; else k8sarg=""; fi if [[ "$BR" = "sisyphus" ]]; then arches="--arches amd64 386 arm64 loong64"; else arches="--arches amd64 386 arm64"; fi echo "build.py -i $IM -b $BR" ${{ gitea.workspace }}/build.py -i $IM -b $BR $arches $k8sarg From a1571acc55170ea994317345084bc7811c4d4574 Mon Sep 17 00:00:00 2001 From: Nadezhda Fedorova Date: Mon, 11 Nov 2024 17:47:43 +0300 Subject: [PATCH 16/24] add faile-builded images to skip-list --- images-info.toml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/images-info.toml b/images-info.toml index 2788122..acd8efa 100644 --- a/images-info.toml +++ b/images-info.toml @@ -7,3 +7,8 @@ skip-arches = [ "386" ] ["alt/ansible"] skip-branches = [ "c10f2", "c10f1", "p10" ] +["alt/distroless-base"] +skip-arches = [ "loong64" ] + +["alt/distroless-gotop"] +skip-arches = [ "loong64" ] From e575a1f23c585cac7e5727fdbfb9021e8d4c0a05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B0=D0=B4=D0=B5=D0=B6=D0=B4=D0=B0=20=D0=A4=D0=B5?= =?UTF-8?q?=D0=B4=D0=BE=D1=80=D0=BE=D0=B2=D0=B0?= Date: Mon, 11 Nov 2024 18:04:27 +0300 Subject: [PATCH 17/24] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20.gitea/workflows/wf=5Fsingle.yaml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/wf_single.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/wf_single.yaml b/.gitea/workflows/wf_single.yaml index 1333d54..c30908b 100644 --- a/.gitea/workflows/wf_single.yaml +++ b/.gitea/workflows/wf_single.yaml @@ -48,7 +48,7 @@ jobs: echo "podman login ${{ env.URL }}" podman login --username $P_USER --password $P_PASS ${{ env.URL }} env: - P_USER: ${{ secrets.PODMAN_USER }}' + P_USER: ${{ secrets.PODMAN_USER }} P_PASS: ${{ secrets.PODMAN_PASS }} - name: Check files in the repository run: | From abc15fee401c33e11936c457882db8172c6bc757 Mon Sep 17 00:00:00 2001 From: Alexander Stepchenko Date: Mon, 11 Nov 2024 17:55:23 +0300 Subject: [PATCH 18/24] add kubelet Dockerfile.template --- org/k8s/kubelet/Dockerfile.template | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 org/k8s/kubelet/Dockerfile.template diff --git a/org/k8s/kubelet/Dockerfile.template b/org/k8s/kubelet/Dockerfile.template new file mode 100644 index 0000000..14da4d5 --- /dev/null +++ b/org/k8s/kubelet/Dockerfile.template @@ -0,0 +1,17 @@ +FROM {{ registry }}{{ alt_image }}:{{ branch }} + +MAINTAINER alt-cloud + +ARG PKG_VERSION + +{{ install_packages("ca-certificates", "ethtool", "socat", "kubernetes${PKG_VERSION}-kubelet") }} + +RUN ln -s /usr/bin/kubelet /usr/local/bin/kubelet + +ENTRYPOINT ["/usr/bin/kubelet"] + +LABEL org.opencontainers.image.title="kubelet" \ + org.opencontainers.image.description="An agent that runs on each node in the cluster. It makes sure that containers are running in a Pod." \ + org.opencontainers.image.source="https://github.com/kubernetes/kubernetes" \ + org.opencontainers.image.licenses="Apache-2.0" \ + org.opencontainers.image.vendor="ALT Linux Team" \ From 4da3ba20e1fa98bf54f036d1600b764524b6fe8b Mon Sep 17 00:00:00 2001 From: Nadezhda Fedorova Date: Mon, 11 Nov 2024 18:29:43 +0300 Subject: [PATCH 19/24] fix building errors --- .gitea/workflows/wf_full_sis.yaml | 2 +- .gitea/workflows/wf_single.yaml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/wf_full_sis.yaml b/.gitea/workflows/wf_full_sis.yaml index a72030f..7f47744 100644 --- a/.gitea/workflows/wf_full_sis.yaml +++ b/.gitea/workflows/wf_full_sis.yaml @@ -55,7 +55,7 @@ jobs: id: build-script run: | build_args="-b $BR -o $ORG --skip-images alt/distroless-devel --arches amd64 386 arm64 loong64" - if [[ $ORG == 'k8s' ]]; then build_args="$build_args --overwrite-organization $ORG-$BR --package-versions {\"k8s/kube-apiserver\":\"1.31\",\"k8s/kube-scheduler\":\"1.31\",\"k8s/kube-controller-manager\":\"1.31\",\"k8s/kube-proxy\":\"1.31\",\"k8s/coredns\":\"1.11.3\"}"; fi + if [[ $ORG == 'k8s' ]]; then build_args="$build_args --overwrite-organization $ORG-$BR --package-versions {\"k8s/kube-apiserver\":\"1.31\",\"k8s/kube-scheduler\":\"1.31\",\"k8s/kube-controller-manager\":\"1.31\",\"k8s/kube-proxy\":\"1.31\",\"k8s/coredns\":\"1.11.3\",\"k8s/kubelet\":\"1.31\"}"; fi echo "build.py $build_args" ${{ gitea.workspace }}/build.py $build_args env: diff --git a/.gitea/workflows/wf_single.yaml b/.gitea/workflows/wf_single.yaml index c30908b..b2c7979 100644 --- a/.gitea/workflows/wf_single.yaml +++ b/.gitea/workflows/wf_single.yaml @@ -79,8 +79,8 @@ jobs: id: build-script run: | if [[ "$IM" == *"k8s"* ]]; then k8sarg="--overwrite-organization $ORG-$BR --package-versions {\"$IM\":\"$VER\"}"; else k8sarg=""; fi - if [[ "$BR" = "sisyphus" ]]; then arches="--arches amd64 386 arm64 loong64"; else arches="--arches amd64 386 arm64"; fi - echo "build.py -i $IM -b $BR" + if [[ "$BR" == "sisyphus" ]]; then arches="--arches amd64 386 arm64 loong64"; else arches="--arches amd64 386 arm64"; fi + echo "build.py -i $IM -b $BR $arches $k8sarg" ${{ gitea.workspace }}/build.py -i $IM -b $BR $arches $k8sarg env: IM: ${{ env.IMAGE }} From 50e125d59d3931225ca4c154c7cb0f32dc308663 Mon Sep 17 00:00:00 2001 From: Nadezhda Fedorova Date: Mon, 11 Nov 2024 18:58:45 +0300 Subject: [PATCH 20/24] run all wf wf with alt-sisyphus --- .../{wf_full_sis.yaml => wf_full.yaml} | 18 ++- .gitea/workflows/wf_full_p10.yaml | 133 ------------------ .gitea/workflows/wf_full_p11.yaml | 133 ------------------ .gitea/workflows/wf_single.yaml | 4 +- 4 files changed, 15 insertions(+), 273 deletions(-) rename .gitea/workflows/{wf_full_sis.yaml => wf_full.yaml} (86%) delete mode 100644 .gitea/workflows/wf_full_p10.yaml delete mode 100644 .gitea/workflows/wf_full_p11.yaml diff --git a/.gitea/workflows/wf_full_sis.yaml b/.gitea/workflows/wf_full.yaml similarity index 86% rename from .gitea/workflows/wf_full_sis.yaml rename to .gitea/workflows/wf_full.yaml index 7f47744..3ab9785 100644 --- a/.gitea/workflows/wf_full_sis.yaml +++ b/.gitea/workflows/wf_full.yaml @@ -2,7 +2,7 @@ name: Full building alt images on: push: tags: - - 'sisyphus_*' + - '*_*' jobs: build-process: @@ -25,6 +25,13 @@ jobs: env: GU: ${{ gitea.server_url }} GR: ${{ gitea.repository }} + - name: Set repo for c10f2 (Temporary) + if: ${{ contains(github.ref_name, 'c10f2') }} + run: | + echo "event tag=${{ github.ref_name }}" + echo "10.4.0.3 update.altsp.su" >> /etc/hosts + echo "cat /etc/hosts" + cat /etc/hosts - name: Update apt uses: actions/init-alt-env@v1 - name: Install requires @@ -54,10 +61,11 @@ jobs: - name: Run building script id: build-script run: | - build_args="-b $BR -o $ORG --skip-images alt/distroless-devel --arches amd64 386 arm64 loong64" - if [[ $ORG == 'k8s' ]]; then build_args="$build_args --overwrite-organization $ORG-$BR --package-versions {\"k8s/kube-apiserver\":\"1.31\",\"k8s/kube-scheduler\":\"1.31\",\"k8s/kube-controller-manager\":\"1.31\",\"k8s/kube-proxy\":\"1.31\",\"k8s/coredns\":\"1.11.3\",\"k8s/kubelet\":\"1.31\"}"; fi - echo "build.py $build_args" - ${{ gitea.workspace }}/build.py $build_args + build_args="-b $BR -o $ORG --skip-images alt/distroless-devel" + if [[ "$BR" == "sisyphus" ]]; then arches="--arches amd64 386 arm64 loong64"; else arches="--arches amd64 386 arm64"; fi + if [[ "$ORG" == "k8s" ]]; then build_args="$build_args --overwrite-organization $ORG-$BR --package-versions {\"k8s/kube-apiserver\":\"1.31\",\"k8s/kube-scheduler\":\"1.31\",\"k8s/kube-controller-manager\":\"1.31\",\"k8s/kube-proxy\":\"1.31\",\"k8s/coredns\":\"1.11.3\",\"k8s/kubelet\":\"1.31\"}"; fi + echo "build.py $build_args $arches" + ${{ gitea.workspace }}/build.py $build_args $arches env: ORG: ${{ env.ORG }} BR: ${{ env.BRANCH }} diff --git a/.gitea/workflows/wf_full_p10.yaml b/.gitea/workflows/wf_full_p10.yaml deleted file mode 100644 index a5581a9..0000000 --- a/.gitea/workflows/wf_full_p10.yaml +++ /dev/null @@ -1,133 +0,0 @@ -name: Full building alt images -on: - push: - tags: - - '*10*_*' - -jobs: - build-process: - runs-on: alt-p10 - outputs: - branch: ${{ env.BRANCH }} - org: ${{ env.ORG }} - url: ${{ env.URL }} - repo: ${{ env.REPO }} - buildres: ${{ steps.build-script.outcome }} - steps: - - name: Check workspace - run: | - repourl=$(echo $GU | cut -d '/' -f 3) - echo "URL=$repourl" >> ${GITHUB_ENV} - echo $repourl - reponame=$(echo $GR | cut -d '/' -f 1) - echo "REPO=$reponame" >> ${GITHUB_ENV} - echo $reponame - env: - GU: ${{ gitea.server_url }} - GR: ${{ gitea.repository }} - - name: Set repo for c10f2 (Temporary) - if: ${{ contains(github.ref_name, 'c10f2') }} - run: | - echo "event tag=${{ github.ref_name }}" - echo "10.4.0.3 update.altsp.su" >> /etc/hosts - echo "cat /etc/hosts" - cat /etc/hosts - - name: Update apt - uses: actions/init-alt-env@v1 - - name: Install requires - run: | - echo "apt-get install -y python3-module-tomli python3-module-jinja2 python3-module-yaml python3-module-requests podman buildah jq curl" - apt-get install -y python3-module-tomli python3-module-jinja2 python3-module-yaml python3-module-requests podman buildah jq curl - echo "apt-get install -y qemu-user-static-binfmt-aarch64 qemu-user-static-binfmt-arm qemu-user-static-binfmt-ppc qemu-user-static-binfmt-riscv qemu-user-static-binfmt-loongarch" - apt-get install -y qemu-user-static-binfmt-aarch64 qemu-user-static-binfmt-arm qemu-user-static-binfmt-ppc qemu-user-static-binfmt-riscv qemu-user-static-binfmt-loongarch - - name: Check out current repo - uses: actions/checkout@v4 - - name: Parse target branch and tag from events context, save to env - env: - EV: ${{ toJson(gitea.event) }} - run: | - echo $EV | jq '.ref' -r | sed "s/refs\/tags\//BRANCH=/g" | cut -d '_' -f 1 - echo $EV | jq '.ref' -r | sed "s/refs\/tags\//BRANCH=/g" | cut -d '_' -f 1 >> ${GITHUB_ENV} - org=$(echo $EV | jq '.ref' -r | sed 's/refs\/tags\///g' | cut -d '_' -f 2) - echo "ORG=$org" >> ${GITHUB_ENV} - echo "ORG=$org" - - name: Login podman gitea - run: | - echo "podman login ${{ env.URL }}" - podman login --username $P_USER --password $P_PASS ${{ env.URL }} - env: - P_USER: ${{ secrets.PODMAN_USER }} - P_PASS: ${{ secrets.PODMAN_PASS }} - - name: Run building script - id: build-script - run: | - build_args="-b $BR -o $ORG --skip-images alt/distroless-devel --arches amd64 386 arm64" - if [[ $ORG == 'k8s' ]]; then build_args="$build_args --tags tags.toml --overwrite-organization $ORG-$BR --skip-images k8s/kube-apiserver k8s/kube-controller-manager k8s/kube-proxy k8s/kube-scheduler"; fi - echo "build.py $build_args" - ${{ gitea.workspace }}/build.py $build_args - env: - ORG: ${{ env.ORG }} - BR: ${{ env.BRANCH }} - continue-on-error: true - - name: Send notification if build crashed - if: ${{ steps.build-script.outcome != 'success' }} - run: | - issueid=1 - body="Building images finish with some errors." - curl -X 'POST' "$URL/api/v1/repos/$REPO/image-forge/issues/$issueid/comments?token=$T" -H 'accept: application/json' -H 'Content-Type: application/json' -d "{ \"body\": \"$body\" }" -s - echo "notification about test error is sent to issue $issueid" - env: - T: ${{ secrets.TOKEN }} - BR: ${{ env.BRANCH }} - URL: ${{ gitea.server_url }} - REPO: ${{ env.REPO }} - - name: Delete event tag - run: | - tagname=$(echo $EV | jq '.ref' -r | sed "s/refs\/tags\///g") - curl -X 'DELETE' "$URL/api/v1/repos/$REPO/image-forge/tags/$tagname?token=$T" -H 'accept: application/json' -s - echo "tag $tagname is deleted" - env: - T: ${{ secrets.TOKEN }} - BR: ${{ env.BRANCH }} - URL: ${{ gitea.server_url }} - REPO: ${{ env.REPO }} - EV: ${{ toJson(gitea.event) }} - test-process: - needs: build-process - if: ${{ needs.build-process.outputs.buildres == 'success' }} - runs-on: alt-p10 - steps: - - name: Update apt - uses: actions/init-alt-env@v1 - - name: Install requires - run: | - echo "apt-get install -y python3-module-tomli python3-module-jinja2 podman buildah jq curl" - apt-get install -y python3-module-tomli python3-module-jinja2 podman buildah jq curl - - name: Check out current repo - uses: https://gitea.com/actions/checkout@v4 - - name: Test - id: test-script - continue-on-error: true - run: | - $WS/.gitea/workflows/testscript $BR $ORG $URL $REPO $WS - cat haserr.log >> ${GITHUB_ENV} - echo "test process finished" - env: - BR: ${{ needs.build-process.outputs.branch }} - ORG: ${{ needs.build-process.outputs.org }} - URL: ${{ needs.build-process.outputs.url }} - REPO: ${{ needs.build-process.outputs.repo }} - WS: ${{ gitea.workspace }} - - name: Send notification if test crashed - if: ${{ env.ERR == 'true' || steps.test-script.outcome == 'failure' }} - run: | - issueid=1 - errors=$(cat errors.log) - body="Testing images finish with some errors. $errors" - curl -X 'POST' "$URL/api/v1/repos/$REPO/image-forge/issues/$issueid/comments?token=$T" -H 'accept: application/json' -H 'Content-Type: application/json' -d "{ \"body\": \"$body\" }" -s - echo "notification about test error is sent to issue $issueid" - env: - T: ${{ secrets.TOKEN }} - BR: ${{ needs.build-process.outputs.branch }} - URL: ${{ gitea.server_url }} - REPO: ${{ needs.build-process.outputs.repo }} diff --git a/.gitea/workflows/wf_full_p11.yaml b/.gitea/workflows/wf_full_p11.yaml deleted file mode 100644 index 358a5c1..0000000 --- a/.gitea/workflows/wf_full_p11.yaml +++ /dev/null @@ -1,133 +0,0 @@ -name: Full building alt images -on: - push: - tags: - - 'p11_*' - -jobs: - build-process: - runs-on: alt-sisyphus - outputs: - branch: ${{ env.BRANCH }} - org: ${{ env.ORG }} - url: ${{ env.URL }} - repo: ${{ env.REPO }} - buildres: ${{ steps.build-script.outcome }} - steps: - - name: Check workspace - run: | - repourl=$(echo $GU | cut -d '/' -f 3) - echo "URL=$repourl" >> ${GITHUB_ENV} - echo $repourl - reponame=$(echo $GR | cut -d '/' -f 1) - echo "REPO=$reponame" >> ${GITHUB_ENV} - echo $reponame - env: - GU: ${{ gitea.server_url }} - GR: ${{ gitea.repository }} - - name: Set repo for p11 (Temporary) - if: ${{ contains(github.ref_name, 'p11') }} - run: | - echo "event tag=${{ github.ref_name }}" - echo "10.4.0.3 update.altsp.su" >> /etc/hosts - echo "cat /etc/hosts" - cat /etc/hosts - - name: Update apt - uses: actions/init-alt-env@v1 - - name: Install requires - run: | - echo "apt-get install -y python3-module-tomli python3-module-jinja2 python3-module-yaml python3-module-requests podman buildah jq curl" - apt-get install -y python3-module-tomli python3-module-jinja2 python3-module-yaml python3-module-requests podman buildah jq curl - echo "apt-get install -y qemu-user-static-binfmt-aarch64 qemu-user-static-binfmt-arm qemu-user-static-binfmt-ppc qemu-user-static-binfmt-riscv qemu-user-static-binfmt-loongarch" - apt-get install -y qemu-user-static-binfmt-aarch64 qemu-user-static-binfmt-arm qemu-user-static-binfmt-ppc qemu-user-static-binfmt-riscv qemu-user-static-binfmt-loongarch - - name: Check out current repo - uses: actions/checkout@v4 - - name: Parse target branch and tag from events context, save to env - env: - EV: ${{ toJson(gitea.event) }} - run: | - echo $EV | jq '.ref' -r | sed "s/refs\/tags\//BRANCH=/g" | cut -d '_' -f 1 - echo $EV | jq '.ref' -r | sed "s/refs\/tags\//BRANCH=/g" | cut -d '_' -f 1 >> ${GITHUB_ENV} - org=$(echo $EV | jq '.ref' -r | sed 's/refs\/tags\///g' | cut -d '_' -f 2) - echo "ORG=$org" >> ${GITHUB_ENV} - echo "ORG=$org" - - name: Login podman gitea - run: | - echo "podman login ${{ env.URL }}" - podman login --username $P_USER --password $P_PASS ${{ env.URL }} - env: - P_USER: ${{ secrets.PODMAN_USER }} - P_PASS: ${{ secrets.PODMAN_PASS }} - - name: Run building script - id: build-script - run: | - build_args="-b $BR -o $ORG --skip-images alt/distroless-devel --arches amd64 386 arm64" - if [[ $ORG == 'k8s' ]]; then build_args="$build_args --tags tags.toml --overwrite-organization $ORG-$BR --skip-images k8s/kube-apiserver k8s/kube-controller-manager k8s/kube-proxy k8s/kube-scheduler"; fi - echo "build.py $build_args" - ${{ gitea.workspace }}/build.py $build_args - env: - ORG: ${{ env.ORG }} - BR: ${{ env.BRANCH }} - continue-on-error: true - - name: Send notification if build crashed - if: ${{ steps.build-script.outcome != 'success' }} - run: | - issueid=1 - body="Building images finish with some errors." - curl -X 'POST' "$URL/api/v1/repos/$REPO/image-forge/issues/$issueid/comments?token=$T" -H 'accept: application/json' -H 'Content-Type: application/json' -d "{ \"body\": \"$body\" }" -s - echo "notification about test error is sent to issue $issueid" - env: - T: ${{ secrets.TOKEN }} - BR: ${{ env.BRANCH }} - URL: ${{ gitea.server_url }} - REPO: ${{ env.REPO }} - - name: Delete event tag - run: | - tagname=$(echo $EV | jq '.ref' -r | sed "s/refs\/tags\///g") - curl -X 'DELETE' "$URL/api/v1/repos/$REPO/image-forge/tags/$tagname?token=$T" -H 'accept: application/json' -s - echo "tag $tagname is deleted" - env: - T: ${{ secrets.TOKEN }} - BR: ${{ env.BRANCH }} - URL: ${{ gitea.server_url }} - REPO: ${{ env.REPO }} - EV: ${{ toJson(gitea.event) }} - test-process: - needs: build-process - if: ${{ needs.build-process.outputs.buildres == 'success' }} - runs-on: alt-sisyphus - steps: - - name: Update apt - uses: actions/init-alt-env@v1 - - name: Install requires - run: | - echo "apt-get install -y python3-module-tomli python3-module-jinja2 podman buildah jq curl" - apt-get install -y python3-module-tomli python3-module-jinja2 podman buildah jq curl - - name: Check out current repo - uses: https://gitea.com/actions/checkout@v4 - - name: Test - id: test-script - continue-on-error: true - run: | - $WS/.gitea/workflows/testscript $BR $ORG $URL $REPO $WS - cat haserr.log >> ${GITHUB_ENV} - echo "test process finished" - env: - BR: ${{ needs.build-process.outputs.branch }} - ORG: ${{ needs.build-process.outputs.org }} - URL: ${{ needs.build-process.outputs.url }} - REPO: ${{ needs.build-process.outputs.repo }} - WS: ${{ gitea.workspace }} - - name: Send notification if test crashed - if: ${{ env.ERR == 'true' || steps.test-script.outcome == 'failure' }} - run: | - issueid=1 - errors=$(cat errors.log) - body="Testing images finish with some errors. $errors" - curl -X 'POST' "$URL/api/v1/repos/$REPO/image-forge/issues/$issueid/comments?token=$T" -H 'accept: application/json' -H 'Content-Type: application/json' -d "{ \"body\": \"$body\" }" -s - echo "notification about test error is sent to issue $issueid" - env: - T: ${{ secrets.TOKEN }} - BR: ${{ needs.build-process.outputs.branch }} - URL: ${{ gitea.server_url }} - REPO: ${{ needs.build-process.outputs.repo }} diff --git a/.gitea/workflows/wf_single.yaml b/.gitea/workflows/wf_single.yaml index b2c7979..49657e9 100644 --- a/.gitea/workflows/wf_single.yaml +++ b/.gitea/workflows/wf_single.yaml @@ -6,7 +6,7 @@ on: jobs: build-process: - runs-on: alt-latest + runs-on: alt-sisyphus outputs: branch: ${{ env.BRANCH }} image: ${{ env.IMAGE }} @@ -115,7 +115,7 @@ jobs: test-process: needs: build-process if: ${{ needs.build-process.outputs.buildres == 'success' }} - runs-on: alt-latest + runs-on: alt-sisyphus steps: - name: Update apt uses: https://gitea.basealt.ru/actions/init-alt-env@v1 From 48c571ed6513ac04cb3445f5f4ceac5d42f53c9d Mon Sep 17 00:00:00 2001 From: Nadezhda Fedorova Date: Mon, 11 Nov 2024 19:07:17 +0300 Subject: [PATCH 21/24] add scripts dependence to README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index e57c409..7380534 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,8 @@ source_packages: On x86_64 machine using p10 branch you need: - `python3-module-tomli` - `python3-module-jinja2` +- `python3-module-yaml` +- `python3-module-requests` - `qemu-user-static-binfmt-aarch64` to build for arm64 architecture - `qemu-user-static-binfmt-arm` to build for arm architecture - `qemu-user-static-binfmt-ppc` to build for ppc64le architecture From fca809825f471d36e47367a9328ebbcb63be46b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B0=D0=B4=D0=B5=D0=B6=D0=B4=D0=B0=20=D0=A4=D0=B5?= =?UTF-8?q?=D0=B4=D0=BE=D1=80=D0=BE=D0=B2=D0=B0?= Date: Tue, 12 Nov 2024 10:49:01 +0300 Subject: [PATCH 22/24] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20images-info.toml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- images-info.toml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/images-info.toml b/images-info.toml index acd8efa..ac3159a 100644 --- a/images-info.toml +++ b/images-info.toml @@ -5,10 +5,4 @@ skip-branches = [ "p9" ] skip-arches = [ "386" ] ["alt/ansible"] -skip-branches = [ "c10f2", "c10f1", "p10" ] - -["alt/distroless-base"] -skip-arches = [ "loong64" ] - -["alt/distroless-gotop"] -skip-arches = [ "loong64" ] +skip-branches = [ "c10f2", "c10f1", "p10" ] \ No newline at end of file From 05cf05c29d1d99cf226a9e36552f3f1014d3580a Mon Sep 17 00:00:00 2001 From: Mikhail Gordeev Date: Tue, 12 Nov 2024 01:30:40 +0300 Subject: [PATCH 23/24] add distroless-toybox image --- .gitea/workflows/testscript | 3 +++ org/alt/distroless-toybox/README.md | 11 +++++++++++ org/alt/distroless-toybox/distroless.toml | 7 +++++++ 3 files changed, 21 insertions(+) create mode 100644 org/alt/distroless-toybox/README.md create mode 100644 org/alt/distroless-toybox/distroless.toml diff --git a/.gitea/workflows/testscript b/.gitea/workflows/testscript index 7affca7..b278512 100755 --- a/.gitea/workflows/testscript +++ b/.gitea/workflows/testscript @@ -30,6 +30,9 @@ do if [[ $test != '' ]]; then command="podman run --rm --entrypoint=\"$entrypoint\" $3/$imgpath -c \"$test\"" else + if [[ $IM == 'distroless-toybox' ]]; then + command="podman run --rm $3/$imgpath toysh -c true" + fi if [[ $IM == 'distroless-true' ]]; then command="podman run --rm $3/$imgpath \"true\"" fi diff --git a/org/alt/distroless-toybox/README.md b/org/alt/distroless-toybox/README.md new file mode 100644 index 0000000..cd9e9ac --- /dev/null +++ b/org/alt/distroless-toybox/README.md @@ -0,0 +1,11 @@ +ALT distroless-toybox image +=========================== + +This is distroless image with toybox binary. It can be used for debugging +containers as toybox provides a lot of utils. + +To launch a shell in the container: +`docker run --rm -it registry.altlinux.org/alt/distroless-toybox` + +To get system inforamtion: +`docker run --rm -it registry.altlinux.org/alt/distroless-toybox uname -a` diff --git a/org/alt/distroless-toybox/distroless.toml b/org/alt/distroless-toybox/distroless.toml new file mode 100644 index 0000000..6e2dba1 --- /dev/null +++ b/org/alt/distroless-toybox/distroless.toml @@ -0,0 +1,7 @@ +from = "{{ registry }}{{ organization }}/distroless-static:{{ branch }}" + +builder-install-packages = ["toybox"] +files = ["/bin/toybox"] + +entrypoint = ["/bin/toybox"] +cmd = ["sh"] From ea8aa8f8972a7dabae14eac6124ea9ee6f5c61b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B0=D0=B4=D0=B5=D0=B6=D0=B4=D0=B0=20=D0=A4=D0=B5?= =?UTF-8?q?=D0=B4=D0=BE=D1=80=D0=BE=D0=B2=D0=B0?= Date: Wed, 13 Nov 2024 12:10:38 +0300 Subject: [PATCH 24/24] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20images-info.toml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- images-info.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/images-info.toml b/images-info.toml index ac3159a..252c910 100644 --- a/images-info.toml +++ b/images-info.toml @@ -1,6 +1,9 @@ ["alt/buildpack-deps"] skip-branches = [ "p9" ] +["alt/distroless-toybox"] +skip-branches = [ "p10" ] + ["alt/openjdk21"] skip-arches = [ "386" ]