@catladder/cli 0.0.0-next-8cc9134a → 0.0.0-next-78d43d4a
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/bundles/catenv/index.js +11 -0
- package/dist/bundles/cli/index.js +11 -0
- package/dist/bundles/runner-images/kubernetes/scripts/kubernetesCreateSecret +15 -3
- package/dist/bundles/skills/catladder-migrate-ci-backend/SKILL.md +34 -10
- package/dist/packages/pipeline/src/backends/github/ciVariables.js +3 -0
- package/dist/packages/pipeline/src/backends/github/ciVariables.js.map +1 -1
- package/dist/packages/pipeline/src/backends/gitlab/ciVariables.js +1 -0
- package/dist/packages/pipeline/src/backends/gitlab/ciVariables.js.map +1 -1
- package/dist/packages/pipeline/src/bash/ciVariables.d.ts +1 -1
- package/dist/packages/pipeline/src/bash/ciVariables.js.map +1 -1
- package/dist/packages/pipeline/src/deploy/kubernetes/deployJob.js +7 -0
- package/dist/packages/pipeline/src/deploy/kubernetes/deployJob.js.map +1 -1
- package/dist/runner-images/kubernetes/scripts/kubernetesCreateSecret +15 -3
- package/dist/skills/catladder-migrate-ci-backend/SKILL.md +34 -10
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -2658,6 +2658,9 @@ exports.GITHUB_CI_VARIABLES = {
|
|
|
2658
2658
|
registry: "CL_REGISTRY",
|
|
2659
2659
|
registryImage: "CL_REGISTRY_IMAGE",
|
|
2660
2660
|
registryUser: "CL_REGISTRY_USER",
|
|
2661
|
+
// github has no separate registry password: ghcr authenticates with
|
|
2662
|
+
// the workflow token, the same one CL_JOB_TOKEN carries
|
|
2663
|
+
registryPassword: "CL_JOB_TOKEN",
|
|
2661
2664
|
};
|
|
2662
2665
|
/**
|
|
2663
2666
|
* the workflow-level env the backend injects to provide the CL_*
|
|
@@ -3788,6 +3791,7 @@ exports.GITLAB_CI_VARIABLES = {
|
|
|
3788
3791
|
registry: "CI_REGISTRY",
|
|
3789
3792
|
registryImage: "CI_REGISTRY_IMAGE",
|
|
3790
3793
|
registryUser: "CI_REGISTRY_USER",
|
|
3794
|
+
registryPassword: "CI_REGISTRY_PASSWORD",
|
|
3791
3795
|
};
|
|
3792
3796
|
//# sourceMappingURL=ciVariables.js.map
|
|
3793
3797
|
|
|
@@ -9746,6 +9750,7 @@ exports.createKubernetesCloudsqlBaseValues = createKubernetesCloudsqlBaseValues;
|
|
|
9746
9750
|
|
|
9747
9751
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
9748
9752
|
exports.createKubernetesDeployJobs = void 0;
|
|
9753
|
+
const ciVariables_1 = __nccwpck_require__(72700);
|
|
9749
9754
|
const getEnvironmentVariables_1 = __nccwpck_require__(44776);
|
|
9750
9755
|
const runner_1 = __nccwpck_require__(71065);
|
|
9751
9756
|
const base_1 = __nccwpck_require__(93664);
|
|
@@ -9778,6 +9783,12 @@ const createKubernetesDeployJobs = (context) => {
|
|
|
9778
9783
|
RELEASE_NAME: context.environment.fullName,
|
|
9779
9784
|
HELM_EXPERIMENTAL_OCI: "1",
|
|
9780
9785
|
KUBE_DOCKER_IMAGE_PULL_SECRET: `gitlab-registry-${context.name}`,
|
|
9786
|
+
// credentials for the image pull secret kubernetesCreateSecret
|
|
9787
|
+
// writes into the namespace. Resolved per backend (gitlab: the
|
|
9788
|
+
// registry user + password, github: the actor + workflow token)
|
|
9789
|
+
// so the script itself stays backend-agnostic.
|
|
9790
|
+
DOCKER_REGISTRY_USER: (0, ciVariables_1.getCiVariable)(context, "registryUser"),
|
|
9791
|
+
DOCKER_REGISTRY_PASSWORD: (0, ciVariables_1.getCiVariable)(context, "registryPassword"),
|
|
9781
9792
|
HELM_GITLAB_CHART_NAME: (_b = deployConfig.chartName) !== null && _b !== void 0 ? _b : "/helm-charts/the-panter-chart",
|
|
9782
9793
|
HELM_ARGS: [
|
|
9783
9794
|
...(deployConfig.debug ? ["--debug"] : []),
|
|
@@ -8651,6 +8651,9 @@ exports.GITHUB_CI_VARIABLES = {
|
|
|
8651
8651
|
registry: "CL_REGISTRY",
|
|
8652
8652
|
registryImage: "CL_REGISTRY_IMAGE",
|
|
8653
8653
|
registryUser: "CL_REGISTRY_USER",
|
|
8654
|
+
// github has no separate registry password: ghcr authenticates with
|
|
8655
|
+
// the workflow token, the same one CL_JOB_TOKEN carries
|
|
8656
|
+
registryPassword: "CL_JOB_TOKEN",
|
|
8654
8657
|
};
|
|
8655
8658
|
/**
|
|
8656
8659
|
* the workflow-level env the backend injects to provide the CL_*
|
|
@@ -9781,6 +9784,7 @@ exports.GITLAB_CI_VARIABLES = {
|
|
|
9781
9784
|
registry: "CI_REGISTRY",
|
|
9782
9785
|
registryImage: "CI_REGISTRY_IMAGE",
|
|
9783
9786
|
registryUser: "CI_REGISTRY_USER",
|
|
9787
|
+
registryPassword: "CI_REGISTRY_PASSWORD",
|
|
9784
9788
|
};
|
|
9785
9789
|
//# sourceMappingURL=ciVariables.js.map
|
|
9786
9790
|
|
|
@@ -15739,6 +15743,7 @@ exports.createKubernetesCloudsqlBaseValues = createKubernetesCloudsqlBaseValues;
|
|
|
15739
15743
|
|
|
15740
15744
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
15741
15745
|
exports.createKubernetesDeployJobs = void 0;
|
|
15746
|
+
const ciVariables_1 = __nccwpck_require__(72700);
|
|
15742
15747
|
const getEnvironmentVariables_1 = __nccwpck_require__(44776);
|
|
15743
15748
|
const runner_1 = __nccwpck_require__(71065);
|
|
15744
15749
|
const base_1 = __nccwpck_require__(93664);
|
|
@@ -15771,6 +15776,12 @@ const createKubernetesDeployJobs = (context) => {
|
|
|
15771
15776
|
RELEASE_NAME: context.environment.fullName,
|
|
15772
15777
|
HELM_EXPERIMENTAL_OCI: "1",
|
|
15773
15778
|
KUBE_DOCKER_IMAGE_PULL_SECRET: `gitlab-registry-${context.name}`,
|
|
15779
|
+
// credentials for the image pull secret kubernetesCreateSecret
|
|
15780
|
+
// writes into the namespace. Resolved per backend (gitlab: the
|
|
15781
|
+
// registry user + password, github: the actor + workflow token)
|
|
15782
|
+
// so the script itself stays backend-agnostic.
|
|
15783
|
+
DOCKER_REGISTRY_USER: (0, ciVariables_1.getCiVariable)(context, "registryUser"),
|
|
15784
|
+
DOCKER_REGISTRY_PASSWORD: (0, ciVariables_1.getCiVariable)(context, "registryPassword"),
|
|
15774
15785
|
HELM_GITLAB_CHART_NAME: (_b = deployConfig.chartName) !== null && _b !== void 0 ? _b : "/helm-charts/the-panter-chart",
|
|
15775
15786
|
HELM_ARGS: [
|
|
15776
15787
|
...(deployConfig.debug ? ["--debug"] : []),
|
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
set -e
|
|
3
3
|
|
|
4
|
+
# The credentials come from DOCKER_REGISTRY_USER / DOCKER_REGISTRY_PASSWORD,
|
|
5
|
+
# which the deploy job resolves per CI backend (gitlab: CI_REGISTRY_USER +
|
|
6
|
+
# CI_REGISTRY_PASSWORD, github: the actor + workflow token) — the raw
|
|
7
|
+
# gitlab names used to be hardcoded here, which left the secret without
|
|
8
|
+
# credentials on the github backend.
|
|
9
|
+
#
|
|
10
|
+
# Both of those are job-scoped and expire with the pipeline: the initial
|
|
11
|
+
# pull works, but a pod rescheduled later can no longer re-pull. Projects
|
|
12
|
+
# that need durable pulls declare long-lived registry credentials as
|
|
13
|
+
# secrets named CI_DEPLOY_USER / CI_DEPLOY_PASSWORD, which win here.
|
|
14
|
+
#
|
|
15
|
+
# --docker-email is deliberately gone: it is optional for a
|
|
16
|
+
# docker-registry secret and its only source was $GITLAB_USER_EMAIL.
|
|
4
17
|
echo "KUBE_NAMESPACE: '$KUBE_NAMESPACE', KUBE_DOCKER_IMAGE_PULL_SECRET: '$KUBE_DOCKER_IMAGE_PULL_SECRET'"
|
|
5
18
|
kubectl create secret -n "$KUBE_NAMESPACE" \
|
|
6
19
|
docker-registry $KUBE_DOCKER_IMAGE_PULL_SECRET \
|
|
7
20
|
--docker-server="$DOCKER_REGISTRY" \
|
|
8
|
-
--docker-username="${CI_DEPLOY_USER:-$
|
|
9
|
-
--docker-password="${CI_DEPLOY_PASSWORD:-$
|
|
10
|
-
--docker-email="$GITLAB_USER_EMAIL" \
|
|
21
|
+
--docker-username="${CI_DEPLOY_USER:-$DOCKER_REGISTRY_USER}" \
|
|
22
|
+
--docker-password="${CI_DEPLOY_PASSWORD:-$DOCKER_REGISTRY_PASSWORD}" \
|
|
11
23
|
-o yaml --dry-run | kubectl replace -n "$KUBE_NAMESPACE" --force -f -
|
|
@@ -193,16 +193,40 @@ See the `catladder-releases` skill for how the release jobs differ
|
|
|
193
193
|
|
|
194
194
|
## Step 7 — registry and the first run
|
|
195
195
|
|
|
196
|
-
The
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
196
|
+
The **job images** (the catladder runner images) always live in the CI
|
|
197
|
+
system's own registry, so they change host with the backend:
|
|
198
|
+
`$CI_REGISTRY_IMAGE` on GitLab, `ghcr.io/<owner>/<repo>` on GitHub. The
|
|
199
|
+
first pipeline on the new backend therefore **rebuilds every job image**
|
|
200
|
+
— it will be slow, and that is expected, not a bug.
|
|
201
|
+
|
|
202
|
+
Where the **app image** goes depends on the deploy type:
|
|
203
|
+
|
|
204
|
+
- **`google-cloudrun`** — the image goes to Google Artifact Registry
|
|
205
|
+
(`<region>-docker.pkg.dev/<projectId>/catladder-deploy/…`) on both
|
|
206
|
+
backends. Cloud Run can only pull from AR/GCR, so a backend migration
|
|
207
|
+
does not move the app image at all. Nothing to do here.
|
|
208
|
+
- **`kubernetes`** — the app image lives in the CI registry and does
|
|
209
|
+
move. catladder handles the pull itself: every deploy runs
|
|
210
|
+
`kubernetesCreateSecret`, which writes a `docker-registry` secret
|
|
211
|
+
(`gitlab-registry-<component>`) into the namespace, and the chart wires
|
|
212
|
+
it in as `imagePullSecrets`. Note the secret keeps its historical name
|
|
213
|
+
on both backends.
|
|
214
|
+
|
|
215
|
+
The credential behind that secret differs per backend, and this is the
|
|
216
|
+
one thing to raise before a kubernetes component moves to GitHub:
|
|
217
|
+
|
|
218
|
+
- **GitLab** provisions a durable one automatically —
|
|
219
|
+
`catladder project setup` creates a `gitlab-deploy-token` (scope
|
|
220
|
+
`read_registry`), GitLab exposes it to jobs as `CI_DEPLOY_USER` /
|
|
221
|
+
`CI_DEPLOY_PASSWORD`, and `project doctor` fails when it is missing.
|
|
222
|
+
- **GitHub has no equivalent.** The deploy falls back to the workflow
|
|
223
|
+
token, which expires with the run: the initial pull succeeds and the
|
|
224
|
+
job goes green, but a pod rescheduled later cannot re-pull —
|
|
225
|
+
`ImagePullBackOff` weeks after a deploy that looked fine. Until that
|
|
226
|
+
is solved (catladder issue #75), a project moving kubernetes to GitHub
|
|
227
|
+
must supply a long-lived registry credential itself, declared as
|
|
228
|
+
secrets named `CI_DEPLOY_USER` / `CI_DEPLOY_PASSWORD` (a PAT with
|
|
229
|
+
`read:packages`), which take precedence in the deploy.
|
|
206
230
|
|
|
207
231
|
## Step 8 — run both, compare, then cut over
|
|
208
232
|
|
|
@@ -15,6 +15,9 @@ exports.GITHUB_CI_VARIABLES = {
|
|
|
15
15
|
registry: "CL_REGISTRY",
|
|
16
16
|
registryImage: "CL_REGISTRY_IMAGE",
|
|
17
17
|
registryUser: "CL_REGISTRY_USER",
|
|
18
|
+
// github has no separate registry password: ghcr authenticates with
|
|
19
|
+
// the workflow token, the same one CL_JOB_TOKEN carries
|
|
20
|
+
registryPassword: "CL_JOB_TOKEN",
|
|
18
21
|
};
|
|
19
22
|
/**
|
|
20
23
|
* the workflow-level env the backend injects to provide the CL_*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ciVariables.js","sourceRoot":"","sources":["../../../../../../../../packages/pipeline/src/backends/github/ciVariables.ts"],"names":[],"mappings":";;;AAEA;;;;;;GAMG;AACU,QAAA,mBAAmB,GAAmC;IACjE,SAAS,EAAE,YAAY;IACvB,QAAQ,EAAE,cAAc;IACxB,QAAQ,EAAE,cAAc;IACxB,QAAQ,EAAE,aAAa;IACvB,aAAa,EAAE,mBAAmB;IAClC,YAAY,EAAE,kBAAkB;CACjC,CAAC;AAEF;;;GAGG;AACU,QAAA,4BAA4B,GAA2B;IAClE,YAAY,EAAE,qBAAqB;IACnC,WAAW,EAAE,SAAS;IACtB,iBAAiB,EAAE,kCAAkC;IACrD,gBAAgB,EAAE,qBAAqB;IACvC,uCAAuC;IACvC,YAAY,EAAE,4BAA4B;CAC3C,CAAC"}
|
|
1
|
+
{"version":3,"file":"ciVariables.js","sourceRoot":"","sources":["../../../../../../../../packages/pipeline/src/backends/github/ciVariables.ts"],"names":[],"mappings":";;;AAEA;;;;;;GAMG;AACU,QAAA,mBAAmB,GAAmC;IACjE,SAAS,EAAE,YAAY;IACvB,QAAQ,EAAE,cAAc;IACxB,QAAQ,EAAE,cAAc;IACxB,QAAQ,EAAE,aAAa;IACvB,aAAa,EAAE,mBAAmB;IAClC,YAAY,EAAE,kBAAkB;IAChC,oEAAoE;IACpE,wDAAwD;IACxD,gBAAgB,EAAE,cAAc;CACjC,CAAC;AAEF;;;GAGG;AACU,QAAA,4BAA4B,GAA2B;IAClE,YAAY,EAAE,qBAAqB;IACnC,WAAW,EAAE,SAAS;IACtB,iBAAiB,EAAE,kCAAkC;IACrD,gBAAgB,EAAE,qBAAqB;IACvC,uCAAuC;IACvC,YAAY,EAAE,4BAA4B;CAC3C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ciVariables.js","sourceRoot":"","sources":["../../../../../../../../packages/pipeline/src/backends/gitlab/ciVariables.ts"],"names":[],"mappings":";;;AAEA;;;GAGG;AACU,QAAA,mBAAmB,GAAmC;IACjE,SAAS,EAAE,eAAe;IAC1B,QAAQ,EAAE,cAAc;IACxB,QAAQ,EAAE,cAAc;IACxB,QAAQ,EAAE,aAAa;IACvB,aAAa,EAAE,mBAAmB;IAClC,YAAY,EAAE,kBAAkB;
|
|
1
|
+
{"version":3,"file":"ciVariables.js","sourceRoot":"","sources":["../../../../../../../../packages/pipeline/src/backends/gitlab/ciVariables.ts"],"names":[],"mappings":";;;AAEA;;;GAGG;AACU,QAAA,mBAAmB,GAAmC;IACjE,SAAS,EAAE,eAAe;IAC1B,QAAQ,EAAE,cAAc;IACxB,QAAQ,EAAE,cAAc;IACxB,QAAQ,EAAE,aAAa;IACvB,aAAa,EAAE,mBAAmB;IAClC,YAAY,EAAE,kBAAkB;IAChC,gBAAgB,EAAE,sBAAsB;CACzC,CAAC"}
|
|
@@ -6,7 +6,7 @@ import { BashExpression } from "../../../bash/src/index.js";
|
|
|
6
6
|
* of hardcoding e.g. gitlab's `$CI_*` variables, so that other pipeline
|
|
7
7
|
* types can map them to their own predefined variables.
|
|
8
8
|
*/
|
|
9
|
-
export type CiVariableName = "commitSha" | "jobToken" | "jobImage" | "registry" | "registryImage" | "registryUser";
|
|
9
|
+
export type CiVariableName = "commitSha" | "jobToken" | "jobImage" | "registry" | "registryImage" | "registryUser" | "registryPassword";
|
|
10
10
|
/**
|
|
11
11
|
* resolves a platform-neutral CI variable to a bash expression for the
|
|
12
12
|
* pipeline type of the given context.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ciVariables.js","sourceRoot":"","sources":["../../../../../../../packages/pipeline/src/bash/ciVariables.ts"],"names":[],"mappings":";;;AAAA,gEAAqE;AACrE,gEAAqE;AAErE,0CAAiD;
|
|
1
|
+
{"version":3,"file":"ciVariables.js","sourceRoot":"","sources":["../../../../../../../packages/pipeline/src/bash/ciVariables.ts"],"names":[],"mappings":";;;AAAA,gEAAqE;AACrE,gEAAqE;AAErE,0CAAiD;AAiBjD,MAAM,8BAA8B,GAEhC;IACF,MAAM,EAAE,iCAAmB;IAC3B,MAAM,EAAE,iCAAmB;CAC5B,CAAC;AAEF;;;GAGG;AACI,MAAM,aAAa,GAAG,CAC3B,OAAwC,EACxC,IAAoB,EACJ,EAAE;;IAClB,sEAAsE;IACtE,qEAAqE;IACrE,MAAM,YAAY,GAAG,MAAA,OAAO,CAAC,YAAY,mCAAI,QAAQ,CAAC;IACtD,OAAO,IAAI,qBAAc,CACvB,IAAI,8BAA8B,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,EAAE,CACzD,CAAC;AACJ,CAAC,CAAC;AAVW,QAAA,aAAa,iBAUxB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createKubernetesDeployJobs = void 0;
|
|
4
|
+
const ciVariables_1 = require("../../bash/ciVariables");
|
|
4
5
|
const getEnvironmentVariables_1 = require("../../context/getEnvironmentVariables");
|
|
5
6
|
const runner_1 = require("../../runner");
|
|
6
7
|
const base_1 = require("../base");
|
|
@@ -33,6 +34,12 @@ const createKubernetesDeployJobs = (context) => {
|
|
|
33
34
|
RELEASE_NAME: context.environment.fullName,
|
|
34
35
|
HELM_EXPERIMENTAL_OCI: "1",
|
|
35
36
|
KUBE_DOCKER_IMAGE_PULL_SECRET: `gitlab-registry-${context.name}`,
|
|
37
|
+
// credentials for the image pull secret kubernetesCreateSecret
|
|
38
|
+
// writes into the namespace. Resolved per backend (gitlab: the
|
|
39
|
+
// registry user + password, github: the actor + workflow token)
|
|
40
|
+
// so the script itself stays backend-agnostic.
|
|
41
|
+
DOCKER_REGISTRY_USER: (0, ciVariables_1.getCiVariable)(context, "registryUser"),
|
|
42
|
+
DOCKER_REGISTRY_PASSWORD: (0, ciVariables_1.getCiVariable)(context, "registryPassword"),
|
|
36
43
|
HELM_GITLAB_CHART_NAME: (_b = deployConfig.chartName) !== null && _b !== void 0 ? _b : "/helm-charts/the-panter-chart",
|
|
37
44
|
HELM_ARGS: [
|
|
38
45
|
...(deployConfig.debug ? ["--debug"] : []),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deployJob.js","sourceRoot":"","sources":["../../../../../../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AAC,IAAI;SAC7B;KACF,CAAC;IAEF,MAAM,WAAW,GAAG,QAAQ,OAAO,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;IAC3D,MAAM,cAAc,GAAG;QACrB,+BAA+B,WAAW,gBAAgB,IAAA,oDAA0B,EAClF,OAAO,EACP,UAAU,CACX,qCAAqC,IAAA,oDAA0B,EAC9D,OAAO,EACP,aAAa,CACd,kCAAkC;QACnC,mCAAmC,WAAW,eAAe,IAAA,oDAA0B,EACrF,OAAO,EACP,YAAY,CACb,GAAG;QACJ,+BAA+B,WAAW,gBAAgB,WAAW,aAAa,WAAW,kBAAkB,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,cAAc,GAAG;QAC5J,+BAA+B,WAAW,GAAG;KAC9C,CAAC;IAEF,OAAO,IAAA,4BAAqB,EAAC,OAAO,EAAE;QACpC,MAAM,EAAE;YACN,GAAG,MAAM;YACT,MAAM,EAAE;gBACN,GAAG,cAAc;gBACjB,GAAG,IAAA,4BAAmB,EACpB,gBAAgB,EAChB,QAAQ,GAAG,eAAe,GAAG,sBAAsB,CACpD,CACC,IAAA,gCAAyB,EAAC,IAAA,6BAAgB,EAAC,OAAO,CAAC,EAAE,eAAe,CAAC,CACtE;gBACD,wBAAwB;gBACxB,kBAAkB;gBAElB,+BAA+B;aAChC;SACF;QACD,IAAI,EAAE;YACJ,GAAG,MAAM;YACT,MAAM,EAAE,CAAC,GAAG,cAAc,EAAE,kBAAkB,CAAC;SAChD;QACD,QAAQ,EAAE;YACR,GAAG,MAAM;YACT,MAAM,EAAE,CAAC,GAAG,cAAc,EAAE,oBAAoB,CAAC;SAClD;KACF,CAAC,CAAC;AACL,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"deployJob.js","sourceRoot":"","sources":["../../../../../../../../packages/pipeline/src/deploy/kubernetes/deployJob.ts"],"names":[],"mappings":";;;AAAA,wDAAuD;AACvD,mFAAmF;AACnF,yCAA8C;AAG9C,kCAAgD;AAEhD,oCAA0C;AA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
|
|
4
|
+
# The credentials come from DOCKER_REGISTRY_USER / DOCKER_REGISTRY_PASSWORD,
|
|
5
|
+
# which the deploy job resolves per CI backend (gitlab: CI_REGISTRY_USER +
|
|
6
|
+
# CI_REGISTRY_PASSWORD, github: the actor + workflow token) — the raw
|
|
7
|
+
# gitlab names used to be hardcoded here, which left the secret without
|
|
8
|
+
# credentials on the github backend.
|
|
9
|
+
#
|
|
10
|
+
# Both of those are job-scoped and expire with the pipeline: the initial
|
|
11
|
+
# pull works, but a pod rescheduled later can no longer re-pull. Projects
|
|
12
|
+
# that need durable pulls declare long-lived registry credentials as
|
|
13
|
+
# secrets named CI_DEPLOY_USER / CI_DEPLOY_PASSWORD, which win here.
|
|
14
|
+
#
|
|
15
|
+
# --docker-email is deliberately gone: it is optional for a
|
|
16
|
+
# docker-registry secret and its only source was $GITLAB_USER_EMAIL.
|
|
4
17
|
echo "KUBE_NAMESPACE: '$KUBE_NAMESPACE', KUBE_DOCKER_IMAGE_PULL_SECRET: '$KUBE_DOCKER_IMAGE_PULL_SECRET'"
|
|
5
18
|
kubectl create secret -n "$KUBE_NAMESPACE" \
|
|
6
19
|
docker-registry $KUBE_DOCKER_IMAGE_PULL_SECRET \
|
|
7
20
|
--docker-server="$DOCKER_REGISTRY" \
|
|
8
|
-
--docker-username="${CI_DEPLOY_USER:-$
|
|
9
|
-
--docker-password="${CI_DEPLOY_PASSWORD:-$
|
|
10
|
-
--docker-email="$GITLAB_USER_EMAIL" \
|
|
21
|
+
--docker-username="${CI_DEPLOY_USER:-$DOCKER_REGISTRY_USER}" \
|
|
22
|
+
--docker-password="${CI_DEPLOY_PASSWORD:-$DOCKER_REGISTRY_PASSWORD}" \
|
|
11
23
|
-o yaml --dry-run | kubectl replace -n "$KUBE_NAMESPACE" --force -f -
|
|
@@ -193,16 +193,40 @@ See the `catladder-releases` skill for how the release jobs differ
|
|
|
193
193
|
|
|
194
194
|
## Step 7 — registry and the first run
|
|
195
195
|
|
|
196
|
-
The
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
196
|
+
The **job images** (the catladder runner images) always live in the CI
|
|
197
|
+
system's own registry, so they change host with the backend:
|
|
198
|
+
`$CI_REGISTRY_IMAGE` on GitLab, `ghcr.io/<owner>/<repo>` on GitHub. The
|
|
199
|
+
first pipeline on the new backend therefore **rebuilds every job image**
|
|
200
|
+
— it will be slow, and that is expected, not a bug.
|
|
201
|
+
|
|
202
|
+
Where the **app image** goes depends on the deploy type:
|
|
203
|
+
|
|
204
|
+
- **`google-cloudrun`** — the image goes to Google Artifact Registry
|
|
205
|
+
(`<region>-docker.pkg.dev/<projectId>/catladder-deploy/…`) on both
|
|
206
|
+
backends. Cloud Run can only pull from AR/GCR, so a backend migration
|
|
207
|
+
does not move the app image at all. Nothing to do here.
|
|
208
|
+
- **`kubernetes`** — the app image lives in the CI registry and does
|
|
209
|
+
move. catladder handles the pull itself: every deploy runs
|
|
210
|
+
`kubernetesCreateSecret`, which writes a `docker-registry` secret
|
|
211
|
+
(`gitlab-registry-<component>`) into the namespace, and the chart wires
|
|
212
|
+
it in as `imagePullSecrets`. Note the secret keeps its historical name
|
|
213
|
+
on both backends.
|
|
214
|
+
|
|
215
|
+
The credential behind that secret differs per backend, and this is the
|
|
216
|
+
one thing to raise before a kubernetes component moves to GitHub:
|
|
217
|
+
|
|
218
|
+
- **GitLab** provisions a durable one automatically —
|
|
219
|
+
`catladder project setup` creates a `gitlab-deploy-token` (scope
|
|
220
|
+
`read_registry`), GitLab exposes it to jobs as `CI_DEPLOY_USER` /
|
|
221
|
+
`CI_DEPLOY_PASSWORD`, and `project doctor` fails when it is missing.
|
|
222
|
+
- **GitHub has no equivalent.** The deploy falls back to the workflow
|
|
223
|
+
token, which expires with the run: the initial pull succeeds and the
|
|
224
|
+
job goes green, but a pod rescheduled later cannot re-pull —
|
|
225
|
+
`ImagePullBackOff` weeks after a deploy that looked fine. Until that
|
|
226
|
+
is solved (catladder issue #75), a project moving kubernetes to GitHub
|
|
227
|
+
must supply a long-lived registry credential itself, declared as
|
|
228
|
+
secrets named `CI_DEPLOY_USER` / `CI_DEPLOY_PASSWORD` (a PAT with
|
|
229
|
+
`read:packages`), which take precedence in the deploy.
|
|
206
230
|
|
|
207
231
|
## Step 8 — run both, compare, then cut over
|
|
208
232
|
|