Compare commits

...

2 Commits

Author SHA1 Message Date
Nadezhda Fedorova
9c460b363e change branches p*/c* workflow for new struct 2024-05-21 17:51:25 +03:00
Nadezhda Fedorova
28c0fc03cf change org struct, change type of tests 2024-05-21 17:39:54 +03:00
121 changed files with 135 additions and 71 deletions

View File

@ -6,53 +6,70 @@
#$4 - ${{ needs.build-process.outputs.repo }}
#$5 - ${{ gitea.workspace }}
BR=${1:-"p10"}
ORG=${2:-"base"}
URL=${3:-"gitea.basealt.ru"}
REPO=${4:-"alt"}
WS=${5:-"image-forge"}
errors=''
haserr=false
for IM in $(ls $5/org/$2/ | xargs)
for IM in $(ls $WS/org/$ORG/ | xargs)
do
echo "image=$IM"
if test -f $5/org/$2/$IM/test
then
test=$(cat $5/org/$2/$IM/test)
else test=''
fi
imgpath="$REPO/$BR/$IM:$BR"
command=''
testpath="$WS/org/$ORG/$IM/test.yaml"
if test -f $testpath
then
entrypoint=''
testep=$(cat $testpath | yq '.entrypoint' -r 2> /dev/null)
if [[ $testep != '' ]]; then entrypoint="--entrypoint=\"$testep\""; fi
echo "test script=$test"
imgpath="$2/$IM:$1"
if [[ $2 == 'k8s' ]]
then imgpath="$2-$1/$IM:latest"
testcom=$(cat $testpath | yq '.command' -r 2> /dev/null)
if [[ $testcom != '' ]]
then command="podman run --rm $entrypoint $URL/$imgpath -c \"$testcom\""
else echo "test command is not found"
fi
else echo "test file is not found"
fi
command="echo empty_command"
if [[ $test != '' ]]; then
command="podman run --rm --entrypoint=\"/bin/sh\" $3/$imgpath -c \"$test\""
else
if [[ $IM = 'distroless-true' ]]; then
command="podman run --rm $3/$imgpath \"true\""
fi
if [[ $IM = 'distroless-gotop' ]]; then
command="podman run --rm $3/$imgpath \"--version\""
fi
if [[ $IM = 'flannel-cni-plugin' ]]; then
command="podman run --rm $3/$imgpath \"/flannel\""
fi
if [[ $IM = 'pause' ]]; then
command="podman run --rm $3/$imgpath \"/pause\" \"-v\""
fi
fi
echo $command
echo "result test command: $command"
eval $command 2>$IM.log || haserr=true
echo "podman rmi --all"
podman rmi --all
if [ "$haserr" = false ]
then
echo "start change tag for $IM"
if [[ $ORG != 'base' ]]
then
package=$(podman images --filter reference=$URL/$imgpath --format='{{ json .Labels }}' | jq '."org.opencontainers.image.title"' -r 2> /dev/null)
if [[ $package != '' ]]
then
tag=$(podman run --rm --entrypoint="/bin/sh" $URL/$imgpath -c "rpm -qa --qf \"%{VERSION}\n\" $package" 2> /dev/null)
else
echo "not found package name in images labels"
fi
else
then tag=$(date +"%Y%m%d")
fi
if [ "$haserr" = true ]
then
if [[ $tag != '' ]]
then
skopeo copy -a docker://$URL/$imgpath:$BR docker://$URL/$imgpath:$tag
scopeo delete docker://$URL/$imgpath:$BR
echo "tag is updated"
else echo "new tag is empty and is not sent to repository"
fi
else
if [[ $(cat $IM.log) != '' ]]
then errors="TEST ERROR OF IMAGE $IM: $(cat $IM.log); $errors"
else errors="TEST ERROR OF IMAGE $IM: test returned empty error, but exit status was nozero; $errors"
fi
fi
fi
echo "podman rmi --all"
podman rmi --all
fi
haserr=false
done

View File

@ -2,7 +2,10 @@ name: Full building alt images
on:
push:
tags:
- '*10*_*'
- '*_*'
tags-ignore:
- '*_k8s'
- 'sisyphus_*'
jobs:
build-process:
@ -58,11 +61,10 @@ jobs:
env:
P_USER: ${{ secrets.PODMAN_USER }}
P_PASS: ${{ secrets.PODMAN_PASS }}
- name: Run building script
- name: Run standart building script
id: build-script
run: |
build_args="-b $BR -o $ORG --skip-images alt/distroless-devel"
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
build_args="-b $BR -o $ORG --skip-images base/distroless-devel --overwrite-organization $BR --registry $URL/$BR"
echo "build.py $build_args"
${{ gitea.workspace }}/build.py $build_args
env:
@ -101,11 +103,18 @@ 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"
echo "apt-get install -y python3-module-tomli python3-module-jinja2 podman buildah skopeo jq yq 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
- name: Login podman gitea
run: |
echo "podman login ${{ env.URL }}"
podman login --username $P_USER --password $P_PASS ${{ needs.build-process.outputs.url }}
env:
P_USER: ${{ secrets.PODMAN_USER }}
P_PASS: ${{ secrets.PODMAN_PASS }}
- name: Test images and update tags
id: test-script
continue-on-error: true
run: |

View File

