23 Commits

Author SHA1 Message Date
70ab7aa80d test creating package event 2024-09-27 18:33:08 +03:00
53148b13e9 add o=publish script, add rework to full wf 2024-09-27 16:55:49 +03:00
17619fe844 fix from-path in dockerfiles
All checks were successful
Full building alt images / build-process (push) Successful in 9m41s
Full building alt images / test-process (push) Successful in 4m16s
2024-05-24 17:28:59 +03:00
1b60aaab69 Обновить org/other/apache2/Dockerfile.template 2024-05-24 17:01:04 +03:00
24c0f309a8 Обновить org/other/apache2/Dockerfile.template 2024-05-24 17:00:07 +03:00
00e92ce73c Обновить org/other/python/Dockerfile.template 2024-05-24 16:59:07 +03:00
92afc86488 Обновить .gitea/workflows/testscript
All checks were successful
Full building alt images / build-process (push) Successful in 4m25s
Full building alt images / test-process (push) Has been skipped
2024-05-24 15:31:15 +03:00
425544a9e2 Обновить .gitea/workflows/testscript
All checks were successful
Full building alt images / build-process (push) Successful in 11m27s
Full building alt images / test-process (push) Successful in 3m8s
2024-05-24 14:21:15 +03:00
b7b8c1cc43 Обновить .gitea/workflows/testscript
All checks were successful
Full building alt images / build-process (push) Successful in 11m25s
Full building alt images / test-process (push) Successful in 2m58s
2024-05-24 13:57:40 +03:00
fe5505f5bb Обновить .gitea/workflows/testscript
All checks were successful
Full building alt images / build-process (push) Successful in 11m41s
Full building alt images / test-process (push) Successful in 2m55s
2024-05-24 13:26:07 +03:00
c09ac19197 Обновить .gitea/workflows/testscript
All checks were successful
Full building alt images / build-process (push) Successful in 11m21s
Full building alt images / test-process (push) Successful in 1m50s
2024-05-24 13:05:47 +03:00
3fd7e42cf1 Обновить .gitea/workflows/wf_full_p10.yaml 2024-05-24 13:04:13 +03:00
03978ae7ca Обновить .gitea/workflows/testscript
All checks were successful
Full building alt images / build-process (push) Successful in 11m18s
Full building alt images / test-process (push) Successful in 1m36s
2024-05-24 12:26:08 +03:00
05bda1c7a6 Обновить .gitea/workflows/wf_full_p10.yaml
Some checks failed
Full building alt images / build-process (push) Successful in 11m24s
Full building alt images / test-process (push) Failing after 1m37s
2024-05-24 11:39:01 +03:00
aac8445456 Обновить .gitea/workflows/wf_full_p10.yaml
All checks were successful
Full building alt images / build-process (push) Successful in 1m50s
Full building alt images / test-process (push) Has been skipped
2024-05-24 11:10:22 +03:00
556ee2952c Обновить .gitea/workflows/testscript 2024-05-23 18:41:06 +03:00
795c9cdd5f Обновить .gitea/workflows/testscript
Some checks failed
Full building alt images / build-process (push) Successful in 53m27s
Full building alt images / test-process (push) Failing after 1m39s
2024-05-23 16:20:27 +03:00
c6819fad58 Обновить .gitea/workflows/testscript 2024-05-23 16:18:52 +03:00
b7aeed6996 Обновить .gitea/workflows/wf_full_p10.yaml 2024-05-23 16:14:09 +03:00
775f388990 Обновить .gitea/workflows/wf_full_p10.yaml
All checks were successful
Full building alt images / build-process (push) Successful in 1m52s
Full building alt images / test-process (push) Has been skipped
2024-05-23 15:59:23 +03:00
ebc3a8886b Обновить .gitea/workflows/wf_full_p10.yaml 2024-05-23 15:57:54 +03:00
42cd5492ad Обновить build.py
All checks were successful
Full building alt images / build-process (push) Successful in 2m20s
Full building alt images / test-process (push) Has been skipped
2024-05-23 15:44:35 +03:00
8c4c43e20c Обновить .gitea/workflows/wf_full_p10.yaml 2024-05-23 15:21:17 +03:00
30 changed files with 124 additions and 453 deletions

View File

