add new argument to run building k8s

This commit is contained in:
Nadezhda Fedorova 2024-11-11 12:27:59 +03:00 committed by Надежда Федорова
parent 3b99b6eed2
commit f772e861ef
3 changed files with 22 additions and 21 deletions

View File

@ -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

View File

@ -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 }}

View File

@ -7,6 +7,3 @@ skip-arches = [ "386" ]
["alt/ansible"]
skip-branches = [ "c10f2", "c10f1", "p10" ]
["alt/systemd"]
skip-arches = [ "loong64" ]