@ -1 +0,0 @@
apachectl -v

View File

@ -1 +0,0 @@
LC_ALL=ru_RU.UTF-8 TZ=/usr/share/zoneinfo/Europe/Moscow date| grep MSK

View File

@ -1 +0,0 @@
curl --version && gpg --version

View File

@ -1 +0,0 @@
git --version && hg --version

View File

@ -1 +0,0 @@
gcc --version && make --version

View File

@ -1 +0,0 @@
apt-repo --version

View File

@ -1 +0,0 @@
ss -V

View File

@ -1 +0,0 @@
etcdctl version

View File

@ -1 +0,0 @@
gitea --version

View File

@ -1 +0,0 @@
nginx -v

View File

@ -1 +0,0 @@
node -v

View File

@ -1 +0,0 @@
prometheus --version

View File

@ -1 +0,0 @@
python3 --version

View File

@ -1 +0,0 @@
registry --version

View File

@ -1 +0,0 @@
ruby --version

View File

@ -1 +0,0 @@
ls -la /sbin/init | grep systemd

View File

@ -1 +0,0 @@
trivy --version

View File

@ -1 +0,0 @@
unitd --version

View File

@ -1 +0,0 @@
zot verify /etc/zot/config.json

2
org/base/base/test.yaml Normal file
View File

@ -0,0 +1,2 @@
entrypoint: "/bin/sh"
command: "LC_ALL=ru_RU.UTF-8 TZ=/usr/share/zoneinfo/Europe/Moscow date| grep MSK"

View File

@ -0,0 +1,2 @@
entrypoint: "/bin/sh"
command: "curl --version && gpg --version"

View File

@ -0,0 +1,2 @@
entrypoint: "/bin/sh"
command: "git --version && hg --version"

View File

@ -0,0 +1,2 @@
entrypoint: "/bin/sh"
command: "gcc --version && make --version"

View File

@ -0,0 +1,2 @@
entrypoint: "/bin/sh"
command: "apt-repo --version"

View File

@ -0,0 +1,2 @@
entrypoint: "/bin/sh"
command: "ss -V"

View File

@ -0,0 +1,2 @@
entrypoint: ""
command: "--version"

View File

@ -0,0 +1,2 @@
entrypoint: ""
command: "true"

2
org/base/trivy/test.yaml Normal file
View File

@ -0,0 +1,2 @@
entrypoint: "/bin/sh"
command: "trivy --version"

View File

@ -0,0 +1,2 @@
entrypoint: "/bin/sh"
command: "cainjector --help"

View File

@ -0,0 +1,2 @@
entrypoint: "/bin/sh"
command: "controller --help"

View File

@ -0,0 +1,2 @@
entrypoint: "/bin/sh"
command: "webhook --help"

View File

@ -0,0 +1,2 @@
entrypoint: ""
command: "flannel"

View File

@ -0,0 +1,2 @@
entrypoint: "/bin/sh"
command: "flanneld --version"

View File

@ -1 +0,0 @@
cainjector --help

View File

@ -1 +0,0 @@
controller --help

View File

@ -1 +0,0 @@
webhook --help

View File

@ -1 +0,0 @@
coredns --version

View File

@ -0,0 +1,2 @@
entrypoint: "/bin/sh"
command: "coredns --version"

View File

@ -1 +0,0 @@
etcd --version

2
org/k8s/etcd/test.yaml Normal file
View File

@ -0,0 +1,2 @@
entrypoint: "/bin/sh"
command: "etcd --version"

View File

@ -1 +0,0 @@
flanneld --version

View File

@ -1 +0,0 @@
kube-apiserver --version

View File

@ -0,0 +1,2 @@
entrypoint: "/bin/sh"
command: "kube-apiserver --version"

View File

@ -1 +0,0 @@
kube-controller-manager --version

View File

@ -0,0 +1,2 @@
entrypoint: "/bin/sh"
command: "kube-controller-manager --version"

View File

@ -1 +0,0 @@
kube-proxy --version

View File

@ -0,0 +1,2 @@
entrypoint: "/bin/sh"
command: "kube-proxy --version"

View File

@ -1 +0,0 @@
kube-scheduler --version

View File

@ -0,0 +1,2 @@
entrypoint: "/bin/sh"
command: "kube-scheduler --version"

2
org/k8s/pause/test.yaml Normal file
View File

@ -0,0 +1,2 @@
entrypoint: "/pause"
command: "-v"

View File

@ -1 +0,0 @@
node-collector --help

View File

@ -0,0 +1,2 @@
entrypoint: "/bin/sh"
command: "node-collector --help"

View File

@ -0,0 +1,2 @@
entrypoint: "/bin/sh"
command: "apachectl -v"

2
org/other/etcd/test.yaml Normal file
View File

@ -0,0 +1,2 @@
entrypoint: "/bin/sh"
command: "etcdctl version"

View File

@ -0,0 +1,2 @@
entrypoint: "/bin/sh"
command: "gitea --version"

View File

@ -0,0 +1,2 @@
entrypoint: "/bin/sh"
command: "nginx -v"

2
org/other/node/test.yaml Normal file
View File

@ -0,0 +1,2 @@
entrypoint: "/bin/sh"
command: "node -v"

Some files were not shown because too many files have changed in this diff Show More