@ -1,74 +0,0 @@
name: 'Reusable test job'
description: 'Test for images'
outputs:
result:
description: "Result of test (success|failure)"
value: ${{ jobs.example_job.outputs.output1 }}
inputs:
image: string
branch: string
url: string
repo: string
runs:
using: 'composite'
steps:
- name: Update apt
uses: https://gitea.basealt.ru/actions/init-alt-env@v1
- name: Install requires
run: |
echo "apt-get install -y python3-module-tomli python3-module-jinja2 podman buildah"
apt-get install -y python3-module-tomli python3-module-jinja2 podman buildah
echo "apt-get install -y qemu-user-static-binfmt-aarch64 qemu-user-static-binfmt-arm qemu-user-static-binfmt-ppc"
apt-get install -y qemu-user-static-binfmt-aarch64 qemu-user-static-binfmt-arm qemu-user-static-binfmt-ppc
- name: Check out current repo
uses: https://gitea.com/actions/checkout@v4
with:
repository: ${{ gitea.server_url }}/${{ inputs.repo }}/gitea-image-forge
- 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}
echo "test script: $testscript"
env:
IM: ${{ inputs.image }}
BR: ${{ inputs.branch }}
- name: Run test
id: test-script
if: ${{ env.TEST != '' }}
continue-on-error: true
uses: https://gitea.basealt.ru/actions/podman-run-action@v2
with:
image: ${{ inputs.url }}/${{ inputs.repo }}/${{ inputs.image }}:${{ inputs.branch }}
options: --rm
run: ${{ env.TEST }}
- name: Run special test
id: special-test
if: ${{ env.TEST == '' }}
continue-on-error: true
run: |
if [[ IM = 'alt/distroless-true' ]]; then podman run --rm $URL/$REPO/$IM:$BR true; fi
if [[ IM = 'alt/distroless-gotop' ]]; then podman run --rm $URL/$REPO/$IM:$BR --version; fi
env:
IM: ${{ inputs.image }}
BR: ${{ inputs.branch }}
URL: ${{ inputs.url }}
- name: Send notification if test crashed
if: ${{ steps.test-script.outcome == 'failure' || steps.special-test.outcome == 'failure' }}
run: |
issueid=$(curl -X 'GET' "$URL/api/v1/repos/$REPO/gitea-image-forge/issues?state=all&type=issues&page=1&limit=1&token=$T" -H 'accept: application/json' -s | jq '.[].number' -r)
body="Building of image $IM for branch $BR is failed"
curl -X 'POST' "$URL/api/v1/repos/$REPO/gitea-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"
env:
T: ${{ secrets.TOKEN }}
URL: ${{ gitea.server_url }}
IM: ${{ inputs.image }}
BR: ${{ inputs.branch }}
REPO: ${{ inputs.repo }}
- name: Finish test
run: echo "finish test for image $IM on branch $BR"
env:
IM: ${{ inputs.image }}
BR: ${{ inputs.branch }}

View File

@ -0,0 +1,15 @@
name: Run tests wf
on:
registry_package:
types: [published, updated]
jobs:
build-process:
runs-on: alt-sisyphus
steps:
- name: Check event
run: |
echo "name package = ${{ github.event.registry_package.name }}"
echo "path package = ${{ github.event.registry_package.html_url }}"
echo "version package = ${{ github.event.registry_package.package_version.version }}"
echo "version package = ${{ github.event.registry_package.package_version.container_metadata.tag.name }}"

View File

@ -11,15 +11,16 @@ ORG=${2:-"base"}
URL=${3:-"gitea.basealt.ru"} URL=${3:-"gitea.basealt.ru"}
REPO=${4:-"alt"} REPO=${4:-"alt"}
WS=${5:-"image-forge"} WS=${5:-"image-forge"}
wspath="/workspace/$REPO/$WS"
errors='' errors=''
haserr=false haserr=false
for IM in $(ls $WS/org/$ORG/ | xargs) for IM in $(ls $wspath/org/$ORG/ | xargs)
do do
echo "image=$IM" echo "image=$IM"
imgpath="$REPO/$WS/$BR/$IM:$BR" imgpath="$REPO/$BR/$ORG/$IM:$BR"
command='' command=''
testpath="$WS/org/$ORG/$IM/test.yaml" testpath="$wspath/org/$ORG/$IM/test.yaml"
if test -f $testpath if test -f $testpath
then then
entrypoint='' entrypoint=''
@ -41,21 +42,22 @@ do
echo "start change tag for $IM" echo "start change tag for $IM"
if [[ $ORG != 'base' ]] if [[ $ORG != 'base' ]]
then then
package=$(podman images --filter reference=$URL/$imgpath --format='{{ json .Labels }}' | jq '."org.opencontainers.image.title"' -r 2> /dev/null) package=$(podman images --filter reference=$URL/$imgpath --format='{{ json .Labels }}' | jq '."org.opencontainers.image.title"' -r 2> /dev/null)
if [[ $package != '' ]] if [[ $package != '' ]]
then then
tag=$(podman run --rm --entrypoint="/bin/sh" $URL/$imgpath -c "rpm -qa --qf \"%{VERSION}\n\" $package" 2> /dev/null) tag=$(podman run --rm --entrypoint="/bin/sh" $URL/$imgpath -c "rpm -qa --qf \"%{VERSION}\n\" $package" 2> /dev/null)
else else
echo "not found package name in images labels" echo "not found package name in images labels"
fi fi
else else tag=$(date +"%Y%m%d")
then tag=$(date +"%Y%m%d")
fi fi
if [[ $tag != '' ]] if [[ $tag != '' ]]
then then
skopeo copy -a docker://$URL/$imgpath:$BR docker://$URL/$imgpath:$tag echo "newtag=$tag"
scopeo delete docker://$URL/$imgpath:$BR newimgpath="$REPO/$BR/$ORG/$IM:$tag"
skopeo copy -a docker://$URL/$imgpath docker://$URL/$newimgpath
#skopeo delete docker://$URL/$imgpath
echo "tag is updated" echo "tag is updated"
else echo "new tag is empty and is not sent to repository" else echo "new tag is empty and is not sent to repository"
fi fi
@ -70,7 +72,6 @@ do
echo "podman rmi --all" echo "podman rmi --all"
podman rmi --all podman rmi --all
fi
haserr=false haserr=false
done done

