@catladder/cli 0.0.0-refactor-docker-de6b3576 → 0.0.0-refactor-docker-c24f8608
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 +95 -75
- package/dist/bundles/cli/index.js +87 -63
- package/dist/cli/src/apps/catenv/catenv.js +8 -12
- package/dist/cli/src/apps/catenv/catenv.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/commandCloudSqlProxy.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/commandPortForward.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/setup/setupCloudRun.d.ts +2 -2
- package/dist/cli/src/apps/cli/commands/project/setup/setupCloudRun.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/setup/setupContext.d.ts +2 -2
- package/dist/cli/src/apps/cli/commands/project/setup/setupContext.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/setup/setupKubernetes.d.ts +2 -2
- package/dist/cli/src/apps/cli/commands/project/setup/setupKubernetes.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/utils/ensureNamespace.d.ts +2 -2
- package/dist/cli/src/apps/cli/commands/project/utils/ensureNamespace.js.map +1 -1
- package/dist/cli/src/config/getProjectConfig.d.ts +2 -2
- package/dist/cli/src/config/getProjectConfig.js +1 -1
- package/dist/cli/src/config/getProjectConfig.js.map +1 -1
- package/dist/cli/src/gcloud/cloudRun/openCloudRunDashboards.d.ts +2 -2
- package/dist/cli/src/gcloud/cloudRun/openCloudRunDashboards.js.map +1 -1
- package/dist/cli/src/gcloud/serviceAccounts.d.ts +2 -2
- package/dist/cli/src/gcloud/serviceAccounts.js.map +1 -1
- package/dist/cli/src/kubernetes/openKubernetesDashboards.d.ts +3 -3
- package/dist/cli/src/kubernetes/openKubernetesDashboards.js.map +1 -1
- package/dist/cli/src/utils/gitlab.d.ts +1 -1
- package/dist/cli/src/utils/gitlab.js +37 -24
- package/dist/cli/src/utils/gitlab.js.map +1 -1
- package/dist/pipeline/src/build/base/createAppBuildJob.d.ts +2 -2
- package/dist/pipeline/src/build/base/createAppBuildJob.js +1 -1
- package/dist/pipeline/src/build/base/createAppBuildJob.js.map +1 -1
- package/dist/pipeline/src/build/base/index.d.ts +2 -2
- package/dist/pipeline/src/build/base/index.js.map +1 -1
- package/dist/pipeline/src/build/base/writeBuildInfo.d.ts +2 -2
- package/dist/pipeline/src/build/base/writeBuildInfo.js.map +1 -1
- package/dist/pipeline/src/build/base/writeDotEnv.d.ts +2 -2
- package/dist/pipeline/src/build/base/writeDotEnv.js.map +1 -1
- package/dist/pipeline/src/build/custom/buildJob.d.ts +2 -2
- package/dist/pipeline/src/build/custom/buildJob.js.map +1 -1
- package/dist/pipeline/src/build/custom/index.d.ts +2 -2
- package/dist/pipeline/src/build/custom/index.js.map +1 -1
- package/dist/pipeline/src/build/custom/testJob.d.ts +2 -2
- package/dist/pipeline/src/build/custom/testJob.js.map +1 -1
- package/dist/pipeline/src/build/docker.d.ts +11 -11
- package/dist/pipeline/src/build/docker.js +5 -5
- package/dist/pipeline/src/build/docker.js.map +1 -1
- package/dist/pipeline/src/build/index.d.ts +2 -2
- package/dist/pipeline/src/build/node/buildJob.d.ts +2 -2
- package/dist/pipeline/src/build/node/buildJob.js +9 -7
- package/dist/pipeline/src/build/node/buildJob.js.map +1 -1
- package/dist/pipeline/src/build/node/cache.d.ts +5 -5
- package/dist/pipeline/src/build/node/cache.js +4 -4
- package/dist/pipeline/src/build/node/cache.js.map +1 -1
- package/dist/pipeline/src/build/node/index.d.ts +4 -4
- package/dist/pipeline/src/build/node/index.js.map +1 -1
- package/dist/pipeline/src/build/node/meteor.d.ts +2 -2
- package/dist/pipeline/src/build/node/meteor.js +2 -2
- package/dist/pipeline/src/build/node/meteor.js.map +1 -1
- package/dist/pipeline/src/build/node/testJob.d.ts +2 -2
- package/dist/pipeline/src/build/node/testJob.js +4 -4
- package/dist/pipeline/src/build/node/testJob.js.map +1 -1
- package/dist/pipeline/src/build/node/yarn.d.ts +4 -4
- package/dist/pipeline/src/build/node/yarn.js +1 -3
- package/dist/pipeline/src/build/node/yarn.js.map +1 -1
- package/dist/pipeline/src/build/rails/build.d.ts +2 -2
- package/dist/pipeline/src/build/rails/build.js.map +1 -1
- package/dist/pipeline/src/build/rails/index.d.ts +2 -2
- package/dist/pipeline/src/build/rails/index.js.map +1 -1
- package/dist/pipeline/src/build/rails/test.d.ts +2 -2
- package/dist/pipeline/src/build/rails/test.js.map +1 -1
- package/dist/pipeline/src/build/sbom.d.ts +2 -2
- package/dist/pipeline/src/build/sbom.js +2 -2
- package/dist/pipeline/src/build/sbom.js.map +1 -1
- package/dist/pipeline/src/context/getEnvironment.d.ts +2 -2
- package/dist/pipeline/src/context/getEnvironment.js.map +1 -1
- package/dist/pipeline/src/context/getEnvironmentContext.d.ts +2 -2
- package/dist/pipeline/src/context/getEnvironmentContext.js.map +1 -1
- package/dist/pipeline/src/context/getEnvironmentVariables.d.ts +4 -4
- package/dist/pipeline/src/context/getEnvironmentVariables.js.map +1 -1
- package/dist/pipeline/src/context/getLabels.d.ts +2 -2
- package/dist/pipeline/src/context/getLabels.js.map +1 -1
- package/dist/pipeline/src/context/index.d.ts +7 -3
- package/dist/pipeline/src/context/index.js +12 -3
- package/dist/pipeline/src/context/index.js.map +1 -1
- package/dist/pipeline/src/deploy/base/deploy.d.ts +2 -2
- package/dist/pipeline/src/deploy/base/deploy.js.map +1 -1
- package/dist/pipeline/src/deploy/base/index.d.ts +2 -2
- package/dist/pipeline/src/deploy/base/index.js.map +1 -1
- package/dist/pipeline/src/deploy/base/rollback.d.ts +2 -2
- package/dist/pipeline/src/deploy/base/rollback.js.map +1 -1
- package/dist/pipeline/src/deploy/base/stop.d.ts +2 -2
- package/dist/pipeline/src/deploy/base/stop.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/artifactsRegistry.d.ts +7 -7
- package/dist/pipeline/src/deploy/cloudRun/artifactsRegistry.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/cleanup.d.ts +2 -2
- package/dist/pipeline/src/deploy/cloudRun/cleanup.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/cloudRunRevisions.d.ts +2 -2
- package/dist/pipeline/src/deploy/cloudRun/cloudRunRevisions.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/cloudRunJobs.d.ts +6 -6
- package/dist/pipeline/src/deploy/cloudRun/createJobs/cloudRunJobs.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/cloudRunServices.d.ts +3 -3
- package/dist/pipeline/src/deploy/cloudRun/createJobs/cloudRunServices.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/common.d.ts +4 -4
- package/dist/pipeline/src/deploy/cloudRun/createJobs/common.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/getCloudRunDeployScripts.d.ts +2 -2
- package/dist/pipeline/src/deploy/cloudRun/createJobs/getCloudRunDeployScripts.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/getCloudRunStopScripts.d.ts +2 -2
- package/dist/pipeline/src/deploy/cloudRun/createJobs/getCloudRunStopScripts.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/index.d.ts +2 -2
- package/dist/pipeline/src/deploy/cloudRun/createJobs/index.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/utils/database.d.ts +3 -3
- package/dist/pipeline/src/deploy/cloudRun/utils/database.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/utils/gcloudServiceAccountLoginCommands.d.ts +2 -2
- package/dist/pipeline/src/deploy/cloudRun/utils/gcloudServiceAccountLoginCommands.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/utils/getServiceName.d.ts +2 -2
- package/dist/pipeline/src/deploy/cloudRun/utils/getServiceName.js.map +1 -1
- package/dist/pipeline/src/deploy/custom/deployJob.d.ts +2 -2
- package/dist/pipeline/src/deploy/custom/deployJob.js +3 -1
- package/dist/pipeline/src/deploy/custom/deployJob.js.map +1 -1
- package/dist/pipeline/src/deploy/dockerTag/deployJob.d.ts +2 -2
- package/dist/pipeline/src/deploy/dockerTag/deployJob.js.map +1 -1
- package/dist/pipeline/src/deploy/index.d.ts +2 -2
- package/dist/pipeline/src/deploy/kubernetes/cloudSql/index.d.ts +3 -3
- package/dist/pipeline/src/deploy/kubernetes/cloudSql/index.js.map +1 -1
- package/dist/pipeline/src/deploy/kubernetes/deployJob.d.ts +2 -2
- package/dist/pipeline/src/deploy/kubernetes/deployJob.js.map +1 -1
- package/dist/pipeline/src/deploy/kubernetes/kubeEnv.d.ts +2 -2
- package/dist/pipeline/src/deploy/kubernetes/kubeEnv.js.map +1 -1
- package/dist/pipeline/src/deploy/kubernetes/kubeValues.d.ts +2 -2
- package/dist/pipeline/src/deploy/kubernetes/kubeValues.js.map +1 -1
- package/dist/pipeline/src/deploy/kubernetes/mongodb.d.ts +2 -2
- package/dist/pipeline/src/deploy/kubernetes/mongodb.js.map +1 -1
- package/dist/pipeline/src/deploy/sbom.d.ts +4 -4
- package/dist/pipeline/src/deploy/sbom.js.map +1 -1
- package/dist/pipeline/src/deploy/utils.d.ts +2 -2
- package/dist/pipeline/src/deploy/utils.js.map +1 -1
- package/dist/pipeline/src/pipeline/createJobsForComponent.d.ts +2 -2
- package/dist/pipeline/src/pipeline/createJobsForComponent.js +1 -1
- package/dist/pipeline/src/pipeline/createJobsForComponent.js.map +1 -1
- package/dist/pipeline/src/pipeline/generatePipelineFiles.js +5 -5
- package/dist/pipeline/src/pipeline/generatePipelineFiles.js.map +1 -1
- package/dist/pipeline/src/pipeline/gitlab/createGitlabJobs.js.map +1 -1
- package/dist/pipeline/src/types/config.d.ts +2 -2
- package/dist/pipeline/src/types/context.d.ts +16 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/apps/catenv/catenv.ts +8 -7
- package/src/apps/cli/commands/project/commandCloudSqlProxy.ts +3 -3
- package/src/apps/cli/commands/project/commandPortForward.ts +5 -2
- package/src/apps/cli/commands/project/setup/setupCloudRun.ts +2 -2
- package/src/apps/cli/commands/project/setup/setupContext.ts +2 -2
- package/src/apps/cli/commands/project/setup/setupKubernetes.ts +2 -2
- package/src/apps/cli/commands/project/utils/ensureNamespace.ts +2 -2
- package/src/config/getProjectConfig.ts +2 -2
- package/src/gcloud/cloudRun/openCloudRunDashboards.ts +2 -2
- package/src/gcloud/serviceAccounts.ts +3 -3
- package/src/kubernetes/openKubernetesDashboards.ts +3 -3
- package/src/utils/gitlab.ts +26 -10
package/package.json
CHANGED
|
@@ -11,13 +11,14 @@ export default async (choice?: Choice) => {
|
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
await Promise.all([
|
|
15
|
+
config.pipelineType
|
|
16
|
+
? generatePipelineFiles(config, config.pipelineType, "local")
|
|
17
|
+
: undefined,
|
|
18
|
+
writeDotEnvFiles(config, choice),
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
writeDTsFiles(config, choice),
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
printVariables(config, choice),
|
|
23
|
+
]);
|
|
23
24
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentContext } from "@catladder/pipeline";
|
|
2
2
|
import {
|
|
3
3
|
createKubernetesCloudsqlBaseValues,
|
|
4
4
|
isOfDeployType,
|
|
@@ -79,7 +79,7 @@ export default async (vorpal: Vorpal) =>
|
|
|
79
79
|
|
|
80
80
|
const getProxyInfoForKubernetes = async (
|
|
81
81
|
vorpal: CommandInstance,
|
|
82
|
-
context:
|
|
82
|
+
context: ComponentContext,
|
|
83
83
|
): Promise<ProxyInfo> => {
|
|
84
84
|
if (!isOfDeployType(context.componentConfig.deploy, "kubernetes")) {
|
|
85
85
|
throw new Error("unsupported");
|
|
@@ -109,7 +109,7 @@ const getProxyInfoForKubernetes = async (
|
|
|
109
109
|
|
|
110
110
|
const getProxyInfoForCloudRun = async (
|
|
111
111
|
vorpal: CommandInstance,
|
|
112
|
-
context:
|
|
112
|
+
context: ComponentContext,
|
|
113
113
|
): Promise<ProxyInfo> => {
|
|
114
114
|
if (
|
|
115
115
|
!isOfDeployType(context.componentConfig.deploy, "google-cloudrun") ||
|
|
@@ -8,7 +8,7 @@ import ensureCluster from "./utils/ensureCluster";
|
|
|
8
8
|
import type { CommandInstance } from "vorpal";
|
|
9
9
|
import { parseChoice } from "../../../../config/parseChoice";
|
|
10
10
|
import { getPipelineContextByChoice } from "../../../../config/getProjectConfig";
|
|
11
|
-
import type {
|
|
11
|
+
import type { ComponentContext } from "@catladder/pipeline";
|
|
12
12
|
import { isOfDeployType } from "@catladder/pipeline";
|
|
13
13
|
import { startPortForwardCommand } from "../../../../utils/portForwards";
|
|
14
14
|
import open from "open";
|
|
@@ -44,7 +44,10 @@ const kubePortForward = async (cmd: CommandInstance, envComponent: string) => {
|
|
|
44
44
|
return startKubePortForward(podName, localPort, remotePort, namespace);
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
const cloudRunPortForward = async (
|
|
47
|
+
const cloudRunPortForward = async (
|
|
48
|
+
cmd: CommandInstance,
|
|
49
|
+
context: ComponentContext,
|
|
50
|
+
) => {
|
|
48
51
|
if (!isOfDeployType(context.componentConfig.deploy, "google-cloudrun")) {
|
|
49
52
|
throw new Error("not cloud run");
|
|
50
53
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentContext } from "@catladder/pipeline";
|
|
2
2
|
import {
|
|
3
3
|
GCLOUD_DEPLOY_CREDENTIALS_KEY,
|
|
4
4
|
GCLOUD_RUN_CANONICAL_HOST_SUFFIX,
|
|
@@ -14,7 +14,7 @@ import { upsertAllVariables } from "../../../../../utils/gitlab";
|
|
|
14
14
|
|
|
15
15
|
export const setupCloudRun = async (
|
|
16
16
|
instance: CommandInstance,
|
|
17
|
-
context:
|
|
17
|
+
context: ComponentContext,
|
|
18
18
|
) => {
|
|
19
19
|
if (!isOfDeployType(context.componentConfig.deploy, "google-cloudrun")) {
|
|
20
20
|
throw new Error("deploy config is not of type 'google-cloudrun'");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentContext } from "@catladder/pipeline";
|
|
2
2
|
import { isOfDeployType } from "@catladder/pipeline";
|
|
3
3
|
import type { CommandInstance } from "vorpal";
|
|
4
4
|
import { setupCloudRun } from "./setupCloudRun";
|
|
@@ -7,7 +7,7 @@ import { setupKubernetes } from "./setupKubernetes";
|
|
|
7
7
|
|
|
8
8
|
export const setupContext = async (
|
|
9
9
|
instance: CommandInstance,
|
|
10
|
-
context:
|
|
10
|
+
context: ComponentContext,
|
|
11
11
|
) => {
|
|
12
12
|
instance.log("");
|
|
13
13
|
instance.log(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentContext } from "@catladder/pipeline";
|
|
2
2
|
import {
|
|
3
3
|
getFullKubernetesClusterName,
|
|
4
4
|
isOfDeployType,
|
|
@@ -15,7 +15,7 @@ import ensureNamespace from "../utils/ensureNamespace";
|
|
|
15
15
|
|
|
16
16
|
export const setupKubernetes = async (
|
|
17
17
|
instance: CommandInstance,
|
|
18
|
-
context:
|
|
18
|
+
context: ComponentContext,
|
|
19
19
|
) => {
|
|
20
20
|
const deployConfig = context.componentConfig.deploy;
|
|
21
21
|
if (!isOfDeployType(deployConfig, "kubernetes")) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentContext } from "@catladder/pipeline";
|
|
2
2
|
import { getKubernetesNamespace } from "@catladder/pipeline";
|
|
3
3
|
import type { V1ObjectMeta } from "@kubernetes/client-node";
|
|
4
4
|
import { V1Namespace } from "@kubernetes/client-node";
|
|
5
5
|
import { getk8sApi } from "../../../../../k8sApi";
|
|
6
6
|
|
|
7
|
-
export default async function (context:
|
|
7
|
+
export default async function (context: ComponentContext) {
|
|
8
8
|
const namespace = getKubernetesNamespace(
|
|
9
9
|
context.fullConfig,
|
|
10
10
|
context.environment.shortName,
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
readConfigSync,
|
|
4
4
|
getAllEnvs,
|
|
5
5
|
getEnvironment as _getEnvironment,
|
|
6
|
-
|
|
6
|
+
createComponentContext,
|
|
7
7
|
getSecretVarName,
|
|
8
8
|
} from "@catladder/pipeline";
|
|
9
9
|
|
|
@@ -53,7 +53,7 @@ export const getPipelineContextByChoice = async (
|
|
|
53
53
|
componentName: string,
|
|
54
54
|
) => {
|
|
55
55
|
const config = await getProjectConfig();
|
|
56
|
-
return await
|
|
56
|
+
return await createComponentContext({
|
|
57
57
|
config,
|
|
58
58
|
componentName,
|
|
59
59
|
env,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentContext } from "@catladder/pipeline";
|
|
2
2
|
import { isOfDeployType } from "@catladder/pipeline";
|
|
3
3
|
import type { CommandInstance } from "vorpal";
|
|
4
4
|
import { openGoogleCloudDashboard } from "../openDashboard";
|
|
5
5
|
|
|
6
6
|
export const openGoogleCloudRunDashboard = async (
|
|
7
7
|
instance: CommandInstance,
|
|
8
|
-
context:
|
|
8
|
+
context: ComponentContext,
|
|
9
9
|
) => {
|
|
10
10
|
if (!isOfDeployType(context.componentConfig.deploy, "google-cloudrun")) {
|
|
11
11
|
throw new Error("deploy type is not google-cloudrun ");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentContext } from "@catladder/pipeline";
|
|
2
2
|
|
|
3
3
|
import { exec } from "child-process-promise";
|
|
4
4
|
import { createHmac } from "crypto";
|
|
@@ -22,7 +22,7 @@ type ServiceAccount = {
|
|
|
22
22
|
description: string;
|
|
23
23
|
};
|
|
24
24
|
const upsertGcloudServiceAccount = async (
|
|
25
|
-
context:
|
|
25
|
+
context: ComponentContext,
|
|
26
26
|
account: ServiceAccount,
|
|
27
27
|
): Promise<string> => {
|
|
28
28
|
const { projectId, name, displayName, roles, description } = account;
|
|
@@ -76,7 +76,7 @@ const upsertGcloudServiceAccount = async (
|
|
|
76
76
|
|
|
77
77
|
export const upsertGcloudServiceAccountAndSaveSecret = async (
|
|
78
78
|
instance: CommandInstance,
|
|
79
|
-
context:
|
|
79
|
+
context: ComponentContext,
|
|
80
80
|
account: ServiceAccount,
|
|
81
81
|
secretName: string,
|
|
82
82
|
): Promise<void> => {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentContext } from "@catladder/pipeline";
|
|
2
2
|
import { isOfDeployType } from "@catladder/pipeline";
|
|
3
3
|
import type { CommandInstance } from "vorpal";
|
|
4
4
|
import { openGoogleCloudDashboard } from "../gcloud/openDashboard";
|
|
5
5
|
|
|
6
6
|
export const openGoogleCloudLogs = async (
|
|
7
7
|
instance: CommandInstance,
|
|
8
|
-
context:
|
|
8
|
+
context: ComponentContext,
|
|
9
9
|
) => {
|
|
10
10
|
const deployConfig = context.componentConfig.deploy;
|
|
11
11
|
if (!isOfDeployType(deployConfig, "kubernetes")) {
|
|
@@ -31,7 +31,7 @@ export const openGoogleCloudLogs = async (
|
|
|
31
31
|
|
|
32
32
|
export const openGoogleCloudKubernetesDashboard = async (
|
|
33
33
|
instance: CommandInstance,
|
|
34
|
-
context:
|
|
34
|
+
context: ComponentContext,
|
|
35
35
|
) => {
|
|
36
36
|
const deployConfig = context.componentConfig.deploy;
|
|
37
37
|
if (!isOfDeployType(deployConfig, "kubernetes")) {
|
package/src/utils/gitlab.ts
CHANGED
|
@@ -114,20 +114,36 @@ type GitlabVariable = {
|
|
|
114
114
|
environment_scope: string;
|
|
115
115
|
};
|
|
116
116
|
export const getAllVariables = memoizee(
|
|
117
|
-
async (
|
|
117
|
+
async (
|
|
118
|
+
vorpal: CommandInstance | null,
|
|
119
|
+
n = 5, // how many requests to do in parallel, 5 seems a good value for many projects, ideally we would do one request in parallel per component
|
|
120
|
+
): Promise<Array<GitlabVariable>> => {
|
|
118
121
|
const { id } = await getProjectInfo(vorpal);
|
|
122
|
+
|
|
119
123
|
let all: Array<GitlabVariable> = [];
|
|
120
|
-
let result: Array<GitlabVariable
|
|
124
|
+
let result: Array<Array<GitlabVariable>> = [];
|
|
121
125
|
let page = 1;
|
|
126
|
+
|
|
122
127
|
do {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
// Create an array of promises for N pages
|
|
129
|
+
const promises = Array.from({ length: n }, (_, i) => {
|
|
130
|
+
return doGitlabRequest(
|
|
131
|
+
vorpal,
|
|
132
|
+
`projects/${id}/variables?per_page=100&page=${page + i}`,
|
|
133
|
+
);
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
// Wait for all promises to resolve
|
|
137
|
+
result = await Promise.all(promises);
|
|
138
|
+
|
|
139
|
+
// Increment the page by N
|
|
140
|
+
page += n;
|
|
141
|
+
|
|
142
|
+
// Flatten the result array and add it to 'all'
|
|
143
|
+
all = [...all, ...result.flat()];
|
|
144
|
+
// Continue only if the last page had results
|
|
145
|
+
} while (result.length > 0 && result[result.length - 1].length > 0);
|
|
146
|
+
|
|
131
147
|
return all;
|
|
132
148
|
},
|
|
133
149
|
{ promise: true },
|