add o=publish script, add rework to full wf

This commit is contained in:
Nadezhda Fedorova 2024-09-27 16:55:49 +03:00
parent 17619fe844
commit 53148b13e9
2 changed files with 68 additions and 2 deletions

View File

@ -105,6 +105,8 @@ jobs:
needs: build-process
if: ${{ needs.build-process.outputs.buildres == 'success' }}
runs-on: alt-p10
outputs:
testres: ${{ steps.test-script.outcome }}
steps:
- name: Update apt
uses: actions/init-alt-env@v1
@ -116,7 +118,7 @@ jobs:
uses: https://gitea.com/actions/checkout@v4
- name: Login podman gitea
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 }}
env:
P_USER: ${{ secrets.PODMAN_USER }}
@ -139,7 +141,7 @@ jobs:
if: ${{ env.ERR == 'true' || steps.test-script.outcome == 'failure' }}
run: |
issueid=1
errors=$(cat errors.log)
d errors=$(cat errors.log)
body="Testing images finish with some errors. $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"
@ -148,3 +150,46 @@ jobs:
BR: ${{ needs.build-process.outputs.branch }}
URL: ${{ gitea.server_url }}
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