View File

@ -1,142 +0,0 @@
name: Building alt images
on:
push:
tags:
- '*_*/*'
jobs:
build-process:
runs-on: alt-latest
outputs:
branch: ${{ env.BRANCH }}
image: ${{ env.IMAGE }}
url: ${{ env.URL }}
repo: ${{ env.REPO }}
buildres: ${{ steps.build-script.outcome }}
test: ${{ env.TEST }}
steps:
- name: Check workspace
run: |
repourl=$(echo $GU | cut -d '/' -f 3)
echo "URL=$repourl" >> ${GITHUB_ENV}
reponame=$(echo $GR | cut -d '/' -f 1)
echo "REPO=$reponame" >> ${GITHUB_ENV}
env:
GU: ${{ gitea.server_url }}
GR: ${{ gitea.repository }}
- name: Update apt
uses: https://gitea.basealt.ru/actions/init-alt-env@v1
- name: Install requires
run: |
echo "apt-get install -y python3-module-tomli python3-module-jinja2 podman buildah jq"
apt-get install -y python3-module-tomli python3-module-jinja2 podman buildah jq
echo "apt-get install -y qemu-user-static-binfmt-aarch64 qemu-user-static-binfmt-arm qemu-user-static-binfmt-ppc"
apt-get install -y qemu-user-static-binfmt-aarch64 qemu-user-static-binfmt-arm qemu-user-static-binfmt-ppc
- name: Check out current repo
uses: https://gitea.com/actions/checkout@v4
- name: Login podman gitea
run: |
echo "podman login ${{ env.URL }}"
podman login --username $P_USER --password $P_PASS ${{ env.URL }}
env:
P_USER: ${{ secrets.PODMAN_USER }}
P_PASS: ${{ secrets.PODMAN_PASS }}
- name: Check files in the repository
run: |
ls -a ${{ gitea.workspace }}
- name: Parse target branch and tag from events context, save to env
env:
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"
- 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:
IM: ${{ env.IMAGE }}
BR: ${{ env.BRANCH }}
- name: Run building script
id: build-script
run: |
echo "build.py -i $IM -b $BR"
if [[ $BR == 'sisyphus' ]]; then ${{ gitea.workspace }}/build.py -i $IM -b $BR --skip-arches arm; else ${{ gitea.workspace }}/build.py -i $IM -b $BR; fi
env:
IM: ${{ env.IMAGE }}
BR: ${{ env.BRANCH }}
continue-on-error: true
test-process:
needs: build-process
runs-on: alt-latest
outputs:
testres: ${{ steps.test-script.outcome == 'success' || steps.special-test.outcome == 'success' }}
steps:
- name: Update apt
uses: https://gitea.basealt.ru/actions/init-alt-env@v1
- name: Install requires
run: |
echo "apt-get install -y python3-module-tomli python3-module-jinja2 podman buildah"
apt-get install -y python3-module-tomli python3-module-jinja2 podman buildah
echo "apt-get install -y qemu-user-static-binfmt-aarch64 qemu-user-static-binfmt-arm qemu-user-static-binfmt-ppc"
apt-get install -y qemu-user-static-binfmt-aarch64 qemu-user-static-binfmt-arm qemu-user-static-binfmt-ppc
- name: Run test
id: test-script
if: ${{ needs.build-process.outputs.buildres == 'success' && needs.build-process.outputs.test != '' }}
continue-on-error: true
uses: https://gitea.basealt.ru/actions/podman-run-action@v2
with:
image: ${{ needs.build-process.outputs.url }}/${{ needs.build-process.outputs.repo }}/${{ needs.build-process.outputs.image }}:${{ needs.build-process.outputs.branch }}
options: --rm
run: ${{ needs.build_process.outputs.test }}
- name: Run special test
id: special-test
if: ${{ needs.build-process.outputs.buildres == 'success' && needs.build-process.outputs.test == '' }}
continue-on-error: true
run: |
if [[ IM = 'alt/distroless-true' ]]; then podman run --rm $URL/$REPO/$IM:$BR true; fi
if [[ IM = 'alt/distroless-gotop' ]]; then podman run --rm $URL/$REPO/$IM:$BR --version; fi
env:
IM: ${{ needs.build-process.outputs.image }}
BR: ${{ needs.build-process.outputs.branch }}
URL: ${{ needs.build-process.outputs.url }}
REPO: ${{ needs.build-process.outputs.repo }}
finish_process:
needs: [ build-process, test-process ]
runs-on: alt-latest
steps:
- name: Update apt
uses: https://gitea.basealt.ru/actions/init-alt-env@v1
- name: Install requires
run: |
echo "apt-get install -y curl jq"
apt-get install -y curl jq
- name: Delete event tag
run: |
tagname=$(echo $EV | jq '.ref' -r | sed "s/refs\/tags\///g")
curl -X 'DELETE' "https://$URL/api/v1/repos/$REPO/gitea-image-forge/tags/$tagname?token=$T" -H 'accept: application/json' -s
echo "tag $BR_$IM is deleted"
env:
T: ${{ secrets.TOKEN }}
URL: ${{ needs.build-process.outputs.url }}
REPO: ${{ needs.build-process.outputs.repo }}
IM: ${{ needs.build-process.outputs.image }}
BR: ${{ needs.build-process.outputs.branch }}
EV: ${{ toJson(gitea.event) }}
continue-on-error: true
- name: Send comment to issue for notification
run: |
issueid=$(curl -X 'GET' "https://$URL/api/v1/repos/$REPO/gitea-image-forge/issues?state=all&type=issues&page=1&limit=1&token=$T" -H 'accept: application/json' -s | jq '.[].number' -r)
if [[ ${{ needs.build-process.outputs.buildres }} = 'success' ]] && [[ ${{ needs.test-process.outputs.testres }} ]]; then body="Building of image $IM for branch $BR finished success"; else body="Testing of image $IM for branch $BR is failed"; fi
if [[ ${{ needs.build-process.outputs.buildres }} != 'success' ]]; then body="Building of image $IM for branch $BR is failed"; fi
curl -X 'POST' "https://$URL/api/v1/repos/$REPO/gitea-image-forge/issues/$issueid/comments?token=$T" -H 'accept: application/json' -H 'Content-Type: application/json' -d "{ \"body\": \"$body\" }" -s
echo "notification is sent to issue $issueid"
env:
T: ${{ secrets.TOKEN }}
URL: ${{ needs.build-process.outputs.url }}
REPO: ${{ needs.build-process.outputs.repo }}
IM: ${{ needs.build-process.outputs.image }}
BR: ${{ needs.build-process.outputs.branch }}

