Compare commits
2 Commits
master
...
new_struct
Author | SHA1 | Date | |
---|---|---|---|
|
9c460b363e | ||
|
28c0fc03cf |
@ -6,53 +6,70 @@
|
|||||||
#$4 - ${{ needs.build-process.outputs.repo }}
|
#$4 - ${{ needs.build-process.outputs.repo }}
|
||||||
#$5 - ${{ gitea.workspace }}
|
#$5 - ${{ gitea.workspace }}
|
||||||
|
|
||||||
|
BR=${1:-"p10"}
|
||||||
|
ORG=${2:-"base"}
|
||||||
|
URL=${3:-"gitea.basealt.ru"}
|
||||||
|
REPO=${4:-"alt"}
|
||||||
|
WS=${5:-"image-forge"}
|
||||||
|
|
||||||
errors=''
|
errors=''
|
||||||
haserr=false
|
haserr=false
|
||||||
for IM in $(ls $5/org/$2/ | xargs)
|
for IM in $(ls $WS/org/$ORG/ | xargs)
|
||||||
do
|
do
|
||||||
echo "image=$IM"
|
echo "image=$IM"
|
||||||
if test -f $5/org/$2/$IM/test
|
imgpath="$REPO/$BR/$IM:$BR"
|
||||||
then
|
command=''
|
||||||
test=$(cat $5/org/$2/$IM/test)
|
testpath="$WS/org/$ORG/$IM/test.yaml"
|
||||||
else test=''
|
if test -f $testpath
|
||||||
fi
|
then
|
||||||
|
entrypoint=''
|
||||||
|
testep=$(cat $testpath | yq '.entrypoint' -r 2> /dev/null)
|
||||||
|
if [[ $testep != '' ]]; then entrypoint="--entrypoint=\"$testep\""; fi
|
||||||
|
|
||||||
echo "test script=$test"
|
testcom=$(cat $testpath | yq '.command' -r 2> /dev/null)
|
||||||
imgpath="$2/$IM:$1"
|
if [[ $testcom != '' ]]
|
||||||
|
then command="podman run --rm $entrypoint $URL/$imgpath -c \"$testcom\""
|
||||||
if [[ $2 == 'k8s' ]]
|
else echo "test command is not found"
|
||||||
then imgpath="$2-$1/$IM:latest"
|
fi
|
||||||
|
else echo "test file is not found"
|
||||||
fi
|
fi
|
||||||
|
echo "result test command: $command"
|
||||||
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
|
|
||||||
eval $command 2>$IM.log || haserr=true
|
eval $command 2>$IM.log || haserr=true
|
||||||
|
|
||||||
echo "podman rmi --all"
|
if [ "$haserr" = false ]
|
||||||
podman rmi --all
|
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 ]
|
if [[ $tag != '' ]]
|
||||||
then
|
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) != '' ]]
|
if [[ $(cat $IM.log) != '' ]]
|
||||||
then errors="TEST ERROR OF IMAGE $IM: $(cat $IM.log); $errors"
|
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"
|
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
|
fi
|
||||||
haserr=false
|
haserr=false
|
||||||
done
|
done
|
||||||
|
@ -2,7 +2,10 @@ name: Full building alt images
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- '*10*_*'
|
- '*_*'
|
||||||
|
tags-ignore:
|
||||||
|
- '*_k8s'
|
||||||
|
- 'sisyphus_*'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-process:
|
build-process:
|
||||||
@ -58,11 +61,10 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
P_USER: ${{ secrets.PODMAN_USER }}
|
P_USER: ${{ secrets.PODMAN_USER }}
|
||||||
P_PASS: ${{ secrets.PODMAN_PASS }}
|
P_PASS: ${{ secrets.PODMAN_PASS }}
|
||||||
- name: Run building script
|
- name: Run standart building script
|
||||||
id: build-script
|
id: build-script
|
||||||
run: |
|
run: |
|
||||||
build_args="-b $BR -o $ORG --skip-images alt/distroless-devel"
|
build_args="-b $BR -o $ORG --skip-images base/distroless-devel --overwrite-organization $BR --registry $URL/$BR"
|
||||||
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"
|
echo "build.py $build_args"
|
||||||
${{ gitea.workspace }}/build.py $build_args
|
${{ gitea.workspace }}/build.py $build_args
|
||||||
env:
|
env:
|
||||||
@ -101,11 +103,18 @@ jobs:
|
|||||||
uses: actions/init-alt-env@v1
|
uses: actions/init-alt-env@v1
|
||||||
- name: Install requires
|
- name: Install requires
|
||||||
run: |
|
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
|
apt-get install -y python3-module-tomli python3-module-jinja2 podman buildah jq curl
|
||||||
- name: Check out current repo
|
- name: Check out current repo
|
||||||
uses: https://gitea.com/actions/checkout@v4
|
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
|
id: test-script
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: |
|
run: |
|
||||||
|
@ -1 +0,0 @@
|
|||||||
apachectl -v
|
|
@ -1 +0,0 @@
|
|||||||
LC_ALL=ru_RU.UTF-8 TZ=/usr/share/zoneinfo/Europe/Moscow date| grep MSK
|
|
@ -1 +0,0 @@
|
|||||||
curl --version && gpg --version
|
|
@ -1 +0,0 @@
|
|||||||
git --version && hg --version
|
|
@ -1 +0,0 @@
|
|||||||
gcc --version && make --version
|
|
@ -1 +0,0 @@
|
|||||||
apt-repo --version
|
|
@ -1 +0,0 @@
|
|||||||
ss -V
|
|
@ -1 +0,0 @@
|
|||||||
etcdctl version
|
|
@ -1 +0,0 @@
|
|||||||
gitea --version
|
|
@ -1 +0,0 @@
|
|||||||
nginx -v
|
|
@ -1 +0,0 @@
|
|||||||
node -v
|
|
@ -1 +0,0 @@
|
|||||||
prometheus --version
|
|
@ -1 +0,0 @@
|
|||||||
python3 --version
|
|
@ -1 +0,0 @@
|
|||||||
registry --version
|
|
@ -1 +0,0 @@
|
|||||||
ruby --version
|
|
@ -1 +0,0 @@
|
|||||||
ls -la /sbin/init | grep systemd
|
|
@ -1 +0,0 @@
|
|||||||
trivy --version
|
|
@ -1 +0,0 @@
|
|||||||
unitd --version
|
|
@ -1 +0,0 @@
|
|||||||
zot verify /etc/zot/config.json
|
|
2
org/base/base/test.yaml
Normal file
2
org/base/base/test.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
entrypoint: "/bin/sh"
|
||||||
|
command: "LC_ALL=ru_RU.UTF-8 TZ=/usr/share/zoneinfo/Europe/Moscow date| grep MSK"
|
2
org/base/buildpack-deps-curl/test.yaml
Normal file
2
org/base/buildpack-deps-curl/test.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
entrypoint: "/bin/sh"
|
||||||
|
command: "curl --version && gpg --version"
|
2
org/base/buildpack-deps-scm/test.yaml
Normal file
2
org/base/buildpack-deps-scm/test.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
entrypoint: "/bin/sh"
|
||||||
|
command: "git --version && hg --version"
|
2
org/base/buildpack-deps/test.yaml
Normal file
2
org/base/buildpack-deps/test.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
entrypoint: "/bin/sh"
|
||||||
|
command: "gcc --version && make --version"
|
2
org/base/distroless-builder/test.yaml
Normal file
2
org/base/distroless-builder/test.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
entrypoint: "/bin/sh"
|
||||||
|
command: "apt-repo --version"
|
2
org/base/distroless-devel/test.yaml
Normal file
2
org/base/distroless-devel/test.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
entrypoint: "/bin/sh"
|
||||||
|
command: "ss -V"
|
2
org/base/distroless-gotop/test.yaml
Normal file
2
org/base/distroless-gotop/test.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
entrypoint: ""
|
||||||
|
command: "--version"
|
2
org/base/distroless-true/test.yaml
Normal file
2
org/base/distroless-true/test.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
entrypoint: ""
|
||||||
|
command: "true"
|
2
org/base/trivy/test.yaml
Normal file
2
org/base/trivy/test.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
entrypoint: "/bin/sh"
|
||||||
|
command: "trivy --version"
|
2
org/cert-manager/cert-manager-cainjector/test.yaml
Normal file
2
org/cert-manager/cert-manager-cainjector/test.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
entrypoint: "/bin/sh"
|
||||||
|
command: "cainjector --help"
|
2
org/cert-manager/cert-manager-controller/test.yaml
Normal file
2
org/cert-manager/cert-manager-controller/test.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
entrypoint: "/bin/sh"
|
||||||
|
command: "controller --help"
|
2
org/cert-manager/cert-manager-webhook/test.yaml
Normal file
2
org/cert-manager/cert-manager-webhook/test.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
entrypoint: "/bin/sh"
|
||||||
|
command: "webhook --help"
|
2
org/flannel/flannel-cni-plugin/test.yaml
Normal file
2
org/flannel/flannel-cni-plugin/test.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
entrypoint: ""
|
||||||
|
command: "flannel"
|
2
org/flannel/flannel/test.yaml
Normal file
2
org/flannel/flannel/test.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
entrypoint: "/bin/sh"
|
||||||
|
command: "flanneld --version"
|
@ -1 +0,0 @@
|
|||||||
cainjector --help
|
|
@ -1 +0,0 @@
|
|||||||
controller --help
|
|
@ -1 +0,0 @@
|
|||||||
webhook --help
|
|
@ -1 +0,0 @@
|
|||||||
coredns --version
|
|
2
org/k8s/coredns/test.yaml
Normal file
2
org/k8s/coredns/test.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
entrypoint: "/bin/sh"
|
||||||
|
command: "coredns --version"
|
@ -1 +0,0 @@
|
|||||||
etcd --version
|
|
2
org/k8s/etcd/test.yaml
Normal file
2
org/k8s/etcd/test.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
entrypoint: "/bin/sh"
|
||||||
|
command: "etcd --version"
|
@ -1 +0,0 @@
|
|||||||
flanneld --version
|
|
@ -1 +0,0 @@
|
|||||||
kube-apiserver --version
|
|
2
org/k8s/kube-apiserver/test.yaml
Normal file
2
org/k8s/kube-apiserver/test.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
entrypoint: "/bin/sh"
|
||||||
|
command: "kube-apiserver --version"
|
@ -1 +0,0 @@
|
|||||||
kube-controller-manager --version
|
|
2
org/k8s/kube-controller-manager/test.yaml
Normal file
2
org/k8s/kube-controller-manager/test.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
entrypoint: "/bin/sh"
|
||||||
|
command: "kube-controller-manager --version"
|
@ -1 +0,0 @@
|
|||||||
kube-proxy --version
|
|
2
org/k8s/kube-proxy/test.yaml
Normal file
2
org/k8s/kube-proxy/test.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
entrypoint: "/bin/sh"
|
||||||
|
command: "kube-proxy --version"
|
@ -1 +0,0 @@
|
|||||||
kube-scheduler --version
|
|
2
org/k8s/kube-scheduler/test.yaml
Normal file
2
org/k8s/kube-scheduler/test.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
entrypoint: "/bin/sh"
|
||||||
|
command: "kube-scheduler --version"
|
2
org/k8s/pause/test.yaml
Normal file
2
org/k8s/pause/test.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
entrypoint: "/pause"
|
||||||
|
command: "-v"
|
@ -1 +0,0 @@
|
|||||||
node-collector --help
|
|
2
org/k8s/trivy-node-collector/test.yaml
Normal file
2
org/k8s/trivy-node-collector/test.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
entrypoint: "/bin/sh"
|
||||||
|
command: "node-collector --help"
|
2
org/other/apache2/test.yaml
Normal file
2
org/other/apache2/test.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
entrypoint: "/bin/sh"
|
||||||
|
command: "apachectl -v"
|
2
org/other/etcd/test.yaml
Normal file
2
org/other/etcd/test.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
entrypoint: "/bin/sh"
|
||||||
|
command: "etcdctl version"
|
2
org/other/gitea/test.yaml
Normal file
2
org/other/gitea/test.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
entrypoint: "/bin/sh"
|
||||||
|
command: "gitea --version"
|
2
org/other/nginx/test.yaml
Normal file
2
org/other/nginx/test.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
entrypoint: "/bin/sh"
|
||||||
|
command: "nginx -v"
|
2
org/other/node/test.yaml
Normal file
2
org/other/node/test.yaml
Normal 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
Loading…
Reference in New Issue
Block a user