Feature/helm chart (#26)
CI Main / Load example-gitea-env.conf to pipeline env (push) Successful in 23s
CI Git-Pages Main / Load git-pages.gitea-env.conf to pipeline env (push) Successful in 22s
CI Main / Check existing artifact (push) Successful in 22s
CI Git-Pages Main / Check existing artifact (push) Successful in 23s
CI Git-Pages Main / Report Summary (push) Successful in 6s
CI Main / Cucumber tests (push) Successful in 1m13s
CI Main / Bats tests (push) Successful in 2m1s
CI Feature / Load example-gitea-env.conf to pipeline env (push) Successful in 27s
CI Git-Pages Main / Build & Push Helm chart (push) Failing after 21s
ci-docker-build-push Docker build & push 0.2.13 OK
CI Main / Build & Push Docker (push) Successful in 53s
CI Main / Report Summary (push) Successful in 6s
CI Main / Move provider version tag (push) Successful in 16s
acc-tests Cucumber test report
CI Feature / Cucumber tests (push) Successful in 1m17s
unit-tests Bats test report
CI Feature / Bats tests (push) Successful in 1m59s
CI Feature / Report Summary (push) Successful in 5s

riippuvuudet haetaan main haarasta, ei etene ennen kuin on main haarassa nämä muutokset

---------

Co-authored-by: moilanik <niko.moilanen@tietoevry.com>
Reviewed-on: #26
This commit was merged in pull request #26.
This commit is contained in:
2026-06-19 08:35:52 +03:00
parent 908aee9f8b
commit c0012ba6fa
17 changed files with 1057 additions and 556 deletions
+9 -46
View File
@@ -27,54 +27,17 @@ jobs:
version: ${{ steps.set-outputs.outputs.version }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: niko/gitea-ci-library
path: .ci
- name: Check existing artifact and calculate version
run: |
if [ -n "${VERSION_FILE}" ]; then
if echo "${VERSION_FILE}" | grep -q '\.json$'; then
RAW_VERSION=$(jq -r '.version' "${VERSION_FILE}")
else
RAW_VERSION=$(cat "${VERSION_FILE}" | tr -d '[:space:]')
fi
elif [ -f VERSION ]; then
RAW_VERSION=$(cat VERSION | tr -d '[:space:]')
elif [ -f package.json ]; then
RAW_VERSION=$(jq -r '.version' package.json)
elif [ -f pom.xml ]; then
RAW_VERSION=$(grep -oP '<version>\K[^<]+' pom.xml | head -1)
else
echo "ERROR: No VERSION file, package.json, or pom.xml found" >&2
exit 1
fi
BASE_VERSION=$(echo "$RAW_VERSION" | cut -d'.' -f1-2)
echo "gitea-ci-library - Tunnistettu Major.Minor versio: $BASE_VERSION"
TAGS_JSON=$(curl -s -f -H "Authorization: token $GITEA_TOKEN" \
"${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/tags")
TAG=$(echo "$TAGS_JSON" | jq -r --arg prefix "${GIT_TAG_PREFIX}" '
if type == "array" then
.[] | select(.commit.sha == "${{ github.sha }}" and (.name | startswith($prefix))) | .name
else empty end' | head -1)
mkdir -p /tmp/build-ctx
if [ -n "$TAG" ]; then
echo "ARTIFACT_EXISTS=true" > /tmp/build-ctx/build.env
echo "NEXT_VERSION=$TAG" >> /tmp/build-ctx/build.env
echo "gitea-ci-library - Artefakti löytyi jo tagilla: $TAG."
else
echo "ARTIFACT_EXISTS=false" > /tmp/build-ctx/build.env
HIGHEST_PATCH=$(echo "$TAGS_JSON" | jq -r --arg prefix "${GIT_TAG_PREFIX}" --arg bv "${GIT_TAG_PREFIX}${BASE_VERSION}." '
if type == "array" then .[] | .name | select(startswith($bv)) | sub($bv; "") | tonumber else empty end' | sort -rn | head -1)
if [ -z "$HIGHEST_PATCH" ]; then NEXT_PATCH=0; else NEXT_PATCH=$((HIGHEST_PATCH + 1)); fi
FULL_VERSION="${BASE_VERSION}.${NEXT_PATCH}"
echo "NEXT_VERSION=$FULL_VERSION" >> /tmp/build-ctx/build.env
echo "gitea-ci-library - Uusi vapaa versio: $FULL_VERSION"
fi
env:
SERVER_URL: ${{ gitea.server_url }}
REPO: ${{ github.repository }}
SHA: ${{ github.sha }}
run: bash .ci/scripts/check-version.sh
- name: Set job outputs
id: set-outputs
+47
View File
@@ -0,0 +1,47 @@
name: CI Git-Pages Main
on:
push:
branches:
- main
- feature/helm-chart
paths:
- git-pages/**
- .gitea/workflows/helm-build-push.yml
- .gitea/workflows/git-pages.*
workflow_dispatch:
jobs:
load-config:
name: Load git-pages.gitea-env.conf to pipeline env
uses: niko/gitea-ci-library/.gitea/workflows/config-provider.yml@main
secrets: inherit
with:
config_path: .gitea/workflows/git-pages.gitea-env.conf
check-version:
name: Check existing artifact
needs: [load-config]
uses: niko/gitea-ci-library/.gitea/workflows/check-version.yml@main
secrets: inherit
with:
env_json: ${{ needs.load-config.outputs.env_json }}
helm-push:
name: Build & Push Helm chart
needs: [load-config, check-version]
if: needs.check-version.outputs.artifact_exists != 'true'
uses: niko/gitea-ci-library/.gitea/workflows/helm-build-push.yml@main
secrets: inherit
with:
env_json: ${{ needs.load-config.outputs.env_json }}
version: ${{ needs.check-version.outputs.version }}
chart_path: git-pages
report-summary:
name: Report Summary
needs: [load-config, helm-push]
if: always()
uses: niko/gitea-ci-library/.gitea/workflows/report-summary.yml@main
with:
env_json: ${{ needs.load-config.outputs.env_json }}
suites: ""
@@ -0,0 +1,5 @@
GITEA_API_URL=https://gitea.app.keskikuja.site
HELM_REGISTRY=gitea.app.keskikuja.site/niko
HELM_UI_URL=https://gitea.app.keskikuja.site/niko/-/packages/container
GIT_TAG_PREFIX=git-pages/
VERSION_FILE=git-pages/Chart.yaml
+97
View File
@@ -0,0 +1,97 @@
name: Helm Build & Push
on:
workflow_call:
inputs:
env_json:
required: true
type: string
version:
required: true
type: string
chart_path:
required: false
type: string
default: '.'
secrets:
GITEA_TOKEN:
required: true
HELM_USER:
required: false
HELM_PASSWORD:
required: true
env:
GITEA_API_URL: ${{ fromJson(inputs.env_json).GITEA_API_URL }}
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
HELM_REGISTRY: ${{ fromJson(inputs.env_json).HELM_REGISTRY || '' }}
HELM_UI_URL: ${{ fromJson(inputs.env_json).HELM_UI_URL || '' }}
GIT_TAG_PREFIX: ${{ fromJson(inputs.env_json).GIT_TAG_PREFIX || '' }}
CHART_PATH: ${{ inputs.chart_path }}
VERSION: ${{ inputs.version }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-push:
runs-on: ubuntu-latest
container:
image: alpine/helm:3.19.0
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: niko/gitea-ci-library
path: .ci
- name: Package Helm chart
run: |
helm package "${CHART_PATH}" \
--version "${VERSION}" \
--app-version "${VERSION}" \
--destination /tmp/helm-packages
- name: Push to OCI registry
env:
HELM_USER: ${{ secrets.HELM_USER || github.actor }}
HELM_PASSWORD: ${{ secrets.HELM_PASSWORD }}
run: |
REGISTRY="${HELM_REGISTRY:?HELM_REGISTRY not set in env.conf}"
echo "$HELM_PASSWORD" | helm registry login "${REGISTRY}" \
-u "$HELM_USER" \
--password-stdin
helm push /tmp/helm-packages/*.tgz "oci://${REGISTRY}"
helm registry logout "${REGISTRY}"
- name: Report status with UI link
if: success() && env.HELM_UI_URL != ''
run: |
CHART_NAME=$(grep '^name:' "${CHART_PATH}/Chart.yaml" | awk '{print $2}')
UI_URL="${HELM_UI_URL}/${CHART_NAME}/${VERSION}"
bash .ci/scripts/report-status.sh success "Helm chart ${VERSION}" ci-helm-build-push "" "$UI_URL"
tag-commit:
runs-on: ubuntu-latest
needs: [build-push]
steps:
- uses: actions/checkout@v4
- name: Create git tag
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
SERVER_URL: ${{ gitea.server_url }}
RUN_NUMBER: ${{ github.run_number }}
SHA: ${{ github.sha }}
run: |
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" -X POST \
"$SERVER_URL/api/v1/repos/${{ github.repository }}/tags" \
-H "Authorization: token $GITEA_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"tag_name\": \"${GIT_TAG_PREFIX}${VERSION}\", \"message\": \"Build #$RUN_NUMBER\", \"target\": \"$SHA\"}")
if [ "$HTTP_CODE" = "201" ] || [ "$HTTP_CODE" = "409" ]; then
exit 0
else
exit 1
fi