manual jobit ci konteille
CI Feature / Load example-gitea-env.conf to pipeline env (push) Successful in 19s
Hello World (Manual) / greet (push) Successful in 5s
unit-tests Link to Bats reports
CI Feature / Bats tests (push) Successful in 1m49s
acc-tests Link to Cucumber reports
CI Feature / Report Summary (push) Has been cancelled
CI Feature / Cucumber tests (push) Has been cancelled
CI Feature / Load example-gitea-env.conf to pipeline env (push) Successful in 19s
Hello World (Manual) / greet (push) Successful in 5s
unit-tests Link to Bats reports
CI Feature / Bats tests (push) Successful in 1m49s
acc-tests Link to Cucumber reports
CI Feature / Report Summary (push) Has been cancelled
CI Feature / Cucumber tests (push) Has been cancelled
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
@@ -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
|
||||
|
||||
@@ -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
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user