Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
ddb09cdefd | |||
3ebd1a8b7e | |||
7a07b6f9a5 | |||
0bc8fb228d | |||
6cbde103dd | |||
14c787b0db | |||
d161930947 | |||
0c426721dd |
199
.gitea/workflows/wf_multiple.yaml
Normal file
199
.gitea/workflows/wf_multiple.yaml
Normal file
@ -0,0 +1,199 @@
|
||||
name: Building alt images
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
build-process:
|
||||
runs-on: alt-sisyphus
|
||||
outputs:
|
||||
branch: ${{ env.BRANCH }}
|
||||
image: ${{ env.IMAGE }}
|
||||
url: ${{ env.URL }}
|
||||
repo: ${{ env.REPO }}
|
||||
buildres: ${{ steps.build-script.outcome }}
|
||||
test: ${{ env.TEST }}
|
||||
steps:
|
||||
- name: Check workspace
|
||||
run: |
|
||||
repourl=$(echo $GU | cut -d '/' -f 3)
|
||||
echo "URL=$repourl" >> ${GITHUB_ENV}
|
||||
echo "URL=$repourl"
|
||||
reponame=$(echo $GR | cut -d '/' -f 1)
|
||||
echo "REPO=$reponame" >> ${GITHUB_ENV}
|
||||
echo "REPO=$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: 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: Check files in the repository
|
||||
run: |
|
||||
ls -a ${{ gitea.workspace }}
|
||||
- name: Parse target branch and tag from events context, save to env
|
||||
env:
|
||||
EV: ${{ toJson(gitea.event) }}
|
||||
run: |
|
||||
branch="$(echo $EV | jq '.ref' -r | sed "s|refs/tags/||g" | cut -d '_' -f 1)"
|
||||
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}
|
||||
|
||||
rest="$(echo $EV | jq '.ref' -r | sed "s|refs/tags/|BRANCH=|g" | cut -d '_' -f 1-)"
|
||||
|
||||
IFS='_' read -ra parts <<< "$rest"
|
||||
|
||||
images=()
|
||||
declare -A versions
|
||||
|
||||
for part in "${parts[@]}"; do
|
||||
image="${part%@*}"
|
||||
version="${part#*@}"
|
||||
images+=("$image")
|
||||
versions["$image"]="$version"
|
||||
done
|
||||
|
||||
image_args="${images[*]}"
|
||||
|
||||
# Build JSON for package-versions
|
||||
package_versions="{"
|
||||
for i in "${!images[@]}"; do
|
||||
img="${images[$i]}"
|
||||
ver="${versions[$img]}"
|
||||
sep=$([[ $i -lt $((${#images[@]} - 1)) ]] && echo "," || echo "")
|
||||
package_versions+="\"$img\": \"$ver\"$sep"
|
||||
done
|
||||
package_versions+="}"
|
||||
|
||||
echo "IMAGES=$image_args" >> $GITEA_OUTPUT
|
||||
echo "PACKAGE_VERSIONS=$package_versions" >> $GITEA_OUTPUT
|
||||
- name: Change vendor label for c10f
|
||||
if: ${{ contains(github.ref_name, 'c10f') }}
|
||||
run: |
|
||||
echo "sed -i 's/ALT Linux Team/BaseALT LLC/g' ${{ gitea.workspace }}/org/$ORG/*/Dockerfile.template ||:"
|
||||
sed -i 's/ALT Linux Team/BaseALT LLC/g' ${{ gitea.workspace }}/org/$ORG/*/Dockerfile.template ||:
|
||||
echo "sed -i 's/ALT Linux Team/BaseALT LLC/g' ${{ gitea.workspace }}/org/$ORG/*/distroless.toml ||:"
|
||||
sed -i 's/ALT Linux Team/BaseALT LLC/g' ${{ gitea.workspace }}/org/$ORG/*/distroless.toml ||:
|
||||
env:
|
||||
ORG: ${{ env.ORG }}
|
||||
- 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:
|
||||
IM: ${{ env.IMAGE }}
|
||||
BR: ${{ env.BRANCH }}
|
||||
- name: Run building script
|
||||
id: build-script
|
||||
run: |
|
||||
${{ gitea.workspace }}/build.py \
|
||||
--log-level debug \
|
||||
--skip-stages push \
|
||||
--branch $BRANCH \
|
||||
--registry gitea.basealt.ru/alt \
|
||||
--arches amd64 \
|
||||
-i $IMAGES \
|
||||
--package-versions "$PACKAGE_VERSIONS"
|
||||
env:
|
||||
BRANCH: ${{ env.BRANCH }}
|
||||
IMAGES: ${{ env.IMAGES }}
|
||||
PACKAGE_VERSIONS: ${{ env.PACKAGE_VERSIONS }}
|
||||
continue-on-error: true
|
||||
# - name: Send notification if build crashed
|
||||
# if: ${{ steps.build-script.outcome != 'success' }}
|
||||
# run: |
|
||||
# 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"
|
||||
# env:
|
||||
# T: ${{ secrets.TOKEN }}
|
||||
# BR: ${{ env.BRANCH }}
|
||||
# URL: ${{ gitea.server_url }}
|
||||
# REPO: ${{ env.REPO }}
|
||||
# IM: ${{ env.IMAGE }}
|
||||
- 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: https://gitea.basealt.ru/actions/init-alt-env@v1
|
||||
- name: Install requires
|
||||
run: |
|
||||
echo "apt-get install -y python3-module-tomli python3-module-jinja2 podman buildah curl"
|
||||
apt-get install -y python3-module-tomli python3-module-jinja2 podman buildah curl
|
||||
- name: Run test
|
||||
id: test-script
|
||||
if: ${{ needs.build-process.outputs.test != '' }}
|
||||
continue-on-error: true
|
||||
run: |
|
||||
imname=$(echo "$IM" | cut -d "/" -f2)
|
||||
if [[ "$IM" == *"k8s"* ]]; then echo "skip tests for k8s images"; else podman run --rm --entrypoint="/bin/sh" $URL/$REPO/$BR/$imname:latest -c "$TEST"; fi
|
||||
env:
|
||||
IM: ${{ needs.build-process.outputs.image }}
|
||||
BR: ${{ needs.build-process.outputs.branch }}
|
||||
URL: ${{ needs.build-process.outputs.url }}
|
||||
REPO: ${{ needs.build-process.outputs.repo }}
|
||||
TEST: ${{ needs.build-process.outputs.test }}
|
||||
- name: Run special test
|
||||
id: special-test
|
||||
if: ${{ needs.build-process.outputs.test == '' }}
|
||||
continue-on-error: true
|
||||
run: |
|
||||
imname=$(echo "$IM" | cut -d "/" -f2)
|
||||
if [[ $IM = 'alt/distroless-true' ]]; then podman run --rm $URL/$REPO/$BR/$imname:latest true; fi
|
||||
if [[ $IM = 'alt/distroless-gotop' ]]; then podman run --rm $URL/$REPO/$BR/$imname:latest --version; fi
|
||||
env:
|
||||
IM: ${{ needs.build-process.outputs.image }}
|
||||
BR: ${{ needs.build-process.outputs.branch }}
|
||||
URL: ${{ needs.build-process.outputs.url }}
|
||||
REPO: ${{ needs.build-process.outputs.repo }}
|
||||
- name: Send notification if test crashed
|
||||
if: ${{ steps.test-script.outcome == 'failure' || steps.special-test.outcome == 'failure' }}
|
||||
run: |
|
||||
issueid=1
|
||||
errors=$(cat errors.log)
|
||||
body="Testing 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"
|
||||
env:
|
||||
T: ${{ secrets.TOKEN }}
|
||||
BR: ${{ needs.build-process.outputs.branch }}
|
||||
URL: ${{ gitea.server_url }}
|
||||
REPO: ${{ needs.build-process.outputs.repo }}
|
||||
IM: ${{ needs.build-process.outputs.image }}
|
||||
|
@ -21,7 +21,7 @@ jobs:
|
||||
echo "URL=$repourl" >> ${GITHUB_ENV}
|
||||
echo "URL=$repourl"
|
||||
reponame=$(echo $GR | cut -d '/' -f 1)
|
||||
echo "REPO=$reponame" >> ${GITHUB_ENV}
|
||||
echo "REPO=$reponame" >> ${GITHUB_ENV}
|
||||
echo "REPO=$reponame"
|
||||
env:
|
||||
GU: ${{ gitea.server_url }}
|
||||
@ -29,7 +29,7 @@ jobs:
|
||||
- name: Set repo for c10f2 (Temporary)
|
||||
if: ${{ contains(github.ref_name, 'c10f2') }}
|
||||
run: |
|
||||
echo "event tag=${{ github.ref_name }}"
|
||||
echo "event tag=${{ github.ref_name }}"
|
||||
echo "10.4.0.3 update.altsp.su" >> /etc/hosts
|
||||
echo "cat /etc/hosts"
|
||||
cat /etc/hosts
|
||||
@ -43,26 +43,17 @@ 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: Change vendor label for c10f
|
||||
if: ${{ contains(github.ref_name, 'c10f') }}
|
||||
run: |
|
||||
echo "sed -i 's/ALT Linux Team/BaseALT LLC/g' ${{ gitea.workspace }}/org/$ORG/*/Dockerfile.template ||:"
|
||||
sed -i 's/ALT Linux Team/BaseALT LLC/g' ${{ gitea.workspace }}/org/$ORG/*/Dockerfile.template ||:
|
||||
echo "sed -i 's/ALT Linux Team/BaseALT LLC/g' ${{ gitea.workspace }}/org/$ORG/*/distroless.toml ||:"
|
||||
sed -i 's/ALT Linux Team/BaseALT LLC/g' ${{ gitea.workspace }}/org/$ORG/*/distroless.toml ||:
|
||||
env:
|
||||
ORG: ${{ env.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 }}
|
||||
- name: Check files in the repository
|
||||
run: |
|
||||
ls -a ${{ gitea.workspace }}
|
||||
- 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) }}
|
||||
run: |
|
||||
@ -77,6 +68,15 @@ jobs:
|
||||
ver=$(echo $EV | jq '.ref' -r | sed 's/refs\/tags\///g' | cut -d '_' -f 3)
|
||||
echo "VER=$ver" >> ${GITHUB_ENV}
|
||||
echo "VER=$ver"
|
||||
- name: Change vendor label for c10f
|
||||
if: ${{ contains(github.ref_name, 'c10f') }}
|
||||
run: |
|
||||
echo "sed -i 's/ALT Linux Team/BaseALT LLC/g' ${{ gitea.workspace }}/org/$ORG/*/Dockerfile.template ||:"
|
||||
sed -i 's/ALT Linux Team/BaseALT LLC/g' ${{ gitea.workspace }}/org/$ORG/*/Dockerfile.template ||:
|
||||
echo "sed -i 's/ALT Linux Team/BaseALT LLC/g' ${{ gitea.workspace }}/org/$ORG/*/distroless.toml ||:"
|
||||
sed -i 's/ALT Linux Team/BaseALT LLC/g' ${{ gitea.workspace }}/org/$ORG/*/distroless.toml ||:
|
||||
env:
|
||||
ORG: ${{ env.ORG }}
|
||||
- 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
|
||||
@ -90,7 +90,7 @@ jobs:
|
||||
if [[ "$IM" == *"k8s"* ]]; then k8sarg="--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 $arches $k8sarg"
|
||||
${{ gitea.workspace }}/build.py -i $IM -b $BR $arches --latest $BR --log-level debug --registry gitea.basealt.ru/alt $k8sarg
|
||||
${{ gitea.workspace }}/build.py -i $IM -b $BR $arches --latest $BR --log-level debug --registry gitea.basealt.ru/alt $k8sarg
|
||||
env:
|
||||
IM: ${{ env.IMAGE }}
|
||||
VER: ${{ env.VER }}
|
||||
@ -103,7 +103,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 }}
|
||||
@ -131,7 +131,7 @@ jobs:
|
||||
- name: Install requires
|
||||
run: |
|
||||
echo "apt-get install -y python3-module-tomli python3-module-jinja2 podman buildah curl"
|
||||
apt-get install -y python3-module-tomli python3-module-jinja2 podman buildah curl
|
||||
apt-get install -y python3-module-tomli python3-module-jinja2 podman buildah curl
|
||||
- name: Run test
|
||||
id: test-script
|
||||
if: ${{ needs.build-process.outputs.test != '' }}
|
||||
@ -140,9 +140,9 @@ jobs:
|
||||
imname=$(echo "$IM" | cut -d "/" -f2)
|
||||
if [[ "$IM" == *"k8s"* ]]; then echo "skip tests for k8s images"; else podman run --rm --entrypoint="/bin/sh" $URL/$REPO/$BR/$imname:latest -c "$TEST"; fi
|
||||
env:
|
||||
IM: ${{ needs.build-process.outputs.image }}
|
||||
IM: ${{ needs.build-process.outputs.image }}
|
||||
BR: ${{ needs.build-process.outputs.branch }}
|
||||
URL: ${{ needs.build-process.outputs.url }}
|
||||
URL: ${{ needs.build-process.outputs.url }}
|
||||
REPO: ${{ needs.build-process.outputs.repo }}
|
||||
TEST: ${{ needs.build-process.outputs.test }}
|
||||
- name: Run special test
|
||||
@ -165,7 +165,7 @@ jobs:
|
||||
errors=$(cat errors.log)
|
||||
body="Testing 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: ${{ needs.build-process.outputs.branch }}
|
||||
|
@ -1,23 +0,0 @@
|
||||
FROM {{ registry }}{{ branch }}/{{ alt_image }}:latest
|
||||
|
||||
MAINTAINER alt-cloud
|
||||
|
||||
LABEL org.opencontainers.image.title="etcd"
|
||||
LABEL org.opencontainers.image.description="Distributed reliable key-value store for the most critical data of a distributed system"
|
||||
LABEL org.opencontainers.image.source="https://github.com/etcd-io/etcd"
|
||||
LABEL org.opencontainers.image.licenses="Apache-2.0"
|
||||
LABEL org.opencontainers.image.vendor="ALT Linux Team"
|
||||
|
||||
{% if branch in ["sisyphus"] %}
|
||||
ARG PKG_VERSION
|
||||
|
||||
{{ install_packages("etcd${PKG_VERSION}") }}
|
||||
{% else %}
|
||||
{{ install_packages("etcd") }}
|
||||
{% endif %}
|
||||
|
||||
RUN ln -s /usr/sbin/etcd /usr/local/bin/etcd
|
||||
|
||||
VOLUME /data
|
||||
|
||||
ENTRYPOINT ["/usr/sbin/etcd", "--data-dir", "/data"]
|
@ -1,13 +0,0 @@
|
||||
dockerfiles-alt-etcd
|
||||
=========================
|
||||
|
||||
ALT dockerfile for etcd.
|
||||
|
||||
Copy Dockerfile somewhere and build the image:
|
||||
`$ docker build --rm -t <username>/etcd.`
|
||||
|
||||
And launch the etcd container:
|
||||
`docker run -d -v <etcd data dir>:/data <username>/etcd`
|
||||
|
||||
If etcdclt watnted it could be run via:
|
||||
`docker run --entrypoint etcdctl <username>/etcd`
|
@ -1,14 +0,0 @@
|
||||
---
|
||||
is_versioned: true
|
||||
version_template:
|
||||
- "v{{ version }}"
|
||||
- "{{ version }}"
|
||||
- "{{ version }}-0"
|
||||
source_packages:
|
||||
- >
|
||||
{% if branch in ["sisyphus"] %}
|
||||
{% raw %}etcd{{ version }}{% endraw %}
|
||||
{% else %}
|
||||
etcd
|
||||
{% endif %}
|
||||
...
|
@ -1 +0,0 @@
|
||||
etcd --version
|
@ -3,9 +3,9 @@ is_versioned: true
|
||||
version_template: "{{ version }}"
|
||||
source_packages:
|
||||
- >
|
||||
{% if branch in [ "p10", "c10f1", "c10f2"] %}
|
||||
{% raw %}php8.2{% endraw %}
|
||||
{% else %}
|
||||
{%- if branch in [ "p10", "c10f1", "c10f2"] -%}
|
||||
php8.2
|
||||
{%- else -%}
|
||||
php8.3
|
||||
{% endif %}
|
||||
{%- endif -%}
|
||||
...
|
||||
|
@ -3,9 +3,9 @@ is_versioned: true
|
||||
version_template: "{{ version }}"
|
||||
source_packages:
|
||||
- >
|
||||
{% if branch in ["p10", "c10f2", "c10f1"] %}
|
||||
{% raw %}ruby{% endraw %}
|
||||
{% else %}
|
||||
{%- if branch in ["p10", "c10f2", "c10f1"] -%}
|
||||
ruby
|
||||
{%- else -%}
|
||||
gem-irb
|
||||
{% endif %}
|
||||
{%- endif -%}
|
||||
...
|
||||
|
@ -8,7 +8,11 @@ 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 pkg_versions and "k8s/coredns" in pkg_versions %}
|
||||
{% set version_parts = pkg_versions["k8s/coredns"].split('.') | length %}
|
||||
{% else %}
|
||||
{% set version_parts = 0 %}
|
||||
{% endif %}
|
||||
{% if branch in ["sisyphus"] and version_parts == 2 %}
|
||||
ARG PKG_VERSION
|
||||
|
||||
|
Reference in New Issue
Block a user