@catladder/cli 5.0.0 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/apps/cli/src/apps/cli/commands/project/doctor/checkGithub.js +3 -3
- package/dist/apps/cli/src/apps/cli/commands/project/doctor/checkGithub.js.map +1 -1
- package/dist/apps/cli/src/apps/cli/commands/project/setup/setupAccessTokens.js +2 -2
- package/dist/apps/cli/src/apps/cli/commands/project/setup/setupAccessTokens.js.map +1 -1
- package/dist/apps/cli/src/apps/cli/commands/project/setup/setupGithub.js +2 -2
- package/dist/apps/cli/src/apps/cli/commands/project/setup/setupGithub.js.map +1 -1
- package/dist/apps/cli/src/apps/cli/commands/project/setup/setupKubernetes.js +23 -7
- package/dist/apps/cli/src/apps/cli/commands/project/setup/setupKubernetes.js.map +1 -1
- package/dist/apps/cli/src/commands/index.d.ts +1 -0
- package/dist/apps/cli/src/commands/index.js +4 -1
- package/dist/apps/cli/src/commands/index.js.map +1 -1
- package/dist/apps/cli/src/commands/project/commandConfigSecrets.js +2 -1
- package/dist/apps/cli/src/commands/project/commandConfigSecrets.js.map +1 -1
- package/dist/apps/cli/src/commands/project/commandMrPin.d.ts +21 -0
- package/dist/apps/cli/src/commands/project/commandMrPin.js +119 -0
- package/dist/apps/cli/src/commands/project/commandMrPin.js.map +1 -0
- package/dist/apps/cli/src/commands/project/commandSecretsSyncGithub.d.ts +1 -42
- package/dist/apps/cli/src/commands/project/commandSecretsSyncGithub.js +5 -124
- package/dist/apps/cli/src/commands/project/commandSecretsSyncGithub.js.map +1 -1
- package/dist/apps/cli/src/commands/project/secrets/commandSecretsPush.js +2 -1
- package/dist/apps/cli/src/commands/project/secrets/commandSecretsPush.js.map +1 -1
- package/dist/apps/cli/src/commands/project/secrets/commandSecretsSet.js +2 -2
- package/dist/apps/cli/src/commands/project/secrets/commandSecretsSet.js.map +1 -1
- package/dist/apps/cli/src/commands/project/secrets/document.d.ts +1 -12
- package/dist/apps/cli/src/commands/project/secrets/document.js +1 -79
- package/dist/apps/cli/src/commands/project/secrets/document.js.map +1 -1
- package/dist/apps/cli/src/gcloud/serviceAccounts.js +15 -4
- package/dist/apps/cli/src/gcloud/serviceAccounts.js.map +1 -1
- package/dist/apps/cli/src/release/changesetsReleaseJob.js +3 -0
- package/dist/apps/cli/src/release/changesetsReleaseJob.js.map +1 -1
- package/dist/apps/cli/src/release/releaseEntry.d.ts +12 -0
- package/dist/apps/cli/src/release/releaseEntry.js +71 -0
- package/dist/apps/cli/src/release/releaseEntry.js.map +1 -0
- package/dist/apps/cli/src/secrets/github.d.ts +41 -0
- package/dist/apps/cli/src/secrets/github.js +127 -0
- package/dist/apps/cli/src/secrets/github.js.map +1 -0
- package/dist/apps/cli/src/secrets/index.d.ts +2 -0
- package/dist/apps/cli/src/secrets/index.js +19 -0
- package/dist/apps/cli/src/secrets/index.js.map +1 -0
- package/dist/apps/cli/src/secrets/writeSecrets.d.ts +18 -0
- package/dist/apps/cli/src/secrets/writeSecrets.js +88 -0
- package/dist/apps/cli/src/secrets/writeSecrets.js.map +1 -0
- package/dist/apps/cli/src/utils/gitlab.d.ts +10 -0
- package/dist/apps/cli/src/utils/gitlab.js +30 -5
- package/dist/apps/cli/src/utils/gitlab.js.map +1 -1
- package/dist/apps/cli/src/vault/BitwardenVault.d.ts +6 -0
- package/dist/apps/cli/src/vault/BitwardenVault.js +11 -1
- package/dist/apps/cli/src/vault/BitwardenVault.js.map +1 -1
- package/dist/apps/cli/src/vault/GitlabVault.d.ts +2 -2
- package/dist/apps/cli/src/vault/GitlabVault.js +3 -2
- package/dist/apps/cli/src/vault/GitlabVault.js.map +1 -1
- package/dist/apps/cli/src/vault/VaultManager.d.ts +2 -2
- package/dist/apps/cli/src/vault/VaultManager.js +2 -2
- package/dist/apps/cli/src/vault/VaultManager.js.map +1 -1
- package/dist/apps/cli/src/vault/types.d.ts +16 -2
- package/dist/bundles/catci/index.js +4 -4
- package/dist/bundles/catenv/index.js +115 -13
- package/dist/bundles/cli/index.js +749 -431
- package/dist/bundles/runner-images/semantic-release/Dockerfile +1 -0
- package/dist/bundles/runner-images/semantic-release/scripts/semanticRelease +14 -4
- package/dist/bundles/skills/catladder-cli/references/commands.md +13 -0
- package/dist/bundles/skills/catladder-deploys/SKILL.md +7 -0
- package/dist/bundles/skills/catladder-migrate-ci-backend/SKILL.md +7 -2
- package/dist/bundles/skills/catladder-pipelines/SKILL.md +27 -1
- package/dist/bundles/skills/catladder-releases/SKILL.md +16 -2
- package/dist/bundles/skills/catladder-secrets/SKILL.md +16 -0
- package/dist/packages/pipeline/src/autoStop.d.ts +22 -0
- package/dist/packages/pipeline/src/autoStop.js +30 -0
- package/dist/packages/pipeline/src/autoStop.js.map +1 -0
- package/dist/packages/pipeline/src/backends/gitlab/GitlabBackend.js +2 -0
- package/dist/packages/pipeline/src/backends/gitlab/GitlabBackend.js.map +1 -1
- package/dist/packages/pipeline/src/backends/gitlab/createGitlabPipeline.d.ts +4 -1
- package/dist/packages/pipeline/src/backends/gitlab/createGitlabPipeline.js +21 -1
- package/dist/packages/pipeline/src/backends/gitlab/createGitlabPipeline.js.map +1 -1
- package/dist/packages/pipeline/src/deploy/base/deploy.js +8 -2
- package/dist/packages/pipeline/src/deploy/base/deploy.js.map +1 -1
- package/dist/packages/pipeline/src/index.d.ts +1 -0
- package/dist/packages/pipeline/src/index.js +1 -0
- package/dist/packages/pipeline/src/index.js.map +1 -1
- package/dist/packages/pipeline/src/types/config.d.ts +32 -0
- package/dist/runner-images/semantic-release/Dockerfile +1 -0
- package/dist/runner-images/semantic-release/scripts/semanticRelease +14 -4
- package/dist/skills/catladder-cli/references/commands.md +13 -0
- package/dist/skills/catladder-deploys/SKILL.md +7 -0
- package/dist/skills/catladder-migrate-ci-backend/SKILL.md +7 -2
- package/dist/skills/catladder-pipelines/SKILL.md +27 -1
- package/dist/skills/catladder-releases/SKILL.md +16 -2
- package/dist/skills/catladder-secrets/SKILL.md +16 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/apps/cli/commands/project/doctor/checkGithub.ts +1 -1
- package/src/apps/cli/commands/project/setup/setupAccessTokens.ts +3 -2
- package/src/apps/cli/commands/project/setup/setupGithub.ts +1 -1
- package/src/apps/cli/commands/project/setup/setupKubernetes.ts +31 -20
- package/src/commands/index.ts +1 -0
- package/src/commands/project/commandConfigSecrets.ts +1 -1
- package/src/commands/project/commandMrPin.ts +184 -0
- package/src/commands/project/commandSecretsSyncGithub.ts +7 -154
- package/src/commands/project/secrets/commandSecretsPush.ts +2 -5
- package/src/commands/project/secrets/commandSecretsSet.ts +2 -2
- package/src/commands/project/secrets/document.ts +2 -127
- package/src/gcloud/serviceAccounts.ts +16 -7
- package/src/release/__tests__/releaseEntry.test.ts +88 -0
- package/src/release/changesetsReleaseJob.ts +3 -0
- package/src/release/releaseEntry.ts +86 -0
- package/src/secrets/__tests__/writeSecrets.test.ts +147 -0
- package/src/secrets/github.ts +157 -0
- package/src/secrets/index.ts +2 -0
- package/src/secrets/writeSecrets.ts +138 -0
- package/src/utils/gitlab.ts +34 -7
- package/src/vault/BitwardenVault.ts +10 -1
- package/src/vault/GitlabVault.ts +9 -2
- package/src/vault/VaultManager.ts +3 -2
- package/src/vault/__tests__/BitwardenVault.test.ts +88 -0
- package/src/vault/types.ts +17 -1
|
@@ -40,10 +40,20 @@ fi
|
|
|
40
40
|
echo "doing semantic release"
|
|
41
41
|
|
|
42
42
|
if [ "$GITHUB_ACTIONS" = "true" ]; then
|
|
43
|
-
# the
|
|
44
|
-
#
|
|
45
|
-
# is
|
|
46
|
-
|
|
43
|
+
# the github counterpart of the gitlab plugin below: it creates the
|
|
44
|
+
# entry on the releases page with the generated notes. Everything
|
|
45
|
+
# beyond that is switched off on purpose — commenting on the
|
|
46
|
+
# pull requests/issues of a release and labelling them would need
|
|
47
|
+
# `issues: write` / `pull-requests: write` on the release job, which
|
|
48
|
+
# only exists to release.
|
|
49
|
+
PUBLISH_PLUGIN=',
|
|
50
|
+
["@semantic-release/github", {
|
|
51
|
+
"successComment": false,
|
|
52
|
+
"failComment": false,
|
|
53
|
+
"failTitle": false,
|
|
54
|
+
"labels": false,
|
|
55
|
+
"releasedLabels": false
|
|
56
|
+
}]'
|
|
47
57
|
else
|
|
48
58
|
# no gitlabUrl: the plugin derives it from the CI-provided variables
|
|
49
59
|
# of the running instance. It used to be hardcoded to panter's gitlab,
|
|
@@ -79,6 +79,19 @@ trigger cronjob
|
|
|
79
79
|
- `namespace` (positional): kubernetes namespace
|
|
80
80
|
- `--job-name <value>`: Which cronjob?
|
|
81
81
|
|
|
82
|
+
## `catladder mr pin [mr]`
|
|
83
|
+
|
|
84
|
+
pin the review apps of a merge request (disable their auto-stop) by adding the pin label; merging or closing the MR still stops them
|
|
85
|
+
|
|
86
|
+
- `mr` (positional): merge request IID (defaults to the open MR of the current branch)
|
|
87
|
+
- `--pipeline`: trigger a merge-request pipeline so the pin takes effect immediately
|
|
88
|
+
|
|
89
|
+
## `catladder mr unpin [mr]`
|
|
90
|
+
|
|
91
|
+
unpin the review apps of a merge request — the auto-stop timer re-arms with the next deploy
|
|
92
|
+
|
|
93
|
+
- `mr` (positional): merge request IID (defaults to the open MR of the current branch)
|
|
94
|
+
|
|
82
95
|
## `catladder project ci job-log`
|
|
83
96
|
|
|
84
97
|
Show a job's log
|
|
@@ -46,6 +46,13 @@ is `auto`.** Set per component or per environment (`env.<name>.deploy`).
|
|
|
46
46
|
`waitFor: ["otherComponent"]` (experimental) makes a deploy wait for
|
|
47
47
|
another component to deploy first.
|
|
48
48
|
|
|
49
|
+
## Environment lifetimes
|
|
50
|
+
|
|
51
|
+
Review apps auto-stop after 1 week, dev environments after 4 weeks
|
|
52
|
+
(GitLab only — configure with top-level `autoStop` in `catladder.ts`).
|
|
53
|
+
Pin an MR's review apps with `yarn catladder mr pin` — see the
|
|
54
|
+
`catladder-pipelines` skill.
|
|
55
|
+
|
|
49
56
|
## Kubernetes essentials
|
|
50
57
|
|
|
51
58
|
`cluster` is required: `{ type: "gcloud", name, projectId, region, domainCanonical? }`.
|
|
@@ -167,8 +167,13 @@ A safe order:
|
|
|
167
167
|
against the old vault (unset values show as `🚨 FILL ME`)
|
|
168
168
|
2. switch `secrets.vault` in `catladder.ts`, `yarn catenv`
|
|
169
169
|
3. `yarn catladder project secrets-push <env>: --file /tmp/secrets.yml`
|
|
170
|
-
4. `yarn catladder project
|
|
171
|
-
|
|
170
|
+
4. `yarn catladder project setup` — the *provisioned* credentials (the
|
|
171
|
+
gcloud deploy service account key, the kubernetes deploy
|
|
172
|
+
credentials) are hidden keys and therefore not part of the document
|
|
173
|
+
the pull/push round trip moves; setup re-provisions them into the
|
|
174
|
+
new vault
|
|
175
|
+
5. `yarn catladder project doctor`, then delete the temp file
|
|
176
|
+
6. only now decommission the GitLab project
|
|
172
177
|
|
|
173
178
|
Never commit the intermediate file, and see the `catladder-secrets`
|
|
174
179
|
skill for the exact command surface.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: catladder-pipelines
|
|
3
|
-
description: Understanding and debugging the CI/CD pipelines catladder generates (GitLab CI and GitHub Actions) — pipeline triggers, stages, environments, caching, job images, releases, and infrastructure drift. Use when investigating failing CI jobs, when asked why/when a job runs, when changing caching or job behavior, or when
|
|
3
|
+
description: Understanding and debugging the CI/CD pipelines catladder generates (GitLab CI and GitHub Actions) — pipeline triggers, stages, environments, caching, job images, releases, and infrastructure drift. Use when investigating failing CI jobs, when asked why/when a job runs, when changing caching or job behavior, when deployments misbehave, or when a review app stopped/expired or should be kept alive (pinning). Triggers on "pipeline", "CI job", "gitlab-ci", "workflow", "deploy failed", "cache", "release", "auto-stop", "review app stopped", "pin review app", "keep review app".
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# How catladder pipelines work
|
|
@@ -37,6 +37,32 @@ Generated layout:
|
|
|
37
37
|
Stages: setup → test → build → deploy → verify (post-deploy checks),
|
|
38
38
|
plus stop jobs for review-app teardown.
|
|
39
39
|
|
|
40
|
+
## Review-app auto-stop and pinning (GitLab)
|
|
41
|
+
|
|
42
|
+
GitLab review environments stop automatically after 1 week, dev
|
|
43
|
+
environments after 4 weeks. Configure with top-level `autoStop` in
|
|
44
|
+
`catladder.ts` (`{ review, dev }`, gitlab natural language like
|
|
45
|
+
`"3 days"` or `"never"`). Merging or closing the MR always stops its
|
|
46
|
+
review apps, independent of the timer.
|
|
47
|
+
|
|
48
|
+
To keep an MR's review apps alive longer, pin the MR:
|
|
49
|
+
|
|
50
|
+
- `yarn catladder mr pin` — adds the pin label (default
|
|
51
|
+
`catladder::pin-review`, configurable via `autoStop.pinLabel`) to the
|
|
52
|
+
current branch's open MR and triggers a pipeline so the pin takes
|
|
53
|
+
effect immediately. While the label is set, ALL components' review
|
|
54
|
+
apps deploy with `auto_stop_in: never`.
|
|
55
|
+
- `yarn catladder mr unpin` — removes the label; the auto-stop timer
|
|
56
|
+
re-arms with the next deploy.
|
|
57
|
+
|
|
58
|
+
The pin lives on the MR (a label), not on the environment, so it
|
|
59
|
+
survives redeploys — unlike gitlab's per-environment pin button, which
|
|
60
|
+
the next successful deploy resets. Adding/removing the label by hand
|
|
61
|
+
works too; a label change takes effect from the MR's next pipeline.
|
|
62
|
+
|
|
63
|
+
GitHub has no auto-stop: review apps run until the pull request is
|
|
64
|
+
closed (pinning does not apply there).
|
|
65
|
+
|
|
40
66
|
## Job images and catci
|
|
41
67
|
|
|
42
68
|
Jobs run in catladder-provided images (`🐳 catladder image <name>` build
|
|
@@ -52,6 +52,11 @@ workflows the same way (`▶️ catladder deploy`, `⏹️ catladder stop`,
|
|
|
52
52
|
|
|
53
53
|
## `method` — how the version is decided
|
|
54
54
|
|
|
55
|
+
Whichever method runs, the release ends the same way: a `vX.Y.Z` tag, a
|
|
56
|
+
`CHANGELOG.md` entry, a `chore(release): <version>` commit, and an
|
|
57
|
+
entry on the releases page of the git host (gitlab `/-/releases`,
|
|
58
|
+
github `/releases`) carrying the release notes.
|
|
59
|
+
|
|
55
60
|
### `semantic-release` (default)
|
|
56
61
|
The version is derived automatically from **conventional commit
|
|
57
62
|
messages** since the last release (`fix:` → patch, `feat:` → minor,
|
|
@@ -63,8 +68,10 @@ Developers declare changes intentionally as **`.changeset/*.md` files**
|
|
|
63
68
|
(the official changesets format: a bump type + a human-written summary).
|
|
64
69
|
The release job consumes all pending changesets, takes the highest bump,
|
|
65
70
|
computes the next version from the last `v*` git tag, writes the
|
|
66
|
-
changelog, commits `chore(release): <version>`,
|
|
67
|
-
|
|
71
|
+
changelog, commits `chore(release): <version>`, pushes the tag and
|
|
72
|
+
creates the release entry on the git host (gitlab `/-/releases`,
|
|
73
|
+
github `/releases`) with the changelog as its description. An empty
|
|
74
|
+
`.changeset/` folder means there is nothing to release.
|
|
68
75
|
|
|
69
76
|
Add a changeset by creating `.changeset/<name>.md`:
|
|
70
77
|
|
|
@@ -121,6 +128,13 @@ the `security` commands in the `catladder-cli` reference.
|
|
|
121
128
|
MR adding a changeset describing the accumulated work.
|
|
122
129
|
- Wrong version bump → check commit types (semantic-release) or the bump
|
|
123
130
|
levels in the changeset files (changesets).
|
|
131
|
+
- Tag pushed but nothing on the releases page → with `changesets` the
|
|
132
|
+
entry is created via the host api after the push and never fails the
|
|
133
|
+
job (the release itself is done); look for the `could not create the
|
|
134
|
+
release entry` warning at the end of the release job log. On gitlab
|
|
135
|
+
it needs `GL_TOKEN` (`catladder project renew-token`). Releases
|
|
136
|
+
tagged before catladder created entries have none — that is not fixed
|
|
137
|
+
retroactively, create them by hand from the tag.
|
|
124
138
|
- Inspect the job with `yarn catladder project ci job-log` (see the
|
|
125
139
|
`catladder-cli` skill).
|
|
126
140
|
|
|
@@ -80,6 +80,22 @@ All of these write to the secrets vault (the source of truth) and
|
|
|
80
80
|
automatically mirror to the enabled CI backends — which vault is
|
|
81
81
|
configured makes no difference to the commands.
|
|
82
82
|
|
|
83
|
+
## Provisioned secrets
|
|
84
|
+
|
|
85
|
+
A few secrets are not typed in by a human but created by
|
|
86
|
+
`yarn catladder project setup`: the gcloud deploy service account key
|
|
87
|
+
(`GCLOUD_DEPLOY_credentialsKey`) and the kubernetes deploy credentials
|
|
88
|
+
(`KUBE_TOKEN`, `KUBE_CA_PEM`, `KUBE_URL`). They travel the same route as
|
|
89
|
+
every other secret — vault first, then the enabled CI backends — but
|
|
90
|
+
they are *hidden*: they never show up in `secrets-list`, in the editor
|
|
91
|
+
or in a pulled document, and they must never be set by hand.
|
|
92
|
+
|
|
93
|
+
Re-running `project setup` **rotates** them (a fresh credential is
|
|
94
|
+
created and the old one revoked). That is also the answer whenever they
|
|
95
|
+
are missing somewhere — after switching `secrets.vault`, for instance:
|
|
96
|
+
a `secrets-pull`/`secrets-push` round trip does not carry hidden keys
|
|
97
|
+
over, so re-run `project setup` to provision them into the new vault.
|
|
98
|
+
|
|
83
99
|
## GitHub pipelines
|
|
84
100
|
|
|
85
101
|
GitHub Actions cannot read the vault at runtime; secrets are mirrored
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Config } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* pipeline-level variable holding the `auto_stop_in` of review
|
|
4
|
+
* environments. Review deploy jobs reference it instead of a literal,
|
|
5
|
+
* so the pin label's workflow rule can override it to `never` for the
|
|
6
|
+
* whole pipeline (all components at once).
|
|
7
|
+
*/
|
|
8
|
+
export declare const REVIEW_AUTO_STOP_VARIABLE = "CL_REVIEW_AUTO_STOP";
|
|
9
|
+
export declare const DEFAULT_REVIEW_AUTO_STOP = "1 week";
|
|
10
|
+
export declare const DEFAULT_DEV_AUTO_STOP = "4 weeks";
|
|
11
|
+
export declare const DEFAULT_PIN_LABEL = "catladder::pin-review";
|
|
12
|
+
export type ResolvedAutoStopConfig = {
|
|
13
|
+
review: string;
|
|
14
|
+
dev: string;
|
|
15
|
+
pinLabel: string | false;
|
|
16
|
+
};
|
|
17
|
+
export declare const getAutoStopConfig: (config: Config) => ResolvedAutoStopConfig;
|
|
18
|
+
/**
|
|
19
|
+
* matches the pin label inside `$CI_MERGE_REQUEST_LABELS`
|
|
20
|
+
* (comma-separated) — anchored so `pin` never matches `no-pin`
|
|
21
|
+
*/
|
|
22
|
+
export declare const getPinLabelRegexSource: (pinLabel: string) => string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPinLabelRegexSource = exports.getAutoStopConfig = exports.DEFAULT_PIN_LABEL = exports.DEFAULT_DEV_AUTO_STOP = exports.DEFAULT_REVIEW_AUTO_STOP = exports.REVIEW_AUTO_STOP_VARIABLE = void 0;
|
|
4
|
+
const lodash_es_1 = require("lodash-es");
|
|
5
|
+
/**
|
|
6
|
+
* pipeline-level variable holding the `auto_stop_in` of review
|
|
7
|
+
* environments. Review deploy jobs reference it instead of a literal,
|
|
8
|
+
* so the pin label's workflow rule can override it to `never` for the
|
|
9
|
+
* whole pipeline (all components at once).
|
|
10
|
+
*/
|
|
11
|
+
exports.REVIEW_AUTO_STOP_VARIABLE = "CL_REVIEW_AUTO_STOP";
|
|
12
|
+
exports.DEFAULT_REVIEW_AUTO_STOP = "1 week";
|
|
13
|
+
exports.DEFAULT_DEV_AUTO_STOP = "4 weeks";
|
|
14
|
+
exports.DEFAULT_PIN_LABEL = "catladder::pin-review";
|
|
15
|
+
const getAutoStopConfig = (config) => {
|
|
16
|
+
var _a, _b, _c, _d, _e, _f;
|
|
17
|
+
return ({
|
|
18
|
+
review: (_b = (_a = config.autoStop) === null || _a === void 0 ? void 0 : _a.review) !== null && _b !== void 0 ? _b : exports.DEFAULT_REVIEW_AUTO_STOP,
|
|
19
|
+
dev: (_d = (_c = config.autoStop) === null || _c === void 0 ? void 0 : _c.dev) !== null && _d !== void 0 ? _d : exports.DEFAULT_DEV_AUTO_STOP,
|
|
20
|
+
pinLabel: (_f = (_e = config.autoStop) === null || _e === void 0 ? void 0 : _e.pinLabel) !== null && _f !== void 0 ? _f : exports.DEFAULT_PIN_LABEL,
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
exports.getAutoStopConfig = getAutoStopConfig;
|
|
24
|
+
/**
|
|
25
|
+
* matches the pin label inside `$CI_MERGE_REQUEST_LABELS`
|
|
26
|
+
* (comma-separated) — anchored so `pin` never matches `no-pin`
|
|
27
|
+
*/
|
|
28
|
+
const getPinLabelRegexSource = (pinLabel) => `(^|,)${(0, lodash_es_1.escapeRegExp)(pinLabel).replaceAll("/", "\\/")}(,|$)`;
|
|
29
|
+
exports.getPinLabelRegexSource = getPinLabelRegexSource;
|
|
30
|
+
//# sourceMappingURL=autoStop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autoStop.js","sourceRoot":"","sources":["../../../../../../packages/pipeline/src/autoStop.ts"],"names":[],"mappings":";;;AAAA,yCAAyC;AAGzC;;;;;GAKG;AACU,QAAA,yBAAyB,GAAG,qBAAqB,CAAC;AAElD,QAAA,wBAAwB,GAAG,QAAQ,CAAC;AACpC,QAAA,qBAAqB,GAAG,SAAS,CAAC;AAClC,QAAA,iBAAiB,GAAG,uBAAuB,CAAC;AAQlD,MAAM,iBAAiB,GAAG,CAAC,MAAc,EAA0B,EAAE;;IAAC,OAAA,CAAC;QAC5E,MAAM,EAAE,MAAA,MAAA,MAAM,CAAC,QAAQ,0CAAE,MAAM,mCAAI,gCAAwB;QAC3D,GAAG,EAAE,MAAA,MAAA,MAAM,CAAC,QAAQ,0CAAE,GAAG,mCAAI,6BAAqB;QAClD,QAAQ,EAAE,MAAA,MAAA,MAAM,CAAC,QAAQ,0CAAE,QAAQ,mCAAI,yBAAiB;KACzD,CAAC,CAAA;CAAA,CAAC;AAJU,QAAA,iBAAiB,qBAI3B;AAEH;;;GAGG;AACI,MAAM,sBAAsB,GAAG,CAAC,QAAgB,EAAU,EAAE,CACjE,QAAQ,IAAA,wBAAY,EAAC,QAAQ,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC;AADlD,QAAA,sBAAsB,0BAC4B"}
|
|
@@ -4,6 +4,7 @@ exports.GitlabBackend = void 0;
|
|
|
4
4
|
const promises_1 = require("fs/promises");
|
|
5
5
|
const rules_1 = require("../../rules");
|
|
6
6
|
const config_1 = require("../../types/config");
|
|
7
|
+
const autoStop_1 = require("../../autoStop");
|
|
7
8
|
const createAllJobs_1 = require("../../pipeline/createAllJobs");
|
|
8
9
|
const jobImagesPlan_1 = require("../../customImages/jobImagesPlan");
|
|
9
10
|
const shippedCatci_1 = require("../../catci/shippedCatci");
|
|
@@ -189,6 +190,7 @@ class GitlabBackend {
|
|
|
189
190
|
// per-pipeline-type variables (pipelines.gitlab.runnerVariables)
|
|
190
191
|
...(0, index_1.getPipelineOptions)(config, this.type).runnerVariables,
|
|
191
192
|
},
|
|
193
|
+
autoStop: (0, autoStop_1.getAutoStopConfig)(config),
|
|
192
194
|
});
|
|
193
195
|
}
|
|
194
196
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GitlabBackend.js","sourceRoot":"","sources":["../../../../../../../../packages/pipeline/src/backends/gitlab/GitlabBackend.ts"],"names":[],"mappings":";;;AAAA,0CAA2C;AAC3C,uCAKqB;AAUrB,+CAA2D;AAC3D,gEAA6D;AAC7D,oEAAiE;AACjE,2DAAkE;AAClE,2CAAiD;AAEjD,oCAA8C;AAE9C,yDAAsD;AACtD,iEAA0E;AAC1E,2DAA2D;AAC3D,2DAAwD;AACxD,uDAA2D;AAC3D,mEAAgE;AAChE,uDAA+D;AAE/D,MAAM,0BAA0B,GAAG,sBAAsB,CAAC;AAE1D,MAAM,uBAAuB,GAAG,0BAA0B,GAAG,SAAS,CAAC;AAEvE,MAAM,gBAAgB,GAAG,gBAAgB,CAAC;AAE1C,MAAa,aAAa;IAA1B;QACW,SAAI,GAAG,QAAiB,CAAC;QAEzB,oBAAe,GAAG,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"GitlabBackend.js","sourceRoot":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S,CAAC,EAAE,EAAE,CAAC;oBACrD,IAAI;oBACJ;wBACE,SAAS;wBACT,OAAO,EAAE,IAAI;qBACd;iBACF,CAAC,CACH;aACF;YACD,SAAS,EAAE;gBACT,GAAG,MAAM,CAAC,eAAe;gBACzB,iEAAiE;gBACjE,GAAG,IAAA,0BAAkB,EAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,eAAe;aACzD;YACD,QAAQ,EAAE,IAAA,4BAAiB,EAAC,MAAM,CAAC;SACpC,CAAC,CAAC;IACL,CAAC;CACF;AA9OD,sCA8OC;AAED;;;GAGG;AACH,SAAS,iBAAiB,CAAC,GAAiB;;IAC1C,OAAO,CAAC,MAAA,GAAG,CAAC,KAAK,mCAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC;AAClE,CAAC;AAED,SAAS,wBAAwB,CAAC,OAAwB;IACxD,kEAAkE;IAClE,uBAAuB;IACvB,wBAAwB;IACxB,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,YAAY;YACf,OAAO;gBACL,mCAA2B;gBAC3B,kDAA0C;aAC3C,CAAC;QACJ,KAAK,IAAI;YACP,OAAO,CAAC,mCAA2B,EAAE,6BAAqB,CAAC,CAAC;QAC9D,KAAK,eAAe;YAClB,OAAO,CAAC,mCAA2B,EAAE,8BAAsB,CAAC,CAAC;IACjE,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,GAAG,OAAO,mBAAmB,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { Pipeline } from "../../types";
|
|
2
|
+
import { type ResolvedAutoStopConfig } from "../../autoStop";
|
|
2
3
|
type PickRequired<T, K extends keyof T> = Required<Pick<T, K>> & Omit<T, K>;
|
|
3
|
-
export declare const createGitlabPipelineWithDefaults: ({ image, variables, before_script, ...config }: PickRequired<Partial<Pipeline<"gitlab">>, "stages" | "jobs">
|
|
4
|
+
export declare const createGitlabPipelineWithDefaults: ({ image, variables, before_script, autoStop, ...config }: PickRequired<Partial<Pipeline<"gitlab">>, "stages" | "jobs"> & {
|
|
5
|
+
autoStop?: ResolvedAutoStopConfig;
|
|
6
|
+
}) => Pipeline<"gitlab">;
|
|
4
7
|
export {};
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createGitlabPipelineWithDefaults = void 0;
|
|
4
4
|
const bash_1 = require("../../../../bash/src/index.js");
|
|
5
|
+
const autoStop_1 = require("../../autoStop");
|
|
5
6
|
const rules_1 = require("../../rules");
|
|
6
7
|
/**
|
|
7
8
|
* gitlab requires a top-level default image for jobs that don't set their
|
|
@@ -10,7 +11,8 @@ const rules_1 = require("../../rules");
|
|
|
10
11
|
* build-free image (a catladder job image would drag in a build job).
|
|
11
12
|
*/
|
|
12
13
|
const DEFAULT_PIPELINE_IMAGE = "node:22";
|
|
13
|
-
const createGitlabPipelineWithDefaults = ({ image, variables, before_script, ...config }) => {
|
|
14
|
+
const createGitlabPipelineWithDefaults = ({ image, variables, before_script, autoStop, ...config }) => {
|
|
15
|
+
const pinLabel = autoStop && autoStop.pinLabel;
|
|
14
16
|
return {
|
|
15
17
|
image: image !== null && image !== void 0 ? image : DEFAULT_PIPELINE_IMAGE,
|
|
16
18
|
variables: {
|
|
@@ -19,6 +21,10 @@ const createGitlabPipelineWithDefaults = ({ image, variables, before_script, ...
|
|
|
19
21
|
CACHE_COMPRESSION_LEVEL: "fast", // same as above, but for caches
|
|
20
22
|
TRANSFER_METER_FREQUENCY: "5s", // how often we should update the transfer meter for cache upload/download
|
|
21
23
|
GIT_DEPTH: "1", // no need the full depth
|
|
24
|
+
// review env lifetime — the pin-label workflow rule below
|
|
25
|
+
// overrides this to "never" (workflow rule variables take
|
|
26
|
+
// precedence over pipeline-level variables)
|
|
27
|
+
...(pinLabel ? { [autoStop_1.REVIEW_AUTO_STOP_VARIABLE]: autoStop.review } : {}),
|
|
22
28
|
...(variables !== null && variables !== void 0 ? variables : {}),
|
|
23
29
|
},
|
|
24
30
|
before_script: [
|
|
@@ -35,6 +41,20 @@ const createGitlabPipelineWithDefaults = ({ image, variables, before_script, ...
|
|
|
35
41
|
PIPELINE_NAME: "Thinking...",
|
|
36
42
|
},
|
|
37
43
|
},
|
|
44
|
+
// pinned MRs (rules stop at the first match, so this must come
|
|
45
|
+
// before the plain merge-request rule)
|
|
46
|
+
...(pinLabel
|
|
47
|
+
? [
|
|
48
|
+
{
|
|
49
|
+
if: `${rules_1.RULE_IS_MERGE_REQUEST.if} && $CI_MERGE_REQUEST_LABELS =~ /${(0, autoStop_1.getPinLabelRegexSource)(pinLabel)}/`,
|
|
50
|
+
variables: {
|
|
51
|
+
PIPELINE_ICON: "🐱📌",
|
|
52
|
+
PIPELINE_NAME: "mr$CI_MERGE_REQUEST_IID - $CI_MERGE_REQUEST_TITLE",
|
|
53
|
+
[autoStop_1.REVIEW_AUTO_STOP_VARIABLE]: "never",
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
]
|
|
57
|
+
: []),
|
|
38
58
|
{
|
|
39
59
|
if: rules_1.RULE_IS_MERGE_REQUEST.if,
|
|
40
60
|
variables: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createGitlabPipeline.js","sourceRoot":"","sources":["../../../../../../../../packages/pipeline/src/backends/gitlab/createGitlabPipeline.ts"],"names":[],"mappings":";;;AACA,0CAAwD;AACxD,uCAIqB;AAGrB;;;;;GAKG;AACH,MAAM,sBAAsB,GAAG,SAAS,CAAC;AAElC,MAAM,gCAAgC,GAAG,CAAC,EAC/C,KAAK,EACL,SAAS,EACT,aAAa,EACb,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"createGitlabPipeline.js","sourceRoot":"","sources":["../../../../../../../../packages/pipeline/src/backends/gitlab/createGitlabPipeline.ts"],"names":[],"mappings":";;;AACA,0CAAw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uCAAuC;gBACvC,GAAG,CAAC,QAAQ;oBACV,CAAC,CAAC;wBACE;4BACE,EAAE,EAAE,GAAG,6BAAqB,CAAC,EAAE,oCAAoC,IAAA,iCAAsB,EAAC,QAAQ,CAAC,GAAG;4BACtG,SAAS,EAAE;gCACT,aAAa,EAAE,MAAM;gCACrB,aAAa,EACX,mDAAmD;gCACrD,CAAC,oCAAyB,CAAC,EAAE,OAAO;6BACrC;yBACF;qBACF;oBACH,CAAC,CAAC,EAAE,CAAC;gBACP;oBACE,EAAE,EAAE,6BAAqB,CAAC,EAAE;oBAC5B,SAAS,EAAE;wBACT,aAAa,EAAE,MAAM;wBACrB,aAAa,EAAE,mDAAmD;qBACnE;iBACF;gBACD;oBACE,EAAE,EAAE,8BAAsB,CAAC,EAAE;oBAC7B,SAAS,EAAE;wBACT,aAAa,EAAE,MAAM;wBACrB,aAAa,EAAE,wBAAwB;qBACxC;iBACF;gBACD;oBACE,EAAE,EAAE,kDAA0C,CAAC,EAAE;oBACjD,SAAS,EAAE;wBACT,aAAa,EAAE,MAAM;wBACrB,aAAa,EAAE,yBAAyB;qBACzC;iBACF;gBAED;oBACE,IAAI,EAAE,QAAQ,EAAE,WAAW;oBAC3B,SAAS,EAAE;wBACT,aAAa,EAAE,KAAK;wBACpB,aAAa,EAAE,SAAS;qBACzB;iBACF;aACF;SACF;QAED,GAAG,MAAM;KACV,CAAC;AACJ,CAAC,CAAC;AA1FW,QAAA,gCAAgC,oCA0F3C"}
|
|
@@ -5,6 +5,7 @@ const docker_1 = require("../../build/docker");
|
|
|
5
5
|
const context_1 = require("../../types/context");
|
|
6
6
|
const jobs_1 = require("../../types/jobs");
|
|
7
7
|
const utils_1 = require("../utils");
|
|
8
|
+
const autoStop_1 = require("../../autoStop");
|
|
8
9
|
const stop_1 = require("./stop");
|
|
9
10
|
const variables_1 = require("./variables");
|
|
10
11
|
exports.DEPLOY_JOB_NAME = "🚀 Deploy";
|
|
@@ -13,10 +14,15 @@ class DeployJob extends jobs_1.CatladderJob {
|
|
|
13
14
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
14
15
|
const hasDocker = (0, docker_1.requiresDockerBuild)(context);
|
|
15
16
|
const isStoppable = (0, utils_1.contextIsStoppable)(context);
|
|
17
|
+
const autoStopConfig = (0, autoStop_1.getAutoStopConfig)(context.fullConfig);
|
|
16
18
|
const autoStop = context.environment.envType === "review"
|
|
17
|
-
?
|
|
19
|
+
? // review envs read the lifetime from a pipeline variable, so
|
|
20
|
+
// the pin label's workflow rule can override it to "never"
|
|
21
|
+
autoStopConfig.pinLabel === false
|
|
22
|
+
? autoStopConfig.review
|
|
23
|
+
: `$${autoStop_1.REVIEW_AUTO_STOP_VARIABLE}`
|
|
18
24
|
: context.environment.envType === "dev"
|
|
19
|
-
?
|
|
25
|
+
? autoStopConfig.dev
|
|
20
26
|
: undefined;
|
|
21
27
|
const deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
22
28
|
// if auto or manual is configured explicitly, use that
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../../../../../../../packages/pipeline/src/deploy/base/deploy.ts"],"names":[],"mappings":";;;AAAA,+CAG4B;AAE5B,iDAG6B;AAE7B,2CAAgD;AAChD,oCAA8C;AAC9C,iCAAuC;AAEvC,2CAAsD;AAEzC,QAAA,eAAe,GAAG,WAAW,CAAC;AAE3C,MAAa,SAAU,SAAQ,mBAAY;IACzC,YAAY,OAAyB,EAAE,aAAkC;;QACvE,MAAM,SAAS,GAAG,IAAA,4BAAmB,EAAC,OAAO,CAAC,CAAC;QAC/C,MAAM,WAAW,GAAG,IAAA,0BAAkB,EAAC,OAAO,CAAC,CAAC;QAEhD,MAAM,QAAQ,GACZ,OAAO,CAAC,WAAW,CAAC,OAAO,KAAK,QAAQ;YACtC,CAAC,CAAC,QAAQ;
|
|
1
|
+
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../../../../../../../packages/pipeline/src/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AAC,OAAO;gBAEjD,GAAG,aAAa,CAAC,SAAS;aAC3B;YACD,eAAe,EAAE;gBACf,GAAG,mCAAuB;gBAC1B,GAAG,CAAC,MAAA,aAAa,CAAC,eAAe,mCAAI,EAAE,CAAC;gBACxC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,MAAA,YAAY,CAAC,eAAe,mCAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;aAC9D;YACD,WAAW,EAAE,WAAW;gBACtB,CAAC,CAAC;oBACE,MAAM,EAAE,oBAAa;oBACrB,UAAU,EAAE,QAAQ;iBACrB;gBACH,CAAC,CAAC,EAAE;YACN,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;SACzD,CAAC,CAAC;IACL,CAAC;CACF;AAtID,8BAsIC"}
|
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./pipeline"), exports);
|
|
18
|
+
__exportStar(require("./autoStop"), exports);
|
|
18
19
|
__exportStar(require("./backends"), exports);
|
|
19
20
|
__exportStar(require("./types"), exports);
|
|
20
21
|
__exportStar(require("./rules"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pipeline/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,6CAA2B;AAC3B,0CAAwB;AACxB,0CAAwB;AACxB,2CAAyB;AACzB,+DAA6C;AAC7C,+DAA6C;AAC7C,2CAAyB;AACzB,0CAAwB;AACxB,4CAA0B;AAC1B,0CAAwB;AACxB,2CAAyB;AACzB,2CAAyB;AACzB,4CAA0B;AAC1B,qDAAmC;AACnC,sDAAoC;AACpC,kDAAgC;AAChC,2CAAyB;AACzB,gDAA8B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pipeline/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,6CAA2B;AAC3B,6CAA2B;AAC3B,0CAAwB;AACxB,0CAAwB;AACxB,2CAAyB;AACzB,+DAA6C;AAC7C,+DAA6C;AAC7C,2CAAyB;AACzB,0CAAwB;AACxB,4CAA0B;AAC1B,0CAAwB;AACxB,2CAAyB;AACzB,2CAAyB;AACzB,4CAA0B;AAC1B,qDAAmC;AACnC,sDAAoC;AACpC,kDAAgC;AAChC,2CAAyB;AACzB,gDAA8B"}
|
|
@@ -313,6 +313,38 @@ export type Config<C extends ConfigProps = never> = {
|
|
|
313
313
|
meta?: {
|
|
314
314
|
labels?: Record<string, string>;
|
|
315
315
|
};
|
|
316
|
+
/**
|
|
317
|
+
* auto-stop of non-production environments (gitlab only): review
|
|
318
|
+
* environments stop automatically after `review` (default "1 week"),
|
|
319
|
+
* dev environments after `dev` (default "4 weeks"). Merging or
|
|
320
|
+
* closing the MR always stops its review environments, independent of
|
|
321
|
+
* these timers.
|
|
322
|
+
*
|
|
323
|
+
* `pinLabel` names the merge-request label that pins an MR's review
|
|
324
|
+
* apps: while the label is set, review deploys use
|
|
325
|
+
* `auto_stop_in: never`, so the apps outlive the timer until the MR
|
|
326
|
+
* is merged or closed. Apply it with `catladder mr pin` (or add the
|
|
327
|
+
* label manually) — it takes effect from the next pipeline of the MR.
|
|
328
|
+
*/
|
|
329
|
+
autoStop?: {
|
|
330
|
+
/**
|
|
331
|
+
* lifetime of review environments, in gitlab natural language
|
|
332
|
+
* (e.g. "3 days") or "never"
|
|
333
|
+
* @defaultValue "1 week"
|
|
334
|
+
*/
|
|
335
|
+
review?: string;
|
|
336
|
+
/**
|
|
337
|
+
* lifetime of dev environments
|
|
338
|
+
* @defaultValue "4 weeks"
|
|
339
|
+
*/
|
|
340
|
+
dev?: string;
|
|
341
|
+
/**
|
|
342
|
+
* the merge-request label that pins review apps, or `false` to
|
|
343
|
+
* disable the pin mechanism
|
|
344
|
+
* @defaultValue "catladder::pin-review"
|
|
345
|
+
*/
|
|
346
|
+
pinLabel?: string | false;
|
|
347
|
+
};
|
|
316
348
|
/**
|
|
317
349
|
* additional vars only for the runner in all jobs.
|
|
318
350
|
*/
|
|
@@ -40,10 +40,20 @@ fi
|
|
|
40
40
|
echo "doing semantic release"
|
|
41
41
|
|
|
42
42
|
if [ "$GITHUB_ACTIONS" = "true" ]; then
|
|
43
|
-
# the
|
|
44
|
-
#
|
|
45
|
-
# is
|
|
46
|
-
|
|
43
|
+
# the github counterpart of the gitlab plugin below: it creates the
|
|
44
|
+
# entry on the releases page with the generated notes. Everything
|
|
45
|
+
# beyond that is switched off on purpose — commenting on the
|
|
46
|
+
# pull requests/issues of a release and labelling them would need
|
|
47
|
+
# `issues: write` / `pull-requests: write` on the release job, which
|
|
48
|
+
# only exists to release.
|
|
49
|
+
PUBLISH_PLUGIN=',
|
|
50
|
+
["@semantic-release/github", {
|
|
51
|
+
"successComment": false,
|
|
52
|
+
"failComment": false,
|
|
53
|
+
"failTitle": false,
|
|
54
|
+
"labels": false,
|
|
55
|
+
"releasedLabels": false
|
|
56
|
+
}]'
|
|
47
57
|
else
|
|
48
58
|
# no gitlabUrl: the plugin derives it from the CI-provided variables
|
|
49
59
|
# of the running instance. It used to be hardcoded to panter's gitlab,
|
|
@@ -79,6 +79,19 @@ trigger cronjob
|
|
|
79
79
|
- `namespace` (positional): kubernetes namespace
|
|
80
80
|
- `--job-name <value>`: Which cronjob?
|
|
81
81
|
|
|
82
|
+
## `catladder mr pin [mr]`
|
|
83
|
+
|
|
84
|
+
pin the review apps of a merge request (disable their auto-stop) by adding the pin label; merging or closing the MR still stops them
|
|
85
|
+
|
|
86
|
+
- `mr` (positional): merge request IID (defaults to the open MR of the current branch)
|
|
87
|
+
- `--pipeline`: trigger a merge-request pipeline so the pin takes effect immediately
|
|
88
|
+
|
|
89
|
+
## `catladder mr unpin [mr]`
|
|
90
|
+
|
|
91
|
+
unpin the review apps of a merge request — the auto-stop timer re-arms with the next deploy
|
|
92
|
+
|
|
93
|
+
- `mr` (positional): merge request IID (defaults to the open MR of the current branch)
|
|
94
|
+
|
|
82
95
|
## `catladder project ci job-log`
|
|
83
96
|
|
|
84
97
|
Show a job's log
|
|
@@ -46,6 +46,13 @@ is `auto`.** Set per component or per environment (`env.<name>.deploy`).
|
|
|
46
46
|
`waitFor: ["otherComponent"]` (experimental) makes a deploy wait for
|
|
47
47
|
another component to deploy first.
|
|
48
48
|
|
|
49
|
+
## Environment lifetimes
|
|
50
|
+
|
|
51
|
+
Review apps auto-stop after 1 week, dev environments after 4 weeks
|
|
52
|
+
(GitLab only — configure with top-level `autoStop` in `catladder.ts`).
|
|
53
|
+
Pin an MR's review apps with `yarn catladder mr pin` — see the
|
|
54
|
+
`catladder-pipelines` skill.
|
|
55
|
+
|
|
49
56
|
## Kubernetes essentials
|
|
50
57
|
|
|
51
58
|
`cluster` is required: `{ type: "gcloud", name, projectId, region, domainCanonical? }`.
|
|
@@ -167,8 +167,13 @@ A safe order:
|
|
|
167
167
|
against the old vault (unset values show as `🚨 FILL ME`)
|
|
168
168
|
2. switch `secrets.vault` in `catladder.ts`, `yarn catenv`
|
|
169
169
|
3. `yarn catladder project secrets-push <env>: --file /tmp/secrets.yml`
|
|
170
|
-
4. `yarn catladder project
|
|
171
|
-
|
|
170
|
+
4. `yarn catladder project setup` — the *provisioned* credentials (the
|
|
171
|
+
gcloud deploy service account key, the kubernetes deploy
|
|
172
|
+
credentials) are hidden keys and therefore not part of the document
|
|
173
|
+
the pull/push round trip moves; setup re-provisions them into the
|
|
174
|
+
new vault
|
|
175
|
+
5. `yarn catladder project doctor`, then delete the temp file
|
|
176
|
+
6. only now decommission the GitLab project
|
|
172
177
|
|
|
173
178
|
Never commit the intermediate file, and see the `catladder-secrets`
|
|
174
179
|
skill for the exact command surface.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: catladder-pipelines
|
|
3
|
-
description: Understanding and debugging the CI/CD pipelines catladder generates (GitLab CI and GitHub Actions) — pipeline triggers, stages, environments, caching, job images, releases, and infrastructure drift. Use when investigating failing CI jobs, when asked why/when a job runs, when changing caching or job behavior, or when
|
|
3
|
+
description: Understanding and debugging the CI/CD pipelines catladder generates (GitLab CI and GitHub Actions) — pipeline triggers, stages, environments, caching, job images, releases, and infrastructure drift. Use when investigating failing CI jobs, when asked why/when a job runs, when changing caching or job behavior, when deployments misbehave, or when a review app stopped/expired or should be kept alive (pinning). Triggers on "pipeline", "CI job", "gitlab-ci", "workflow", "deploy failed", "cache", "release", "auto-stop", "review app stopped", "pin review app", "keep review app".
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# How catladder pipelines work
|
|
@@ -37,6 +37,32 @@ Generated layout:
|
|
|
37
37
|
Stages: setup → test → build → deploy → verify (post-deploy checks),
|
|
38
38
|
plus stop jobs for review-app teardown.
|
|
39
39
|
|
|
40
|
+
## Review-app auto-stop and pinning (GitLab)
|
|
41
|
+
|
|
42
|
+
GitLab review environments stop automatically after 1 week, dev
|
|
43
|
+
environments after 4 weeks. Configure with top-level `autoStop` in
|
|
44
|
+
`catladder.ts` (`{ review, dev }`, gitlab natural language like
|
|
45
|
+
`"3 days"` or `"never"`). Merging or closing the MR always stops its
|
|
46
|
+
review apps, independent of the timer.
|
|
47
|
+
|
|
48
|
+
To keep an MR's review apps alive longer, pin the MR:
|
|
49
|
+
|
|
50
|
+
- `yarn catladder mr pin` — adds the pin label (default
|
|
51
|
+
`catladder::pin-review`, configurable via `autoStop.pinLabel`) to the
|
|
52
|
+
current branch's open MR and triggers a pipeline so the pin takes
|
|
53
|
+
effect immediately. While the label is set, ALL components' review
|
|
54
|
+
apps deploy with `auto_stop_in: never`.
|
|
55
|
+
- `yarn catladder mr unpin` — removes the label; the auto-stop timer
|
|
56
|
+
re-arms with the next deploy.
|
|
57
|
+
|
|
58
|
+
The pin lives on the MR (a label), not on the environment, so it
|
|
59
|
+
survives redeploys — unlike gitlab's per-environment pin button, which
|
|
60
|
+
the next successful deploy resets. Adding/removing the label by hand
|
|
61
|
+
works too; a label change takes effect from the MR's next pipeline.
|
|
62
|
+
|
|
63
|
+
GitHub has no auto-stop: review apps run until the pull request is
|
|
64
|
+
closed (pinning does not apply there).
|
|
65
|
+
|
|
40
66
|
## Job images and catci
|
|
41
67
|
|
|
42
68
|
Jobs run in catladder-provided images (`🐳 catladder image <name>` build
|