View File

@ -1,169 +0,0 @@
name: Full building alt images v2
on:
push:
tags:
- '*#*'
jobs:
build-process:
runs-on: alt-p10
outputs:
branch: ${{ env.BRANCH }}
org: ${{ env.ORG }}
url: ${{ env.URL }}
repo: ${{ env.REPO }}
buildres: ${{ steps.build-script.outcome }}
steps:
- name: Check workspace
run: |
repourl=$(echo $GU | cut -d '/' -f 3)
echo "URL=$repourl" >> ${GITHUB_ENV}
echo $repourl
reponame=$(echo $GR | cut -d '/' -f 1)
echo "REPO=$reponame" >> ${GITHUB_ENV}
echo $reponame
env:
GU: ${{ gitea.server_url }}
GR: ${{ gitea.repository }}
- name: Update apt
uses: https://gitea.basealt.ru/actions/init-alt-env@v1
- name: Install requires
run: |
echo "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
echo "apt-get install -y qemu-user-static-binfmt-aarch64 qemu-user-static-binfmt-arm qemu-user-static-binfmt-ppc"
apt-get install -y qemu-user-static-binfmt-aarch64 qemu-user-static-binfmt-arm qemu-user-static-binfmt-ppc
- name: Check out current repo
uses: https://gitea.com/actions/checkout@v4
- name: Parse target branch and tag from events context, save to env
env:
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"
- name: Login podman gitea
run: |
echo "podman login ${{ env.URL }}"
podman login --username $P_USER --password $P_PASS ${{ env.URL }}
env:
P_USER: ${{ secrets.PODMAN_USER }}
P_PASS: ${{ secrets.PODMAN_PASS }}
- name: Run building script
id: build-script
run: |
build_args="-b $BR"
if [[ $BR == 'sisyphus' ]]; then build_args="$build_args --skip-arches arm"; fi
if [[ $ORG == 'k8s' ]]; then build_args="$build_args --overwrite-organization $ORG-$BR"; fi
echo "build.py $build_args"
${{ gitea.workspace }}/build.py $build_args -i alt/distroless-true
env:
ORG: ${{ env.ORG }}
BR: ${{ env.BRANCH }}
continue-on-error: true
- name: Send notification if build crashed
if: ${{ steps.build-script.outcome != 'success' }}
run: |
issueid=$(curl -X 'GET' "$URL/api/v1/repos/$REPO/gitea-image-forge/issues?state=all&type=issues&page=1&limit=1&token=$T" -H 'accept: application/json' -s | jq '.[].number' -r)
body="Building images finish with some errors."
curl -X 'POST' "$URL/api/v1/repos/$REPO/gitea-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"
env:
T: ${{ secrets.TOKEN }}
BR: ${{ env.BRANCH }}
URL: ${{ gitea.server_url }}
REPO: ${{ env.REPO }}
- name: Delete event tag
run: |
tagname=$(echo $EV | jq '.ref' -r | sed "s/refs\/tags\///g")
curl -X 'DELETE' "$URL/api/v1/repos/$REPO/gitea-image-forge/tags/$tagname?token=$T" -H 'accept: application/json' -s
echo "tag $tagname is deleted"
env:
T: ${{ secrets.TOKEN }}
BR: ${{ env.BRANCH }}
URL: ${{ gitea.server_url }}
REPO: ${{ env.REPO }}
EV: ${{ toJson(gitea.event) }}
test-process-alt:
needs: build-process
if: ${{ needs.build-process.outputs.buildres == 'success' && needs.build-process.outputs.org == 'alt' }}
runs-on: alt-p10
strategy:
max-parallel: 5
matrix:
images:
- apache2
- base
- buildpack-deps
- buildpack-deps-curl
- buildpack-deps-scm
- devel
- distroless-base
- distroless-builder
- distroless-devel
- distroless-gotop
- distroless-static
- distroless-true
- etcd
- gitea
- nginx
- node
- prometheus
- python
- registry
- ruby
- systemd
- unit
steps:
- name: Update apt
uses: ${{ gitea.server_url }}/actions/init-alt-env@v1
- name: Install requires
run: |
echo "apt-get install -y python3-module-tomli python3-module-jinja2 podman buildah curl jq"
apt-get install -y python3-module-tomli python3-module-jinja2 podman buildah curl jq
- uses: https://gitea.basealt.ru/actions/image-forge-test@v1
continue-on-error: true
with:
image: ${{ matrix.images }}
branch: ${{ needs.build-process.outputs.branch }}
org: ${{ needs.build-process.outputs.org }}
url: ${{ needs.build-process.outputs.url }}
repo: ${{ needs.build-process.outputs.repo }}
test-process-k8s:
needs: build-process
if: ${{ needs.build-process.outputs.buildres == 'success' && needs.build-process.outputs.org == 'k8s' }}
runs-on: alt-p10
strategy:
max-parallel: 5
matrix:
images:
- cert-manager-cainjector
- cert-manager-controller
- cert-manager-webhook
- coredns
- etcd
- flannel
- flannel-cni-plugin
- kube-apiserver
- kube-controller-manager
- kube-proxy
- kube-scheduler
- pause
- trivy-node-collector
steps:
- name: Update apt
uses: ${{ gitea.server_url }}/actions/init-alt-env@v1
- name: Install requires
run: |
echo "apt-get install -y python3-module-tomli python3-module-jinja2 podman buildah curl jq"
apt-get install -y python3-module-tomli python3-module-jinja2 podman buildah curl jq
- uses: https://gitea.basealt.ru/actions/image-forge-test@v1
continue-on-error: true
with:
image: ${{ matrix.images }}
branch: ${{ needs.build-process.outputs.branch }}
org: ${{ needs.build-process.outputs.org }}
url: ${{ needs.build-process.outputs.url }}
repo: ${{ needs.build-process.outputs.repo }}

View File

@ -15,6 +15,7 @@ jobs:
org: ${{ env.ORG }} org: ${{ env.ORG }}
url: ${{ env.URL }} url: ${{ env.URL }}
repo: ${{ env.REPO }} repo: ${{ env.REPO }}
ws: ${{ env.WS }}
buildres: ${{ steps.build-script.outcome }} buildres: ${{ steps.build-script.outcome }}
steps: steps:
- name: Check workspace - name: Check workspace
@ -25,6 +26,9 @@ jobs:
reponame=$(echo $GR | cut -d '/' -f 1) reponame=$(echo $GR | cut -d '/' -f 1)
echo "REPO=$reponame" >> ${GITHUB_ENV} echo "REPO=$reponame" >> ${GITHUB_ENV}
echo $reponame echo $reponame
repows=$(echo $GR | cut -d '/' -f 2)
echo "WS=$repows" >> ${GITHUB_ENV}
echo $repows
env: env:
GU: ${{ gitea.server_url }} GU: ${{ gitea.server_url }}
GR: ${{ gitea.repository }} GR: ${{ gitea.repository }}
@ -64,52 +68,57 @@ jobs:
- name: Run standart building script - name: Run standart building script
id: build-script id: build-script
run: | run: |
build_args="-b $BR -o $ORG --skip-images base/distroless-devel --overwrite-organization $BR --registry $URL/${{ gitea.workspace }}/$BR" build_args="-b $BR -o $ORG --skip-images base/distroless-devel --registry $URL/$REPO/$BR -a amd64"
echo "build.py $build_args" echo "build.py $build_args"
${{ gitea.workspace }}/build.py $build_args ${{ gitea.workspace }}/build.py $build_args
env: env:
ORG: ${{ env.ORG }} ORG: ${{ env.ORG }}
BR: ${{ env.BRANCH }} BR: ${{ env.BRANCH }}
REPO: ${{ env.REPO }}
continue-on-error: true continue-on-error: true
- name: Send notification if build crashed - name: Send notification if build crashed
if: ${{ steps.build-script.outcome != 'success' }} if: ${{ steps.build-script.outcome != 'success' }}
run: | run: |
issueid=1 issueid=1
body="Building images finish with some errors." body="Building images 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 curl -X 'POST' "$URL/api/v1/repos/$REPO/$GWS/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: env:
T: ${{ secrets.TOKEN }} T: ${{ secrets.TOKEN }}
BR: ${{ env.BRANCH }} BR: ${{ env.BRANCH }}
URL: ${{ gitea.server_url }} URL: ${{ gitea.server_url }}
REPO: ${{ env.REPO }} REPO: ${{ env.REPO }}
GWS: ${{ env.WS }}
- name: Delete event tag - name: Delete event tag
run: | run: |
tagname=$(echo $EV | jq '.ref' -r | sed "s/refs\/tags\///g") 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 curl -X 'DELETE' "$URL/api/v1/repos/$REPO/$GWS/tags/$tagname?token=$T" -H 'accept: application/json' -s
echo "tag $tagname is deleted" echo "tag $tagname is deleted"
env: env:
T: ${{ secrets.TOKEN }} T: ${{ secrets.TOKEN }}
BR: ${{ env.BRANCH }} BR: ${{ env.BRANCH }}
URL: ${{ gitea.server_url }} URL: ${{ gitea.server_url }}
REPO: ${{ env.REPO }} REPO: ${{ env.REPO }}
GWS: ${{ env.WS }}
EV: ${{ toJson(gitea.event) }} EV: ${{ toJson(gitea.event) }}
test-process: test-process:
needs: build-process needs: build-process
if: ${{ needs.build-process.outputs.buildres == 'success' }} if: ${{ needs.build-process.outputs.buildres == 'success' }}
runs-on: alt-p10 runs-on: alt-p10
outputs:
testres: ${{ steps.test-script.outcome }}
steps: steps:
- name: Update apt - name: Update apt
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 skopeo jq yq 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 skopeo jq yq 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: Login podman gitea - name: Login podman gitea
run: | run: |
echo "podman login ${{ env.URL }}" echo "podman login ${{ needs.build-process.outputs.url }}"
podman login --username $P_USER --password $P_PASS ${{ needs.build-process.outputs.url }} podman login --username $P_USER --password $P_PASS ${{ needs.build-process.outputs.url }}
env: env:
P_USER: ${{ secrets.PODMAN_USER }} P_USER: ${{ secrets.PODMAN_USER }}
@ -118,7 +127,7 @@ jobs:
id: test-script id: test-script
continue-on-error: true continue-on-error: true
run: | run: |
$WS/.gitea/workflows/testscript $BR $ORG $URL $REPO $WS $WS/.gitea/workflows/testscript $BR $ORG $URL $REPO $GWS
cat haserr.log >> ${GITHUB_ENV} cat haserr.log >> ${GITHUB_ENV}
echo "test process finished" echo "test process finished"
env: env:
@ -127,16 +136,60 @@ jobs:
URL: ${{ needs.build-process.outputs.url }} URL: ${{ needs.build-process.outputs.url }}
REPO: ${{ needs.build-process.outputs.repo }} REPO: ${{ needs.build-process.outputs.repo }}
WS: ${{ gitea.workspace }} WS: ${{ gitea.workspace }}
GWS: ${{ needs.build-process.outputs.ws }}
- name: Send notification if test crashed - name: Send notification if test crashed
if: ${{ env.ERR == 'true' || steps.test-script.outcome == 'failure' }} if: ${{ env.ERR == 'true' || steps.test-script.outcome == 'failure' }}
run: | run: |
issueid=1 issueid=1
errors=$(cat errors.log) d errors=$(cat errors.log)
body="Testing images finish with some errors. $errors" body="Testing images finish with some errors. $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 curl -X 'POST' "$URL/api/v1/repos/$REPO/gitea-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: env:
T: ${{ secrets.TOKEN }} T: ${{ secrets.TOKEN }}
BR: ${{ needs.build-process.outputs.branch }} BR: ${{ needs.build-process.outputs.branch }}
URL: ${{ gitea.server_url }} URL: ${{ gitea.server_url }}
REPO: ${{ needs.build-process.outputs.repo }} REPO: ${{ needs.build-process.outputs.repo }}
push-process:
needs: [build-process, test-process]
if: ${{ needs.test-process.outputs.testres == 'success' && secrets.PUSH_REPO != '' }}
runs-on: alt-p10
steps:
- name: Update apt
uses: actions/init-alt-env@v1
- name: Install reqier-s
run: |
echo "apt-get install -y skopeo jq"
apt-get install -y skopeo jq
- name: Get branch and tags to push
run: |
echo "PUSH_BRANCH=$BR" >> ${GITHUB_ENV}
images=$()
echo "PUSH_IMAGES=$images" >> ${GITHUB_ENV}
if [[ $BR == 'p10' ]]; then echo "PUSH_TAGS=latest" >> ${GITHUB_ENV}; fi
env:
BR: ${{ needs.build-process.outputs.branch }}
- name: Get branch (only for c*N branches)
if: ${{ contains(github.ref_name, 'c10f2') }}
run: |
newbr=$(skopeo list-tags docker://$URL/$REPO/$BR/base/alt | jq '.Tags.[]' -r 2> /dev/null | sort | grep -m 1 c 2> /dev/null)
echo "PUSH_BRANCH=$newbr" >> ${GITHUB_ENV}
env:
BR: ${{ needs.build-process.outputs.branch }}
ORG: ${{ needs.build-process.outputs.org }}
URL: ${{ needs.build-process.outputs.url }}
REPO: ${{ needs.build-process.outputs.repo }}
- name: Run skopeo action
if: ${{ env.PUSH_BRANCH == needs.build-process.outputs.branch }}
uses: actions/skopeo-copy@v1
with:
source: ${{ needs.build-process.outputs.url }/${{ needs.build-process.outputs.repo }}/${{ needs.build-process.outputs.branch }}/${{ needs.build-process.outputs.org }}
source-proto: docker://
dest: ${{ secrets.PUSH_REPO }}/${{ needs.build-process.outputs.branch }}
dest-proto: docker://
dest-login: ${{ secrets.PUSH_USER }}
dest-pass: ${{ secrets.PUSH_PASS }}
tags: ${{ env.PUSH_TAGS }}
last-ver-tags: true
images: ${{ env.PUSH_IMAGES }}
args: -a

View File

@ -0,0 +1,21 @@
name: 'Reusable test job'
description: 'Test for images'
outputs:
result:
description: "Result of test (success|failure)"
value: ${{ jobs.example_job.outputs.output1 }}
inputs:
image: string
branch: string
url: string
repo: string
runs:
using: 'composite'
steps:
- name: Install requires
run: |
echo "apt-get install -y skopeo jq"
apt-get install -y skopeo jq
- name: Scopeo copy

View File

@ -1,23 +0,0 @@
name: Test job
on:
push:
tags:
- 'test*'
jobs:
test-job:
runs-on: alt-latest
steps:
- name: Parse target branch
run: |
echo $EV
echo ${{ github.action_path }}
echo ${{ github.action_ref }}
echo ${{ github.event }}
echo ${{ github.event_name }}
echo ${{ github.event_path }}
echo ${{ github.triggering_actor }}
echo ${{ github.workspace }}
echo ${{ github.ref_name }}
env:
EV: ${{ toJson(gitea.event) }}

View File

@ -230,7 +230,7 @@ class DockerBuilder:
) -> str: ) -> str:
if self.registry: if self.registry:
registry = self.registry.rstrip("/") + "/" registry = self.registry.rstrip("/") + "/"
alt_image = "alt/alt" alt_image = "base/alt"
else: else:
registry = "" registry = ""
alt_image = "alt" alt_image = "alt"
@ -307,7 +307,7 @@ class DockerBuilder:
f"{from_image['organization']}/{from_image['name']}" f"{from_image['organization']}/{from_image['name']}"
) )
elif distrolessfile.exists(): elif distrolessfile.exists():
requires.add("alt/distroless-builder") requires.add("base/distroless-builder")
raw_from = self.distrolesses[canonical_name].raw_from raw_from = self.distrolesses[canonical_name].raw_from
from_ = self.render_template(raw_from, self.organization) from_ = self.render_template(raw_from, self.organization)
if match := re.match(self.image_re, from_): if match := re.match(self.image_re, from_):
@ -345,7 +345,7 @@ class DockerBuilder:
def distroless_build(self, image: Image, arches): def distroless_build(self, image: Image, arches):
def distroless_build_arch(arch, manifest): def distroless_build_arch(arch, manifest):
distroless_builder = self.render_full_tag( distroless_builder = self.render_full_tag(
Image("alt/distroless-builder"), self.branch Image("base/distroless-builder"), self.branch
) )
distroless = self.distrolesses[image.canonical_name] distroless = self.distrolesses[image.canonical_name]
distroless.render_arch_branch(arch, self.branch) distroless.render_arch_branch(arch, self.branch)

