Compare commits

...

2 Commits

Author SHA1 Message Date
niko 8622b6fc4e Feature/ci container (#15)
CI Main / Load example-gitea-env.conf to pipeline env (push) Successful in 19s
CI Main / Check existing artifact (push) Successful in 14s
unit-tests Link to Bats reports
CI Main / Bats tests (push) Successful in 1m43s
acc-tests Link to Cucumber reports
CI Main / Cucumber tests (push) Successful in 1m9s
ci-docker-build-push Docker build & push 0.2.4 OK
CI Main / Build & Push Docker (push) Successful in 37s
CI Main / Report Summary (push) Successful in 5s
CI Main / Move provider version tag (push) Successful in 13s
Co-authored-by: moilanik <niko.moilanen@tietoevry.com>
Reviewed-on: #15
2026-06-16 09:13:36 +03:00
niko dd9ad9e2c8 Feature/ci container (#14)
ci-docker-build-push Docker build & push 0.2.3 OK
CI Main / Build & Push Docker (push) Successful in 36s
CI Main / Report Summary (push) Successful in 5s
CI Main / Move provider version tag (push) Successful in 12s
CI Main / Load example-gitea-env.conf to pipeline env (push) Successful in 21s
CI Main / Check existing artifact (push) Successful in 14s
unit-tests Link to Bats reports
CI Main / Bats tests (push) Successful in 1m46s
acc-tests Link to Cucumber reports
CI Main / Cucumber tests (push) Successful in 1m12s
Co-authored-by: moilanik <niko.moilanen@tietoevry.com>
Reviewed-on: #14
2026-06-16 07:16:47 +03:00
12 changed files with 125 additions and 6 deletions
@@ -0,0 +1,57 @@
name: CI Container Build & Push
on:
workflow_call:
inputs:
env_json:
required: true
type: string
dockerfile_path:
required: true
type: string
image_name:
required: true
type: string
tag:
required: true
type: string
secrets:
DOCKER_USERNAME:
required: false
DOCKER_PASSWORD:
required: true
env:
DOCKER_REGISTRY: ${{ fromJson(inputs.env_json).DOCKER_REGISTRY || '' }}
IMAGE_NAME: ${{ inputs.image_name }}
TAG: ${{ inputs.tag }}
DOCKERFILE: ${{ inputs.dockerfile_path }}
jobs:
build-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build and push CI container
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME || github.actor }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
NOW=$(date -u +%Y-%m-%dT%H:%M:%SZ)
docker build \
--label "git.commit=${{ github.sha }}" \
--label "git.commitBy=${{ github.actor }}" \
--label "build.date=${NOW}" \
-f "${DOCKERFILE}" \
-t "${IMAGE_NAME}:${TAG}" .
REGISTRY="${DOCKER_REGISTRY:?DOCKER_REGISTRY not set in env.conf}"
REGISTRY_HOST="${REGISTRY%%/*}"
FULL_IMAGE="${REGISTRY}/${IMAGE_NAME}:${TAG}"
echo "Pushing ${FULL_IMAGE} ..."
docker tag "${IMAGE_NAME}:${TAG}" "$FULL_IMAGE"
echo "$DOCKER_PASSWORD" | docker login "$REGISTRY_HOST" -u "$DOCKER_USERNAME" --password-stdin
docker push "$FULL_IMAGE"
docker logout "$REGISTRY_HOST"
@@ -0,0 +1,21 @@
name: Build CI Bats Container (Manual)
on: workflow_dispatch
jobs:
load-config:
name: Load config
uses: niko/gitea-ci-library/.gitea/workflows/config-provider.yml@main
secrets: inherit
with:
config_path: .gitea/workflows/example-gitea-env.conf
build-push:
name: Build & Push
needs: [load-config]
uses: niko/gitea-ci-library/.gitea/workflows/ci-container-build-push.yml@main
secrets: inherit
with:
env_json: ${{ needs.load-config.outputs.env_json }}
dockerfile_path: Dockerfile.ci-bats
image_name: ci-bats
tag: latest
@@ -0,0 +1,21 @@
name: Build CI Cucumber Container (Manual)
on: workflow_dispatch
jobs:
load-config:
name: Load config
uses: niko/gitea-ci-library/.gitea/workflows/config-provider.yml@main
secrets: inherit
with:
config_path: .gitea/workflows/example-gitea-env.conf
build-push:
name: Build & Push
needs: [load-config]
uses: niko/gitea-ci-library/.gitea/workflows/ci-container-build-push.yml@main
secrets: inherit
with:
env_json: ${{ needs.load-config.outputs.env_json }}
dockerfile_path: Dockerfile.ci-cucumber
image_name: ci-cucumber
tag: latest
+1 -1
View File
@@ -35,7 +35,7 @@ jobs:
name: Report Summary
needs: [load-config, bats, cucumber]
if: always()
uses: niko/gitea-ci-library/.gitea/workflows/example-report-summary.yml@main
uses: niko/gitea-ci-library/.gitea/workflows/report-summary.yml@main
with:
env_json: ${{ needs.load-config.outputs.env_json }}
suites: bats cucumber
+1 -1
View File
@@ -55,7 +55,7 @@ jobs:
name: Report Summary
needs: [load-config, build-push]
if: always()
uses: niko/gitea-ci-library/.gitea/workflows/example-report-summary.yml@main
uses: niko/gitea-ci-library/.gitea/workflows/report-summary.yml@main
with:
env_json: ${{ needs.load-config.outputs.env_json }}
suites: bats cucumber
+11
View File
@@ -0,0 +1,11 @@
name: Hello World (Manual)
on:
workflow_dispatch:
push:
# branches: [ main ] # Tai [ feature/ci-container ]
branches: [feature/ci-container]
jobs:
greet:
runs-on: ubuntu-latest
steps:
- run: echo "Hello"
+3
View File
@@ -0,0 +1,3 @@
FROM bats/bats:latest
RUN apk add --no-cache lsof python3 jq curl ruby && \
gem install bashcov -v 3.3.0
+6
View File
@@ -0,0 +1,6 @@
FROM node:22
RUN apt-get update -qq && \
apt-get install -y -qq --no-install-recommends lsof jq && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
npm install -g @cucumber/cucumber
+2 -2
View File
@@ -34,13 +34,14 @@ kuuluu `git-pages/docs/`-alle, ei juuren `docs/`-kansioon.
| `git-pages/` | Raporttien hostaus (Helm-chartti) |
| `tests/` | Bats-testit skripteille |
### Provider workflowt (3 kpl)
### Provider workflowt (4 kpl)
| Workflow | Input | Output | Kuvaus |
|---|---|---|---|
| `config-provider.yml` | `config_path` | `env_json`, `config_path` | Validoi ja jäsentää `.conf` → JSON. Sama kutsu hoitaa validoinnin. |
| `check-version.yml` | `env_json` | `artifact_exists`, `version` | Tarkistaa git-tagit ja `package.json`:n, laskee seuraavan version. Vain main-haarassa. |
| `docker-build-push.yml` | `env_json`, `version` | — | Buildaa Docker-imagen, puskea rekisteriin, tagittaa commitin. |
| `report-summary.yml` | `env_json`, `suites` | — | Generoi `GITHUB_STEP_SUMMARY`-taulukon raporttilinkeillä (Gitea 1.27+) |
### Example-tiedostot (consumer-referenssi)
@@ -50,7 +51,6 @@ kuuluu `git-pages/docs/`-alle, ei juuren `docs/`-kansioon.
| `example-main.yml` | push [main] | load-config → check-version → bats + cucumber → report-summary → docker-build-push |
| `example-bats-tests.yml` | workflow_call | Unit-testit Batsilla, raportit git-pagesiin, status linkillä |
| `example-cucumber-tests.yml` | workflow_call | Hyväksymätestit Cucumberilla, raportit git-pagesiin, status linkillä |
| `example-report-summary.yml` | workflow_call | `GITHUB_STEP_SUMMARY`-taulukko raporttilinkeillä (Gitea 1.27+) |
| `example-gitea-env.conf` | — | KEY=VALUE config tälle repolle |
## Key Technical Decisions
+1 -1
View File
@@ -33,7 +33,7 @@ Tarkemmin: ADR 0005.
| `example-main.yml` | Consumer | Main-haaran CI: load-config → check-version → bats + cucumber → summary → docker |
| `example-bats-tests.yml` | Consumer | Unit-testit Batsilla |
| `example-cucumber-tests.yml` | Consumer | Hyväksymätestit Cucumberilla |
| `example-report-summary.yml` | Consumer | `GITHUB_STEP_SUMMARY`-taulukko (Gitea 1.27+) |
| `report-summary.yml` | Provider | `GITHUB_STEP_SUMMARY`-taulukko raporttilinkeillä (Gitea 1.27+) |
| `publish-git-pages.sh` | Provider-skripti | PATCH tar git-pagesiin |
| `report-status.sh` | Provider-skripti | POSTaa commit-status (vain custom-linkkiin) |
| `ci-validate.sh` | Provider-skripti | Validoi `.conf`-tiedoston ja tarkistaa secretit |
+1 -1
View File
@@ -108,7 +108,7 @@ raportit git-pagesiin, asettaa commit-statuksen linkillä raporttiin.
Ajaa Cucumber-testit Node-kontissa, julkaisee raportit git-pagesiin, asettaa
commit-statuksen linkillä raporttiin.
### `example-report-summary.yml` — Raporttien koontinäkymä
### `report-summary.yml` — Raporttien koontinäkymä
**Trigger:** `workflow_call` — ajetaan `if: always()` testien jälkeen