Split CI pipeline into modular files #68

Merged
AlexCaswen merged 5 commits from split-ci-pipeline into main 2026-05-17 21:38:14 +00:00
AlexCaswen commented 2026-05-17 21:36:52 +00:00 (Migrated from gitlab.com)

Breaks the monolithic .gitlab-ci.yml into focused files under ci/.

New structure

File Contents
.gitlab-ci.yml Stages, variables, includes only
ci/templates.yml .tailscale, .tofu, .incus + new .test-container and .deploy-container templates
ci/validate.yml validate + all test-* jobs
ci/terraform.yml plan, apply, rebuild
ci/deploy.yml All deploy-* jobs

Deduplication

Introduces two new templates that eliminate repeated boilerplate:

  • .test-container — generic NixOS test-build. Each test job just sets CONTAINER_NAME and rules.changes
  • .deploy-container — generic NixOS deploy (push config, update channels, rebuild switch). Custom jobs (monitoring, claude-code) extend it with !reference and add their extra steps

No behavior change

All jobs, rules, stages, and triggers are identical to the previous monolithic file. The only change is organization and reduced repetition.

Adding a new container

With the templates, adding a new container's CI is now 20 lines instead of 60:

# ci/validate.yml
test-new-container:
  extends: .test-container
  variables:
    CONTAINER_NAME: new-container
  rules:
    - if: $CI_MERGE_REQUEST_IID
      changes:
        - containers/new-container/**

# ci/deploy.yml
deploy-new-container:
  extends: .deploy-container
  variables:
    CONTAINER_NAME: new-container
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
      changes:
        - containers/new-container/**
      when: manual
Breaks the monolithic `.gitlab-ci.yml` into focused files under `ci/`. ## New structure | File | Contents | |------|----------| | `.gitlab-ci.yml` | Stages, variables, includes only | | `ci/templates.yml` | `.tailscale`, `.tofu`, `.incus` + new `.test-container` and `.deploy-container` templates | | `ci/validate.yml` | `validate` + all `test-*` jobs | | `ci/terraform.yml` | `plan`, `apply`, `rebuild` | | `ci/deploy.yml` | All `deploy-*` jobs | ## Deduplication Introduces two new templates that eliminate repeated boilerplate: - **`.test-container`** — generic NixOS test-build. Each test job just sets `CONTAINER_NAME` and `rules.changes` - **`.deploy-container`** — generic NixOS deploy (push config, update channels, rebuild switch). Custom jobs (monitoring, claude-code) extend it with `!reference` and add their extra steps ## No behavior change All jobs, rules, stages, and triggers are identical to the previous monolithic file. The only change is organization and reduced repetition. ## Adding a new container With the templates, adding a new container's CI is now 20 lines instead of 60: ```yaml # ci/validate.yml test-new-container: extends: .test-container variables: CONTAINER_NAME: new-container rules: - if: $CI_MERGE_REQUEST_IID changes: - containers/new-container/** # ci/deploy.yml deploy-new-container: extends: .deploy-container variables: CONTAINER_NAME: new-container rules: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH changes: - containers/new-container/** when: manual ```
AlexCaswen (Migrated from gitlab.com) approved these changes 2026-05-17 21:36:52 +00:00
AlexCaswen commented 2026-05-17 21:37:29 +00:00 (Migrated from gitlab.com)

assigned to @AlexCaswen

assigned to @AlexCaswen
AlexCaswen commented 2026-05-17 21:38:06 +00:00 (Migrated from gitlab.com)

approved this merge request

approved this merge request
AlexCaswen commented 2026-05-17 21:38:14 +00:00 (Migrated from gitlab.com)

mentioned in commit c3709c0b63

mentioned in commit c3709c0b63c5fd9ee8d65870b35578250f67b549
AlexCaswen (Migrated from gitlab.com) merged commit c3709c0b63 into main 2026-05-17 21:38:14 +00:00
AlexCaswen commented 2026-05-17 21:43:44 +00:00 (Migrated from gitlab.com)

mentioned in merge request !69

mentioned in merge request !69
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
midwitmoneymgmt/m3-infra!68
No description provided.