323 lines
20 KiB
Markdown
323 lines
20 KiB
Markdown
# Configuration
|
|
|
|
ReleaseKit reads a JSON profile from `<repository-root>/releasekit.json` by default.
|
|
The repository argument defaults to the current directory; the CLI resolves its
|
|
containing Git checkout root. A relative profile path is resolved from that root;
|
|
an absolute path is used as-is.
|
|
|
|
The current profile fields are:
|
|
|
|
| Field | Required | Behavior |
|
|
| --- | --- | --- |
|
|
| `product` | Yes | Product name used by release operations. |
|
|
| `module_dir` | No | Repository-relative physical directory; in the legacy model it selects a Go module and defaults to `.`. |
|
|
| `source` | No | Explicit source selection with optional `dir` and `tag_prefix`. |
|
|
| `go` | No | A non-null object selects Go capability in the explicit model. |
|
|
| `publication` | No | Explicit publication `mode`: `source` or `go-module`. |
|
|
| `version` | No | Explicit identifier `format` and `prefix`. |
|
|
| `remote` | No | Selected Git remote; defaults to `origin`. |
|
|
| `expected_push_url` | No | Exact effective push URL required by `publish`; ignored by local `check`. |
|
|
| `checks` | No | Ordered additional child commands, each with an argument vector and optional environment map. |
|
|
| `validation` | No | Optional shared checks selected by ReleaseKit. |
|
|
| `build` | No | Optional main package, binary name, and selected `GOOS/GOARCH` target strings. |
|
|
| `delivery` | No | Optional selected forge and destination fields for tagged-source delivery. |
|
|
| `readiness` | No | Optional explicit files to check during readiness. |
|
|
| `rehearsal` | No | Diagnostic selector and Woodpecker observation settings, required for a rehearsal. |
|
|
|
|
When Go is selected, `module_dir` names the module's physical location;
|
|
ReleaseKit reads its declared import path from that module's own `go.mod`. The
|
|
physical directory and declared path are distinct: a declared `/v2` module can
|
|
live either at `integrations/core` or `integrations/core/v2`, while both use the
|
|
same full release tag. Root-only profiles can omit `module_dir` and do not need
|
|
a module map.
|
|
|
|
When all four selection objects are absent or null, the legacy selection uses
|
|
Go module publication and prefixed stable semantic versions. Any non-null
|
|
selection object chooses the explicit model: `source.dir` defaults to `.` or
|
|
the supplied `module_dir`, `go` defaults to disabled, and `publication.mode`
|
|
defaults to `source`. If both directory fields are supplied they must resolve
|
|
to the same physical directory. Go module publication requires `go: {}`.
|
|
`version.format` defaults to `semver` and also accepts `date` and `year-month`;
|
|
`version.prefix` accepts `v` or an empty string, defaulting to `v` for SemVer
|
|
and empty for calendar formats. `source.tag_prefix` overrides the physical
|
|
source directory used as the source-tag prefix; an explicit empty string
|
|
selects an unprefixed tag. Go module publication requires prefixed SemVer and
|
|
rejects tag-prefix overrides that conflict with Go's module tag rules. The Go
|
|
facade's `Check`, `Publish`, `Build`, and `Deliver` and the CLI candidate and
|
|
delivery commands use the selected format. See the [command reference](cli.md)
|
|
for invocation details.
|
|
|
|
After its selected prefix, `semver` accepts stable `MAJOR.MINOR.PATCH` with
|
|
no leading zeroes in numeric components. `date` accepts `YYYY-MM-DD` or
|
|
`YYYY-MM-DD.R` with a valid Gregorian date and positive, unpadded revision;
|
|
the first release has no suffix. `year-month` accepts `YYYY.MM.R`, with a
|
|
two-digit month and a required nonnegative, unpadded revision. Years range
|
|
from 0001 through 9999. ReleaseKit preserves the selected identifier spelling.
|
|
|
|
Each check requires a nonempty `args` array whose first element names the
|
|
executable. Arguments are passed directly to the child process; ReleaseKit does
|
|
not parse a shell command string. Select a shell explicitly when a check needs
|
|
shell syntax. Each `env` map overlays the current environment for that child.
|
|
The overlay does not modify the ReleaseKit process environment.
|
|
|
|
Unknown fields are rejected so a setting cannot be silently ignored. The
|
|
`build` object contains `main_package`, `binary_name`, and `targets`. A selected
|
|
target requires the package and binary name; each target is written as one
|
|
`GOOS/GOARCH` pair. An omitted or empty target list means no binary work.
|
|
|
|
The optional `validation` object selects shared checks implemented by ReleaseKit.
|
|
`validation.shared_files` is a committed file list resolved from the repository
|
|
root. Omission or `null` uses `COPYRIGHT`, `LICENSE`, and
|
|
`docs/oss/attribution.md` when present for enabled file checks; `[]` selects no
|
|
shared files. An explicit list replaces those defaults. Each explicit file must
|
|
exist in the candidate, even when no file checks are enabled. Paths are literal,
|
|
repository-relative files with no glob semantics and may select a file outside
|
|
the chosen module. ReleaseKit deduplicates them with module inputs by path. This
|
|
field does not enable any checks or expand Go test, vet, or package-compilation
|
|
scope. For Go selections, automatic file inputs stop at independent
|
|
nested-module boundaries; source-only selections treat nested `go.mod` files
|
|
as data. Vendored files remain included. Reference inspection can read
|
|
destinations elsewhere in the captured repository without adding them to those
|
|
inputs.
|
|
`validation.go.race` enables the race detector for the single standard Go test
|
|
suite. `validation.go.full_vet` runs a separate native `go vet` pass after that
|
|
suite succeeds; ReleaseKit disables test-time vet for that suite to avoid
|
|
running vet twice. `validation.go.compile_targets` is an ordered array of
|
|
`GOOS/GOARCH` pairs. After tests and selected full vet pass, ReleaseKit compiles
|
|
all packages for each target with cgo disabled. Each pair must include both
|
|
components; the selected Go toolchain reports unsupported complete targets.
|
|
This source compatibility check does not name or produce binaries, run a target
|
|
executable, or create an artifact manifest. Omitted or empty `compile_targets`
|
|
selects no package-compilation pass. When `full_vet` is omitted or false, the
|
|
test command keeps its existing vet behavior. These settings are independent.
|
|
For source-only selections, Go execution checks and nonempty build targets are
|
|
configuration errors; explicitly selected file checks remain available.
|
|
`validation.go_format` checks regular committed Go blobs with the Go formatter
|
|
used to build ReleaseKit. It uses the selected file inputs, including vendor and
|
|
explicit shared files, and ignores
|
|
symlink blobs and the worktree, and reports every selected path whose bytes
|
|
change under formatting. It never writes formatted bytes back. Omitted or false
|
|
disables the check. It runs after tests, selected full vet, and selected package
|
|
compilation, before configured product checks.
|
|
|
|
When `validation.markdown` is an object, ReleaseKit checks local destinations
|
|
and supported heading fragments in committed regular Markdown files. Omission
|
|
or `null` disables the check; `{}` enables it. Schemed and protocol-relative
|
|
links are skipped, URI query components do not affect path checks, and other
|
|
existing files or directories receive existence checks only. Missing local
|
|
destinations, symlink cycles, and missing Markdown headings fail with the
|
|
`markdown-links` identity. Outside-checkout destinations are reported as out
|
|
of scope by default. Set
|
|
`validation.markdown.enforce_checkout_boundary` to `true` to fail those links;
|
|
submodule contents remain out of scope under either setting.
|
|
|
|
The parser recognizes inline links, images, reference links, and CommonMark
|
|
autolinks; link-like text in code is ignored, and raw HTML destinations are
|
|
outside this check. For linked images, the image source and enclosing link
|
|
target are checked. Image labels supply alternative text.
|
|
Relative paths resolve from the source document in the
|
|
captured commit. Query components are ignored for file existence, and percent
|
|
escapes in local paths and fragments are decoded once. Fragments are compared
|
|
in lowercase with anchors derived from visible ATX or Setext heading text.
|
|
Anchors keep Unicode letters and numbers, underscores, and hyphens; spaces
|
|
become hyphens, and repeated headings receive numeric suffixes.
|
|
|
|
When `validation.module_distribution.workspace_files` is true, it reports
|
|
committed `go.work` and `go.work.sum` files in the selected module inputs,
|
|
including nested paths and symlinks. It checks the captured candidate regardless
|
|
of `GOWORK`; it does not select or change the workspace used by Go commands,
|
|
and vendored contents remain in scope. Omitted or false disables it. When
|
|
`validation.module_distribution.local_replacements` is true, it parses the
|
|
selected module's committed `go.mod` declarations. Vendored contents remain in
|
|
scope; an explicit shared-file selection can include an individual declaration
|
|
from another module. It reports
|
|
`replace` directives whose replacement has no version. These filesystem
|
|
replacements include relative and absolute paths; versioned module replacements
|
|
are permitted. Committed `go.mod` symlinks are resolved within the candidate,
|
|
and unavailable selected contents or parse failures are reported as inspection
|
|
errors. This selection is independent of `workspace_files` and Go's `GOWORK`
|
|
setting. Omitted or false disables it.
|
|
For example:
|
|
|
|
```json
|
|
{
|
|
"product": "Example",
|
|
"validation": {
|
|
"go": {
|
|
"race": true,
|
|
"full_vet": true,
|
|
"compile_targets": ["linux/amd64", "linux/arm64"]
|
|
},
|
|
"go_format": true,
|
|
"markdown": {},
|
|
"module_distribution": {
|
|
"workspace_files": true,
|
|
"local_replacements": true
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
When `validation.file_size` is an object, ReleaseKit compares each committed
|
|
blob's size with `limit_bytes`. The limit uses decimal bytes and rejects only
|
|
sizes strictly greater than the limit. An omitted or null object disables the
|
|
check; `{}` enables it with a default of 1,000,000 bytes. A missing or null
|
|
`limit_bytes` selects that default, zero is a valid limit, and negative limits
|
|
are invalid.
|
|
|
|
`validation.file_size.exclusions` contains literal paths relative to the
|
|
selected module. Directory exclusions include committed descendants, using path
|
|
boundaries (`assets` does not exclude `assets-old`). Ordinary relative path
|
|
normalization applies; metacharacters are literal and unmatched paths have no
|
|
effect. The check measures regular and symlink blobs, including small binaries;
|
|
symlink size is the committed link text. Gitlinks have no measured size. Only
|
|
the captured candidate is checked, one offending file is reported at a time,
|
|
and historical or aggregate repository size is not measured.
|
|
|
|
`validation.forbidden_files` is an optional list of literal repository-relative
|
|
file paths that must be absent from the captured commit. It runs after the Go
|
|
checks and before other file checks, using the `forbidden-files` identity and
|
|
reporting selected committed paths. Omission, `null`, or `[]` disables it.
|
|
Paths use slash separators and ordinary relative normalization and must stay
|
|
within the repository. They are checked against the whole captured repository,
|
|
independently of the selected module and `shared_files`. The check reads path
|
|
metadata only; it does not read token contents, follow symlink targets, require
|
|
local files to exist, or inspect Git history. Existing clean-index/worktree
|
|
requirements still apply to candidate operations. An ignore rule alone does
|
|
not remove a previously committed file from the candidate.
|
|
|
|
`readiness.required_files` optionally lists literal repository-root-relative or
|
|
absolute files whose readability `validate` checks. These are explicit local
|
|
inputs, not inferred SSH authentication requirements; see the
|
|
[readiness guide](consumers/readiness.md).
|
|
|
|
A `rehearsal` object can select a dispatch `selector` (default `root`) and a
|
|
`woodpecker` object with `base_url`, numeric `repository_id`, exact `workflow`
|
|
and `step` names, and a local `token_file`. These settings are required only
|
|
for rehearsal operations. Relative token paths resolve from the checkout root;
|
|
the file is read separately from the forge credential and its token is never
|
|
stored in the attempt record. See the
|
|
[rehearsal record format](integrations/rehearsal-records.md) for captured
|
|
identity and recovery evidence.
|
|
|
|
The `delivery` object contains `forge`, `base_url`, `owner`, `repository`, and
|
|
context-specific `credentials`. A delivery request must set `forge` to
|
|
`"gitea"`; a missing or unsupported selection is an error for delivery. These
|
|
requirements do not apply to `check`, `publish`, or `build`.
|
|
|
|
`delivery.credentials.local.token_file` selects the local delivery token file.
|
|
Relative paths resolve from the Git repository root; absolute paths are used as
|
|
supplied. `delivery.credentials.ci.token_environment_variable` selects the job
|
|
environment variable, defaulting to `RELEASEKIT_DELIVERY_TOKEN` when the `ci`
|
|
object is present without a name. `deliver` requires local credentials and
|
|
`ci-deliver` requires CI credentials. Neither context falls back to the other.
|
|
Missing, unreadable, or blank selected credentials fail with status 2. Token
|
|
contents are trimmed. The obsolete `delivery.token_file` and `delivery.token_env`
|
|
fields must be moved to their corresponding context-specific locations.
|
|
|
|
Ignore the local token file in Git. Optionally select the same path in
|
|
`validation.forbidden_files` to reject candidates that include it; an ignore
|
|
rule does not remove an already tracked file.
|
|
|
|
After resolving the token, delivery performs an authenticated, read-only
|
|
repository access check. Invalid destination settings, missing or rejected
|
|
credentials, known insufficient permissions, and inaccessible destinations are
|
|
configuration/credential failures. An unavailable service or canceled check is
|
|
an operational failure.
|
|
See the [CLI contract](cli.md) for exact exit statuses. Successful preflight
|
|
confirms authentication and repository access and accounts for any exposed
|
|
delivery-permission deficiency. It does not guarantee later release or asset
|
|
writes. Local artifact size and digest checks follow preflight and still finish
|
|
before hosted writes.
|
|
|
|
`validate` loads only credentials for selected operations. `test` and recovery
|
|
commands load their selected local credentials; `check`, `publish`, and `build`
|
|
do not read a delivery token. The CLI passes the
|
|
resolved value explicitly to the library operation. `ci-deliver` checks the
|
|
destination before downloading application dependencies for a binary build;
|
|
the later delivery performs a fresh check. Page-only CI relies on delivery's
|
|
automatic check. Selecting a token file and selecting the optional
|
|
forbidden-file validator are independent settings.
|
|
|
|
`expected_push_url`, when nonempty, is compared exactly with Git's resolved
|
|
effective push URL during `publish`, before candidate validation. It applies
|
|
to the push destination when fetch and push URLs differ, and Git URL rewrites
|
|
such as `insteadOf` are resolved before comparison. A mismatch fails preflight;
|
|
omitting the field keeps the selected remote's existing behavior. `check` is
|
|
local-only and ignores this publication expectation.
|
|
|
|
When Go capability is selected, `check` and `publish` run one
|
|
`go test -mod=readonly -count=1 ./...` suite with Go module and toolchain network
|
|
access disabled, adding `-race` when `validation.go.race` is true. When
|
|
`validation.go.full_vet` is true, they add `-vet=off` to that test command and
|
|
run native `go vet -mod=readonly ./...` after successful tests. They then run
|
|
`go build -mod=readonly -o <os.DevNull> ./...` in static mode for each
|
|
`validation.go.compile_targets` entry, in profile order. Compile failures use
|
|
the `package-compile` identity and include the selected target.
|
|
|
|
File checks apply to either source kind. When selected, `validation.go_format`
|
|
checks regular committed Go source with go/format after any Go execution checks; unformatted paths use the `go-format` identity. When
|
|
`validation.module_distribution.workspace_files` is true, shared validation
|
|
also reports committed go.work and go.work.sum blobs after Go formatting, using
|
|
the workspace-files identity. Uncommitted workspace files are not inspected.
|
|
When `validation.module_distribution.local_replacements` is true, shared
|
|
validation parses committed `go.mod` files after workspace inspection and reports
|
|
filesystem replacements as `local-replacements`, with path, directive line, and
|
|
target. Versioned replacements are permitted; parse and inspection failures
|
|
preserve their causes.
|
|
When `validation.file_size` is selected, shared validation checks committed
|
|
blob sizes after module-distribution checks and reports the first oversized
|
|
path with the `file-size` identity and measured and limit byte counts.
|
|
When `validation.markdown` is selected, Markdown checking follows file-size
|
|
inspection and runs before configured product checks. Out-of-scope observations
|
|
are written to the command's standard error and do not fail validation unless
|
|
the checkout boundary is enforced. Submodule observations remain nonfailures.
|
|
Configured `checks` commands run afterward, once each in order, as additional
|
|
product checks. Artifact builds selected by the separate `build` setting run
|
|
after shared validation and product checks.
|
|
|
|
Do not repeat the standard suite or vet in `checks`; doing so repeats work. The
|
|
`build` command uses the selected build settings and writes binaries to `dist` unless
|
|
`--output` selects another path.
|
|
The `deliver` command uses the delivery destination and token. By default it
|
|
passes selected targets to the delivery facade, which builds tagged-source
|
|
artifacts into temporary storage and removes them when delivery returns. An
|
|
absent build object or an empty target set selects page-only delivery. Use
|
|
`build --output DIR` followed by `deliver --assets DIR` when artifacts must be
|
|
retained for retries or when build and delivery credentials need separate
|
|
invocations. Ordinary `deliver` does not download application dependencies or
|
|
change the checkout.
|
|
|
|
`ci-deliver` takes a full Git `TAG`. A production tag ends in the identifier
|
|
accepted by the profile's selected version format, and the complete value is
|
|
checked against its derived tag. Diagnostic tags use their separate
|
|
[rehearsal identity and manifest](integrations/rehearsal-records.md). By default
|
|
it fetches the selected tag, confirms its peeled commit
|
|
matches the provider-supplied commit ID, checks it out detached, and verifies
|
|
the tag, HEAD, and clean worktree. With `--prepared`, it performs the same
|
|
checks against an existing checkout without fetching or checking out. It then
|
|
loads the profile from that source and validates delivery settings and
|
|
credentials. An optional `--expected-module` checks a launcher's module
|
|
selection against the profile. It runs `go mod download` only when the profile
|
|
has selected build targets; source-only delivery does not need application
|
|
dependencies. Default preparation may access the network and may update
|
|
`go.sum`. For binary tagged delivery, prepare and commit that module's sums
|
|
before tagging so dependency preparation leaves the tagged checkout clean. The
|
|
command takes CI values as arguments, so profile settings remain independent of
|
|
Woodpecker environment variable names. See the
|
|
[CLI contract](cli.md) for the invocation and exit statuses.
|
|
|
|
This application dependency preparation is separate from bootstrapping the
|
|
ReleaseKit executable. The maintained module-based tag workflow verifies the
|
|
tag first, then uses temporary copies of that tag's module files to build the
|
|
ReleaseKit version selected by the consumer's `go.mod`. The
|
|
[delivery guide](consumers/delivery.md#woodpecker-tag-workflows) describes that
|
|
bootstrap, the self-bootstrapped source workflow, and the separately installed
|
|
tool option.
|
|
|
|
ReleaseKit's source-only profile is
|
|
[releasekit.json](../releasekit.json).
|
|
See the [source-only profile](../examples/releasekit.json) and
|
|
[binary profile](../examples/releasekit-binary.json). The
|
|
[CLI contract](cli.md) lists the currently available command.
|