Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
5d7af66514 | ||
|
55d9707d24 | ||
|
4250455f66 | ||
|
d54807cce9 | ||
|
2b7e1fec89 |
136
.gitea/workflows/wf.yaml
Normal file
136
.gitea/workflows/wf.yaml
Normal file
@ -0,0 +1,136 @@
|
||||
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
|
||||
run: |
|
||||
echo "apt-get update -y && apt-get install -y apt rpm"
|
||||
apt-get update -y && apt-get install -y apt rpm
|
||||
- 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: |
|
||||
testscript=$(cat ${{ gitea.workspace }}/org/$IM/test)
|
||||
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:
|
||||
if: ${{ jobs.build_process.env.BUILDRES == 'success' }}
|
||||
needs: build_process
|
||||
runs-on: alt-latest
|
||||
outputs:
|
||||
testres: ${{ steps.test_script.outcome }}
|
||||
steps:
|
||||
- name: Update apt
|
||||
run: |
|
||||
echo "apt-get update -y && apt-get install -y apt rpm"
|
||||
apt-get update -y && apt-get install -y apt rpm
|
||||
- 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
|
||||
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 }}
|
||||
finish_process:
|
||||
needs: [ build_process, test_process ]
|
||||
runs-on: alt-latest
|
||||
steps:
|
||||
- name: Update apt
|
||||
run: |
|
||||
echo "apt-get update -y && apt-get install -y apt rpm"
|
||||
apt-get update -y && apt-get install -y apt rpm
|
||||
- name: Update apt
|
||||
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 }} = "success" ]]; 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"
|
||||
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.image}}
|
23
.gitea/workflows/wf_test.yaml
Normal file
23
.gitea/workflows/wf_test.yaml
Normal file
@ -0,0 +1,23 @@
|
||||
name: Test_wf
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
Test-job:
|
||||
runs-on: alt-latest
|
||||
env:
|
||||
TEST: "gitea --version"
|
||||
steps:
|
||||
- name: Update apt
|
||||
run: apt-get update -y && apt-get install -y apt rpm
|
||||
- name: Install reqs
|
||||
run: apt-get install -y podman buildah
|
||||
- name: Podman run
|
||||
uses: https://gitea.basealt.ru/actions/podman-run-action@v2
|
||||
with:
|
||||
image: gitea.basealt.ru/images_repo/alt/gitea
|
||||
options: --rm
|
||||
run: ${{ env.TEST }}
|
||||
- run: echo "This job's status is ${{ job.status }}"
|
@ -32,3 +32,5 @@ On x86_64 machine using p10 branch you need:
|
||||
- `qemu-user-static-binfmt-aarch64` to build for arm64 architecture
|
||||
- `qemu-user-static-binfmt-arm` to build for arm architecture
|
||||
- `qemu-user-static-binfmt-ppc` to build for ppc64le architecture
|
||||
|
||||
|
||||
|
4
build.py
4
build.py
@ -654,7 +654,7 @@ def parse_args():
|
||||
nargs="+",
|
||||
default=images,
|
||||
choices=images,
|
||||
help="list of branches",
|
||||
help="list of images",
|
||||
)
|
||||
images_group.add_argument(
|
||||
"-o",
|
||||
@ -667,7 +667,7 @@ def parse_args():
|
||||
parser.add_argument(
|
||||
"-r",
|
||||
"--registry",
|
||||
default="registry.altlinux.org",
|
||||
default="gitea.basealt.ru/images_repo",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--overwrite-organization",
|
||||
|
1
org/alt/apache2/test
Normal file
1
org/alt/apache2/test
Normal file
@ -0,0 +1 @@
|
||||
apachectl -v
|
1
org/alt/gitea/test
Normal file
1
org/alt/gitea/test
Normal file
@ -0,0 +1 @@
|
||||
gitea --version
|
1
org/alt/python/test
Normal file
1
org/alt/python/test
Normal file
@ -0,0 +1 @@
|
||||
python3 --help
|
Loading…
Reference in New Issue
Block a user