forked from alt/image-forge
Compare commits
6 Commits
test-gitea
...
new_struct
Author | SHA1 | Date | |
---|---|---|---|
|
9c460b363e | ||
|
28c0fc03cf | ||
|
f8496320dd | ||
|
8cdee0b278 | ||
|
8cc6581c18 | ||
4bef9210e6 |
@@ -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
|
||||
|
@@ -2,7 +2,10 @@ name: Full building alt images
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*10*_*'
|
||||
- '*_*'
|
||||
tags-ignore:
|
||||
- '*_k8s'
|
||||
- 'sisyphus_*'
|
||||
|
||||
jobs:
|
||||
build-process:
|
||||
@@ -58,12 +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 [[ $BR == 'c10f1' || $BR == 'c10f2' ]]; then build_args="$build_args --skip-arches arm ppc64le"; fi
|
||||
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:
|
||||
@@ -102,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: |
|
||||
|
@@ -55,7 +55,6 @@ jobs:
|
||||
id: build-script
|
||||
run: |
|
||||
build_args="-b $BR -o $ORG --skip-images alt/distroless-devel"
|
||||
if [[ $BR == 'sisyphus' ]]; then build_args="$build_args --skip-arches arm"; fi
|
||||
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"
|
||||
${{ gitea.workspace }}/build.py $build_args
|
||||
|
4
build.py
4
build.py
@@ -638,8 +638,8 @@ class ImagesInfo:
|
||||
|
||||
def parse_args():
|
||||
stages = ["build", "remove_dockerfiles", "render_dockerfiles", "push"]
|
||||
arches = ["amd64", "386", "arm64", "arm", "ppc64le"]
|
||||
branches = ["p9", "p10", "sisyphus", "c10f1", "c10f2"]
|
||||
arches = ["amd64", "386", "arm64"]
|
||||
branches = ["p10", "sisyphus", "c10f1", "c10f2"]
|
||||
organizations = list(ORG_DIR.iterdir())
|
||||
images = [f"{o.name}/{i.name}" for o in organizations for i in o.iterdir()]
|
||||
organizations = [o.name for o in organizations]
|
||||
|
@@ -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,3 +0,0 @@
|
||||
ALT dockerfile for distroless-builder image.
|
||||
|
||||
This images is using to build tarball for distroless images.
|
@@ -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 @@
|
||||
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"
|
@@ -3,7 +3,7 @@ FROM {{ registry }}{{ alt_image }}:{{ branch }}
|
||||
MAINTAINER alt-cloud
|
||||
|
||||
LABEL org.opencontainers.image.title="distroless-builder"
|
||||
LABEL org.opencontainers.image.description="This images is using to build tarball for distroless images"
|
||||
LABEL org.opencontainers.image.description="This image is used to build tarballs for distroless images"
|
||||
LABEL org.opencontainers.image.licenses="GPLv2"
|
||||
LABEL org.opencontainers.image.vendor="ALT Linux Team"
|
||||
|
3
org/base/distroless-builder/README.md
Normal file
3
org/base/distroless-builder/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
ALT dockerfile for distroless-builder image.
|
||||
|
||||
This image is used to build tarballs for distroless images.
|
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"
|
13
org/base/trivy/Dockerfile.template
Normal file
13
org/base/trivy/Dockerfile.template
Normal file
@@ -0,0 +1,13 @@
|
||||
FROM {{ registry }}{{ alt_image }}:{{ branch }}
|
||||
|
||||
MAINTAINER alt-cloud
|
||||
|
||||
LABEL org.opencontainers.image.title="trivy"
|
||||
LABEL org.opencontainers.image.description="A Fast Vulnerability Scanner for Containers"
|
||||
LABEL org.opencontainers.image.source="https://aquasecurity.github.io/trivy"
|
||||
LABEL org.opencontainers.image.licenses="Apache-2.0"
|
||||
LABEL org.opencontainers.image.vendor="ALT Linux Team"
|
||||
|
||||
{{ install_packages("trivy") }}
|
||||
|
||||
ENTRYPOINT [ "trivy" ]
|
10
org/base/trivy/README.md
Normal file
10
org/base/trivy/README.md
Normal file
@@ -0,0 +1,10 @@
|
||||
dockerfiles-alt-trivy
|
||||
=====================
|
||||
|
||||
ALT dockerfile for trivy.
|
||||
|
||||
Copy dockerfile somewhere and built the image:
|
||||
`$ docker build --rm -t <username>/trivy .`
|
||||
|
||||
And launch the trivy container
|
||||
`$ docker run -it <username>/trivy`
|
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"
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user