Skip to content

Optional build step for UCC apps (build_command, package_dir) - #7

Merged
pbujna-apius merged 1 commit into
mainfrom
feat/optional-build-step
Sep 24, 2026
Merged

pbujna-apius merged 1 commit into
mainfrom
feat/optional-build-step

Conversation

@pbujna-apius

Copy link
Copy Markdown
Contributor

What

Adds two optional inputs to app-ci.yml and release.yml so an app can generate its Splunk app before packaging (the first user is the UCC-based SAP add-on, apius_ta_sap_cloud, per its ADR-0001).

Input Default Meaning
build_command "" (no build) Shell script (bash -eo pipefail) run from the repo root before packaging. Env: APP_ID, APP_VERSION (0.0.0 in the PR gate, the resolved release version in release.yml).
package_dir "" (= <app_id>) Directory to package and inspect, e.g. output/<app_id>.

A new Resolve package directory step runs before packaging. It fails with a ::error:: unless the directory's last path component equals app_id, which is the ADR-0003 invariant that the tarball's single top-level dir is the app id, and unless it contains default/app.conf.

Existing callers are unaffected

  • Build app has if: inputs.build_command != '', so it is skipped when the input is unset.
  • Resolve package directory falls back to <app_id>, so package --app-dir gets the same value as before. The basename check always passes for the fallback. The only visible change is that a missing <app_id>/default/app.conf now fails one step earlier, with a clearer message (it failed before too).
  • No change to resolve, the AppInspect steps, the release/tag logic, the Splunkbase job, prepare-release.yml or the Python module.

Version source of truth

This is unchanged. prepare-release stamps <app_id>/default/app.conf, and release reads the version back from that source file. It never reads it from the build output. UCC apps use <app_id>/ as ucc-gen build --source (not UCC's default package/) and keep globalConfig.json at the repo root, because UCC looks for it in the parent of --source. package still re-stamps [launcher] version inside the tarball.

Verified locally (UCC 6.6.0, Python 3.9)

Minimal UCC app: an account tab with an encrypted: true field, one input, and a source default/app.conf. Steps run:

  • stamp 4.1.0 → current-version → ucc-gen build --source apius_ta_sap_cloud --ta-version "$APP_VERSION" → resolve step → python -m splunk_app_ci package --app-dir output/apius_ta_sap_cloud.
  • The resulting tarball has a single top-level dir apius_ta_sap_cloud. Its app.conf has [launcher] version = 4.1.0, and app.manifest has 4.1.0.
  • The resolve step passes in the default case and in the UCC case. It fails clearly for package_dir: output and for a missing build output.
  • AppInspect CLI 4.3.1 on the package, base (--excluded-tags manual) and cloud: 0 errors, 0 failures. It reported 2 future_failures, both python.required missing on the UCC-generated modinput and restmap stanzas, and warnings only.
  • actionlint is clean. ruff check, ruff format --check and pytest -q pass (there are no Python changes).

UCC gotchas (all written up in the README):

  • The flag is --ta-version. --ver gets prefix-matched to --verbose, so the build breaks.
  • Without --ta-version, UCC sets the version from git (0.0.0+<sha>) and ignores the source app.conf.
  • Output goes to output/<meta.name>/.
  • The source app.conf is merged, but [launcher] author is dropped if it conflicts with app.manifest.
  • The build rewrites meta.version and schemaVersion in the source globalConfig.json.

Not verified

  • A real Actions run: the SAP add-on repo has no commits yet.
  • The AppInspect API (release-time) vetting.

The tooling checkout inside the workflows still uses ref: main, which is fine because this PR changes no Python.

🤖 Generated with Claude Code

app-ci.yml and release.yml gain two optional inputs. build_command runs
before packaging with APP_ID and APP_VERSION (0.0.0 in the PR gate, the
resolved release version in release) in its environment; package_dir
selects the directory to package, e.g. output/<app_id> for ucc-gen.

A new "Resolve package directory" step defaults to <app_id>, and fails
clearly unless the directory is named after the app id (ADR-0003
tarball invariant) and contains default/app.conf. Callers that set
neither input keep the previous behaviour: the build step is skipped and
<app_id>/ is packaged.

The version source of truth is unchanged: release still reads
<app_id>/default/app.conf, which prepare-release stamps; UCC apps use
that directory as ucc-gen --source. README documents the inputs, the
layout and UCC 6.6.0 gotchas verified locally.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@pbujna-apius
pbujna-apius requested a review from a team as a code owner September 24, 2026 12:40
@pbujna-apius
pbujna-apius merged commit 2f29925 into main Sep 24, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant