feat: refactor config flow and directory structure
- Create config-provider.yml (reusable workflow, conf→JSON) - Replace duplicated job env blocks with workflow env + fromJson - Move provider workflows to workflows/ directory - Move consumer scripts to .gitea/scripts/ - Move feature-env.conf to .gitea/workflows/ - Add bats-report.sh for TAP→HTML conversion - Update ci.yml with setup→needs→with pattern - Add ADR 0006 directory ownership - Document cross-job config propagation in ci-pipeline-practices.md - Remove config.yaml, scripts/load-config.sh unused
This commit is contained in:
@@ -45,15 +45,7 @@ jobs:
|
||||
> "reports/${GITHUB_SHA:0:8}/bats/results.txt" 2>&1
|
||||
BATS_EXIT=$?
|
||||
docker volume rm bats-workspace > /dev/null 2>&1
|
||||
{
|
||||
echo "<html><body><h1>Bats tests</h1><ul>"
|
||||
for f in reports/${GITHUB_SHA:0:8}/bats/*; do
|
||||
b="$(basename $f)"
|
||||
[ "$b" = "index.html" ] && continue
|
||||
echo "<li><a href=\"$b\">$b</a></li>"
|
||||
done
|
||||
echo "</ul></body></html>"
|
||||
} > "reports/${GITHUB_SHA:0:8}/bats/index.html"
|
||||
bash .ci/.gitea/scripts/bats-report.sh "reports/${GITHUB_SHA:0:8}/bats"
|
||||
echo "BATS_EXIT=${BATS_EXIT}" >> "${GITHUB_ENV}"
|
||||
exit ${BATS_EXIT}
|
||||
|
||||
@@ -137,7 +129,7 @@ jobs:
|
||||
if [ "${TOOL_OK}" != "true" ]; then
|
||||
STATUS="failure"
|
||||
DESC="Cucumber tool unavailable"
|
||||
URL="https://gitea.app.keskikuja.site/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
|
||||
URL="${GITEA_API_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
|
||||
elif [ "${CUCUMBER_EXIT}" = "0" ]; then
|
||||
STATUS="success"
|
||||
DESC="Cucumber tests passed"
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
name: CI Engine
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
config-file:
|
||||
required: true
|
||||
type: string
|
||||
secrets:
|
||||
GITEA_TOKEN:
|
||||
required: true
|
||||
GIT_PAGES_PUBLISH_TOKEN:
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GITEA_API_URL: https://gitea.app.keskikuja.site
|
||||
PAGES_HOST: ci-reports.helm-dev.keskikuja.site
|
||||
GIT_PAGES_PUBLISH_URL: https://ci-reports.helm-dev.keskikuja.site
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
GIT_PAGES_PUBLISH_TOKEN: ${{ secrets.GIT_PAGES_PUBLISH_TOKEN }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Publish reports
|
||||
run: bash scripts/publish.sh reports
|
||||
@@ -6,9 +6,9 @@ on:
|
||||
|
||||
jobs:
|
||||
load-config:
|
||||
uses: niko/gitea-ci-library/.gitea/workflows/config-provider.yml@feature/pipeline-cleanup
|
||||
uses: niko/gitea-ci-library/workflows/config-provider.yml@feature/pipeline-cleanup
|
||||
with:
|
||||
config_path: feature-env.conf
|
||||
config_path: .gitea/workflows/feature-env.conf
|
||||
|
||||
feature:
|
||||
if: github.ref != 'refs/heads/main'
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
name: Config Provider Library
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
config_path:
|
||||
required: true
|
||||
type: string
|
||||
outputs:
|
||||
env_json:
|
||||
value: ${{ jobs.parse-config.outputs.json_data }}
|
||||
|
||||
jobs:
|
||||
parse-config:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
json_data: ${{ steps.convert.outputs.JSON_OUT }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- id: convert
|
||||
run: |
|
||||
JSON_STRING=$(jq -R -s '
|
||||
split("\n")
|
||||
| map(select(length > 0 and (startswith("#") | not)))
|
||||
| map(split("="))
|
||||
| map({(.[0]): .[1]})
|
||||
| add
|
||||
' "${{ inputs.config_path }}")
|
||||
|
||||
CLEAN_JSON=$(echo "$JSON_STRING" | jq -c .)
|
||||
echo "JSON_OUT=$CLEAN_JSON" >> "$GITHUB_OUTPUT"
|
||||
@@ -0,0 +1,3 @@
|
||||
GITEA_API_URL=https://gitea.app.keskikuja.site
|
||||
PAGES_HOST=ci-reports.helm-dev.keskikuja.site
|
||||
GIT_PAGES_PUBLISH_URL=https://ci-reports.helm-dev.keskikuja.site
|
||||
Reference in New Issue
Block a user