change branches p*/c* workflow for new struct
This commit is contained in:
@ -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: |
|
||||||
|
Reference in New Issue
Block a user