Skip to content

[Superseded by #31] refactor: internal cleanups after the parameter-surface restructure#30

Closed
jcardozo-eth wants to merge 12 commits into
feat/runner-account-custom-groupfrom
refactor/post-restructure-followups
Closed

[Superseded by #31] refactor: internal cleanups after the parameter-surface restructure#30
jcardozo-eth wants to merge 12 commits into
feat/runner-account-custom-groupfrom
refactor/post-restructure-followups

Conversation

@jcardozo-eth

Copy link
Copy Markdown
Member

Changes

A set of behavior-neutral internal cleanups, one concern per commit, on top of the runner_account.group work.

Repeated literals become shared derivations, each computed once and consumed by the concerns that need it: the manager service unit name, the systemd user unit directory (now built bottom-up, child from parent, instead of walking back up with dirname()), the Puppetfile path (derived beside the other apply paths), and the runner account identity — name and home hoisted beside group so the private classes read locals instead of re-subscripting runner_account per file. The apt-source sub-struct becomes a named type alias in place of two identical inline copies.

Documentation is brought in line with the code: the @option doc types match the enforced structs (runner_service.environment's newline-rejecting pattern, standalone.self_update's subkey contract, and packages.sources' apt-source shape), the control_repository_path option records the Puppetfile, the socket escape-hatch and selector-totality comments are scoped to what they actually cover, and the healthcheck template records the packaged unit its manager-service check asserts.

Test-only changes: struct_param now merges through the deep_merge gem that Hiera's deep strategy is built on, so a resource-style override unions arrays and honors the -- knockout prefix the way a Hiera consumer's partial hash would; and the rendered_config and runner_account-uid setup helpers are deduplicated.

Verification

  • Behavior-neutral, demonstrated: the defaults-shape and everything-on-shape catalogs compile byte-identical before and after this change (resource lists and rendered file contents diff empty), and the golden files are unchanged.
  • Full gate green on every commit: 116 rspec examples, puppet-lint, metadata-json-lint, yamllint, and the REFERENCE.md docs check.

The socket-derivation comment claimed an "exotic external socket is
expressible via runner_service.environment", which overstates the reach.
That environment only sets the manager service drop-in's DOCKER_HOST; the
socket_mount volume and the healthcheck probe keep using the uid-derived
path. Reword to state the escape hatch narrowly so it is not read as a
general external-daemon switch.
Add a non-rendered EPP comment at the top of the healthcheck template
recording that the manager-service check asserts the packaged
gitlab-runner systemd unit (systemctl is-active gitlab-runner), the name
the package defines rather than a module-derived value. Source-only, so
the rendered script and its golden are unchanged.
The manager's systemd unit name ('gitlab-runner') was a literal in
service.pp and again in the healthcheck template. Derive it once as
$service_name in init.pp and thread it into both. Value unchanged, so
the compiled catalog and the healthcheck golden are byte-identical.
config.pp built the ~/.config/systemd/user drop-in parent chain top-down
with dirname(), and rootless_docker.pp hardcoded the same path for the
setuptool's generated docker.service. Derive the chain once in init.pp,
built bottom-up (each directory its parent plus one element), and share
$user_systemd_dir with both. Paths are unchanged, so the compiled
catalog is byte-identical.
The apply template built the Puppetfile path inline from the control
repository path, twice, while its siblings (manifest, module directory,
Hiera config) arrive pre-derived from the manifest. Derive puppetfile_path
in self_update.pp and pass it in, and record the Puppetfile in the
control_repository_path option doc. Rendered script and catalog unchanged.
The $real_service_environment selector's inner `undef => []` arm looks
like it could render an empty Environment. Note that it is reached only
when runner_service.manage is off (the guard above rejects that case
while the service is managed), so [] is the never-consumed value that
keeps the selector total, not a rendered empty Environment.
The runner_service.environment option was documented as Array[String]
while the struct enforces Array[Pattern[/\A[^\r\n]+\z/]], and
standalone.self_update as a bare Hash while the struct spells out
manage/apply_interval/apply_timeout. Match the doc types to the enforced
types so REFERENCE states the real contract.
The struct_param helper mirrors the module's deep-merge lookup_options
so resource-style overrides merge over the module defaults the way a
Hiera consumer's partial hash would. The hand-rolled recursive merge
replaced whole arrays; Hiera's deep strategy unions them and applies the
'--' knockout prefix. Use the deep_merge gem that strategy is built on so
the helper matches Hiera, deep-copying both operands since deep_merge!
mutates its destination.
rendered_config duplicated rendered_file's Sensitive-unwrap logic and
carried a path parameter no caller passed; define it in terms of
rendered_file at the fixed default path. Collapse the repeated
struct_param('runner_account', 'uid' => N) boilerplate into one
account_with_uid helper. Test-only; the suite is unchanged.
The account name and home were re-subscripted out of runner_account in
five files (config, user, service, self_update, rootless_docker).
Hoist $runner_name and $runner_home once in init.pp, beside the existing
$runner_group, and have each concern read the local. Values unchanged,
so the compiled catalog is byte-identical.
The docker and gitlab_runner sources under packages.sources declared the
same inline Struct[{ location, key_source }] twice in the class
signature. Extract it as Rootless_gitlab_runner::Apt_source and reference
the alias in both. Same type constraint, so the compiled catalog is
byte-identical; REFERENCE regenerates with the alias.
packages.sources was documented as a bare Hash while the struct enforces
manage plus the docker and gitlab_runner apt sources. Spell the contract
out in the option type, referencing the Apt_source alias, so REFERENCE
states the real shape like the other options.
@jcardozo-eth jcardozo-eth self-assigned this Jul 23, 2026
@jcardozo-eth
jcardozo-eth deleted the branch feat/runner-account-custom-group July 23, 2026 08:57
@jcardozo-eth

jcardozo-eth commented Jul 23, 2026

Copy link
Copy Markdown
Member Author

Superseded by #31. This PR was auto-closed when its base branch feat/runner-account-custom-group was deleted on the merge of #29; the identical 12 commits continue in #31 against main.

@jcardozo-eth jcardozo-eth added the duplicate This issue or pull request already exists label Jul 23, 2026
@jcardozo-eth jcardozo-eth changed the title refactor: internal cleanups after the parameter-surface restructure [Superseded by #31] refactor: internal cleanups after the parameter-surface restructure Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

duplicate This issue or pull request already exists

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant