Shared CI/CD tooling for Apius Splunk apps: a reusable GitHub Actions workflow plus a small Python module for version stamping and Splunkbase packaging.
.github/workflows/app-ci.yml is a workflow_call workflow every app repo
invokes. It runs ruff (lint + format check), pytest when a tests/
directory is present, and Splunk AppInspect (base checks) against the app
directory.
Caller example (.github/workflows/ci.yml in an app repo):
name: ci
on:
pull_request:
push:
branches: [main]
jobs:
pr-gate:
uses: apius-tech/splunk-app-ci/.github/workflows/app-ci.yml@main
with:
app_id: <the app id == the app directory name>Pin @main for now; repin to a released tag (e.g. @v1) once one is cut.
Inputs:
app_id(required) — the app id, which is also the app's directory name and the AppInspect target.python_version(optional, default3.9) — Python used for the tooling.
splunk_app_ci provides version stamping and Splunkbase packaging, used by the
release workflow.
# build the Splunkbase artifact (stamps app.conf inside the package)
python -m splunk_app_ci package --app-dir <app_id> --version X.Y.Z --dest dist
# stamp version into source files in place (app.conf + pyproject.toml)
python -m splunk_app_ci stamp --version X.Y.Z \
--app-conf <app_id>/default/app.conf --pyproject pyproject.toml
build_package produces <app_id>-<version>.tar.gz whose single top-level
directory is the app id, with app.conf version stamped, vendored lib/
retained, and tooling/VCS artifacts excluded.
Two reusable workflows implement the commit-back release-PR flow (ADR-0004), each with a thin caller in the app repo:
.github/workflows/prepare-release.yml(workflow_call; inputsversion,app_id) — stampsapp.conf [launcher] versionand rootpyproject.toml [project].versiontoversionon arelease/vX.Y.Zbranch and opens a "Release vX.Y.Z" PR. It never writes to main directly; opening the PR runs the normal PR gate..github/workflows/release.yml(workflow_call; inputsapp_id,version,cloud_gatedefaultfalse; secretsSPLUNK_USER/SPLUNK_PASS) — packages the app atversion, runs Splunk AppInspect via the AppInspect API (splunk/appinspect-api-action), and publishes a GitHub Release with the.tar.gzand auto-generated notes. Base (non-cloud) errors/failures block; cloud findings are advisory unlesscloud_gate=true(ADR-0005). Splunkbase upload is a separate slice and is not done here.
- Dispatch the app's
prepare-releasecaller with the target version (X.Y.Z). This opens the "Release vX.Y.Z" PR. - Review and merge the Release PR — main now shows the released version.
- Push the tag
vX.Y.Zon the merged commit (git tag vX.Y.Z && git push origin vX.Y.Z). - The
releaseworkflow runs: package -> AppInspect API -> GitHub Release.
Caller examples (in an app repo):
# .github/workflows/prepare-release.yml
name: prepare-release
on:
workflow_dispatch:
inputs:
version: { description: "X.Y.Z", required: true, type: string }
jobs:
prepare-release:
uses: apius-tech/splunk-app-ci/.github/workflows/prepare-release.yml@main
with:
version: ${{ inputs.version }}
app_id: <app_id># .github/workflows/release.yml
name: release
on:
push:
tags: ["v*"]
jobs:
version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.strip.outputs.version }}
steps:
- id: strip
run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
release:
needs: version
uses: apius-tech/splunk-app-ci/.github/workflows/release.yml@main
with:
app_id: <app_id>
version: ${{ needs.version.outputs.version }}
secrets: inheritThe prepare-release job needs the repo setting "Allow GitHub Actions to
create and approve pull requests" enabled so it can open the Release PR.
uv run --with pytest pytest -q
ruff check .
ruff format --check .