Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • catladder/catladder
1 result
Show changes
Commits on Source (2)
## [1.141.1](https://git.panter.ch/catladder/catladder/compare/v1.141.0...v1.141.1) (2024-06-06)
# [1.141.0](https://git.panter.ch/catladder/catladder/compare/v1.140.2...v1.141.0) (2024-06-05)
......
......@@ -55,30 +55,4 @@ export const setupAccessTokens = async (instance: CommandInstance) => {
"POST"
);
}
const deploy_tokens = await doGitlabRequest(
instance,
`projects/${projectId}/deploy_tokens`
);
if (
!deploy_tokens.find(
(v: { name: string }) => v.name === "gitlab-deploy-token"
)
) {
instance.log(
"I will setup the 'GitLab Deploy Token', so Kubernetes can pull images from this project."
);
await doGitlabRequest(
instance,
`projects/${projectId}/deploy_tokens`,
{
id: projectId,
name: "gitlab-deploy-token",
scopes: ["read_registry"],
},
"POST"
);
}
};
......@@ -6,7 +6,11 @@ import {
import type { CommandInstance } from "vorpal";
import { exec } from "child-process-promise";
import { connectToCluster } from "../../../../../utils/cluster";
import { upsertAllVariables } from "../../../../../utils/gitlab";
import {
doGitlabRequest,
getProjectInfo,
upsertAllVariables,
} from "../../../../../utils/gitlab";
import ensureNamespace from "../utils/ensureNamespace";
export const setupKubernetes = async (
......@@ -18,6 +22,33 @@ export const setupKubernetes = async (
throw new Error("cannot run setupKubernetes on non-kubernetes deployments");
}
const { id: projectId } = await getProjectInfo(instance);
const deploy_tokens = await doGitlabRequest(
instance,
`projects/${projectId}/deploy_tokens`
);
if (
!deploy_tokens.find(
(v: { name: string }) => v.name === "gitlab-deploy-token"
)
) {
instance.log(
"I will setup the 'GitLab Deploy Token', so Kubernetes can pull images from this project."
);
await doGitlabRequest(
instance,
`projects/${projectId}/deploy_tokens`,
{
id: projectId,
name: "gitlab-deploy-token",
scopes: ["read_registry"],
},
"POST"
);
}
const fullName = getFullKubernetesClusterName(deployConfig.cluster);
instance.log(`cluster: ${fullName}`);
......