@catladder/cli 1.141.0 → 1.142.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/package.json CHANGED
@@ -52,7 +52,7 @@
52
52
  }
53
53
  ],
54
54
  "license": "MIT",
55
- "version": "1.141.0",
55
+ "version": "1.142.0",
56
56
  "scripts": {
57
57
  "lint": "eslint \"src/**/*.ts\"",
58
58
  "lint:fix": "eslint \"src/**/*.ts\" --fix",
@@ -74,7 +74,7 @@
74
74
  "ts-node": "^10.9.1"
75
75
  },
76
76
  "devDependencies": {
77
- "@catladder/pipeline": "1.141.0",
77
+ "@catladder/pipeline": "1.142.0",
78
78
  "@gitbeaker/rest": "^39.28.0",
79
79
  "@kubernetes/client-node": "^0.16.2",
80
80
  "@tsconfig/node14": "^1.0.1",
@@ -55,30 +55,4 @@ export const setupAccessTokens = async (instance: CommandInstance) => {
55
55
  "POST"
56
56
  );
57
57
  }
58
-
59
- const deploy_tokens = await doGitlabRequest(
60
- instance,
61
- `projects/${projectId}/deploy_tokens`
62
- );
63
-
64
- if (
65
- !deploy_tokens.find(
66
- (v: { name: string }) => v.name === "gitlab-deploy-token"
67
- )
68
- ) {
69
- instance.log(
70
- "I will setup the 'GitLab Deploy Token', so Kubernetes can pull images from this project."
71
- );
72
-
73
- await doGitlabRequest(
74
- instance,
75
- `projects/${projectId}/deploy_tokens`,
76
- {
77
- id: projectId,
78
- name: "gitlab-deploy-token",
79
- scopes: ["read_registry"],
80
- },
81
- "POST"
82
- );
83
- }
84
58
  };
@@ -6,7 +6,11 @@ import {
6
6
  import type { CommandInstance } from "vorpal";
7
7
  import { exec } from "child-process-promise";
8
8
  import { connectToCluster } from "../../../../../utils/cluster";
9
- import { upsertAllVariables } from "../../../../../utils/gitlab";
9
+ import {
10
+ doGitlabRequest,
11
+ getProjectInfo,
12
+ upsertAllVariables,
13
+ } from "../../../../../utils/gitlab";
10
14
  import ensureNamespace from "../utils/ensureNamespace";
11
15
 
12
16
  export const setupKubernetes = async (
@@ -18,6 +22,33 @@ export const setupKubernetes = async (
18
22
  throw new Error("cannot run setupKubernetes on non-kubernetes deployments");
19
23
  }
20
24
 
25
+ const { id: projectId } = await getProjectInfo(instance);
26
+ const deploy_tokens = await doGitlabRequest(
27
+ instance,
28
+ `projects/${projectId}/deploy_tokens`
29
+ );
30
+
31
+ if (
32
+ !deploy_tokens.find(
33
+ (v: { name: string }) => v.name === "gitlab-deploy-token"
34
+ )
35
+ ) {
36
+ instance.log(
37
+ "I will setup the 'GitLab Deploy Token', so Kubernetes can pull images from this project."
38
+ );
39
+
40
+ await doGitlabRequest(
41
+ instance,
42
+ `projects/${projectId}/deploy_tokens`,
43
+ {
44
+ id: projectId,
45
+ name: "gitlab-deploy-token",
46
+ scopes: ["read_registry"],
47
+ },
48
+ "POST"
49
+ );
50
+ }
51
+
21
52
  const fullName = getFullKubernetesClusterName(deployConfig.cluster);
22
53
  instance.log(`cluster: ${fullName}`);
23
54