View File

@ -1,4 +1,4 @@
FROM {{ registry }}{{ organization }}/buildpack-deps-curl:{{ branch }} FROM {{ registry }}base/buildpack-deps-curl:{{ branch }}
MAINTAINER alt-cloud MAINTAINER alt-cloud

View File

@ -1,4 +1,4 @@
FROM {{ registry }}{{ organization }}/buildpack-deps-scm:{{ branch }} FROM {{ registry }}base/buildpack-deps-scm:{{ branch }}
MAINTAINER alt-cloud MAINTAINER alt-cloud

View File

@ -1,4 +1,4 @@
FROM {{ registry }}{{ organization }}/base:{{ branch }} FROM {{ registry }}base/base:{{ branch }}
MAINTAINER alt-cloud MAINTAINER alt-cloud

View File

@ -1,4 +1,4 @@
from = "{{ registry }}{{ organization }}/distroless-static:{{ branch }}" from = "{{ registry }}base/distroless-static:{{ branch }}"
builder-install-packages = [ builder-install-packages = [
"glibc-core", "glibc-core",
'{{if_branches(["p10"], "glibc-nss")}}', '{{if_branches(["p10"], "glibc-nss")}}',

View File

@ -1,4 +1,4 @@
from = "{{ registry }}{{ organization }}/distroless-base:{{ branch }}" from = "{{ registry }}base/distroless-base:{{ branch }}"
builder-install-packages = [ builder-install-packages = [
"coreutils", "coreutils",
"findutils", "findutils",

View File

@ -1,3 +1,3 @@
from = "{{ registry }}{{ organization }}/distroless-base:{{ branch }}" from = "{{ registry }}base/distroless-base:{{ branch }}"
full-files = ["/usr/bin/gotop"] full-files = ["/usr/bin/gotop"]
entrypoint = ["/usr/bin/gotop"] entrypoint = ["/usr/bin/gotop"]

View File

@ -1,3 +1,3 @@
from = "{{ registry }}{{ organization }}/distroless-static:{{ branch }}" from = "{{ registry }}base/distroless-static:{{ branch }}"
files = ["/bin/true"] files = ["/bin/true"]
cmd = ["/bin/true"] cmd = ["/bin/true"]

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

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,4 +1,4 @@
FROM {{ registry }}{{ organization }}/buildpack-deps:{{ branch }} FROM {{ registry }}base/buildpack-deps:{{ branch }}
MAINTAINER alt-cloud MAINTAINER alt-cloud

View File

@ -1,4 +1,4 @@
FROM {{ registry }}{{ organization }}/base:{{ branch }} FROM {{ registry }}base/base:{{ branch }}
MAINTAINER alt-cloud MAINTAINER alt-cloud

View File

@ -1,4 +1,4 @@
FROM {{ registry }}{{ organization }}/base:{{ branch }} FROM {{ registry }}base/base:{{ branch }}
MAINTAINER alt-cloud MAINTAINER alt-cloud