@argos-ci/gitlab 0.4.3 → 0.4.4
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/bin/argos-gitlab.js +1 -1
- package/dist/cli.mjs +93 -0
- package/dist/index.d.mts +30 -0
- package/dist/index.mjs +73 -0
- package/package.json +8 -8
- package/dist/cli.js +0 -117
- package/dist/index.d.ts +0 -28
- package/dist/index.js +0 -95
package/bin/argos-gitlab.js
CHANGED
package/dist/cli.mjs
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
import { resolve } from "node:path";
|
|
4
|
+
import { program } from "commander";
|
|
5
|
+
import { createClient } from "@argos-ci/api-client";
|
|
6
|
+
import { Gitlab } from "@gitbeaker/rest";
|
|
7
|
+
//#region src/statuses.ts
|
|
8
|
+
/**
|
|
9
|
+
* Run the main logic of the action.
|
|
10
|
+
*/
|
|
11
|
+
async function run(input) {
|
|
12
|
+
const { argosClient, gitlabClient, gitlabProjectId, pullInterval, commit } = input;
|
|
13
|
+
const { data, error } = await argosClient.GET("/project/builds", { params: { query: {
|
|
14
|
+
distinctName: "true",
|
|
15
|
+
commit
|
|
16
|
+
} } });
|
|
17
|
+
if (error) {
|
|
18
|
+
console.error(error);
|
|
19
|
+
throw new Error(error.error);
|
|
20
|
+
}
|
|
21
|
+
if (data.results.length === 0) {
|
|
22
|
+
console.log("No builds found for commit", commit);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
await Promise.all(data.results.map(async (build) => {
|
|
26
|
+
if (build.notification) {
|
|
27
|
+
console.log(`Setting status for build #${build.number}: "${build.status}" (Argos) → "${build.notification.gitlab.state}" (GitLab)`);
|
|
28
|
+
await gitlabClient.Commits.editStatus(gitlabProjectId, commit, build.notification.gitlab.state, {
|
|
29
|
+
context: build.notification.context,
|
|
30
|
+
targetUrl: build.url,
|
|
31
|
+
description: build.notification.description
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}));
|
|
35
|
+
if (data.results.some((build) => build.status === "pending" || build.status === "progress")) {
|
|
36
|
+
await new Promise((resolve) => setTimeout(resolve, pullInterval));
|
|
37
|
+
run(input);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Upate GitLab commit statuses based on Argos builds.
|
|
42
|
+
*/
|
|
43
|
+
async function updateGitLabCommitStatuses(input) {
|
|
44
|
+
await run({
|
|
45
|
+
argosClient: createClient({ authToken: input.argosToken }),
|
|
46
|
+
gitlabClient: new Gitlab({
|
|
47
|
+
oauthToken: input.gitlab.authToken,
|
|
48
|
+
host: input.gitlab.baseUrl
|
|
49
|
+
}),
|
|
50
|
+
gitlabProjectId: input.gitlab.projectId,
|
|
51
|
+
commit: input.commit,
|
|
52
|
+
pullInterval: input.pullInterval ?? 3e3
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/config.ts
|
|
57
|
+
/**
|
|
58
|
+
* Get the configuration from the environment variables.
|
|
59
|
+
*/
|
|
60
|
+
function getConfig() {
|
|
61
|
+
if (!process.env.CI_PROJECT_ID) throw new Error("CI_PROJECT_ID is not set");
|
|
62
|
+
if (!process.env.CI_SERVER_URL) throw new Error("CI_SERVER_URL is not set");
|
|
63
|
+
if (!process.env.CI_COMMIT_SHA) throw new Error("CI_COMMIT_SHA is not set");
|
|
64
|
+
if (!process.env.ARGOS_GITLAB_TOKEN) throw new Error("ARGOS_GITLAB_TOKEN is not set");
|
|
65
|
+
if (!process.env.ARGOS_TOKEN) throw new Error("ARGOS_TOKEN is not set");
|
|
66
|
+
return {
|
|
67
|
+
commit: process.env.CI_COMMIT_SHA,
|
|
68
|
+
argosToken: process.env.ARGOS_TOKEN,
|
|
69
|
+
gitlab: {
|
|
70
|
+
projectId: process.env.CI_PROJECT_ID,
|
|
71
|
+
authToken: process.env.ARGOS_GITLAB_TOKEN,
|
|
72
|
+
baseUrl: process.env.CI_SERVER_URL
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
//#endregion
|
|
77
|
+
//#region src/cli.ts
|
|
78
|
+
const rawPkg = await readFile(resolve(fileURLToPath(new URL(".", import.meta.url)), "..", "package.json"), "utf8");
|
|
79
|
+
const pkg = JSON.parse(rawPkg);
|
|
80
|
+
program.name(pkg.name).description("Run Argos GitLab commands from the command line.").version(pkg.version);
|
|
81
|
+
program.command("update-statuses").description("Update GitLab commit statuses based on Argos builds.").action(async () => {
|
|
82
|
+
const config = getConfig();
|
|
83
|
+
try {
|
|
84
|
+
await updateGitLabCommitStatuses(config);
|
|
85
|
+
} catch (error) {
|
|
86
|
+
console.error(error.stack);
|
|
87
|
+
process.exit(1);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
if (!process.argv.slice(2).length) program.outputHelp();
|
|
91
|
+
else program.parse(process.argv);
|
|
92
|
+
//#endregion
|
|
93
|
+
export {};
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region src/statuses.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Upate GitLab commit statuses based on Argos builds.
|
|
4
|
+
*/
|
|
5
|
+
declare function updateGitLabCommitStatuses(input: {
|
|
6
|
+
commit: string;
|
|
7
|
+
pullInterval?: number;
|
|
8
|
+
argosToken: string;
|
|
9
|
+
gitlab: {
|
|
10
|
+
projectId: string;
|
|
11
|
+
authToken: string;
|
|
12
|
+
baseUrl: string;
|
|
13
|
+
};
|
|
14
|
+
}): Promise<void>;
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/config.d.ts
|
|
17
|
+
/**
|
|
18
|
+
* Get the configuration from the environment variables.
|
|
19
|
+
*/
|
|
20
|
+
declare function getConfig(): {
|
|
21
|
+
commit: string;
|
|
22
|
+
argosToken: string;
|
|
23
|
+
gitlab: {
|
|
24
|
+
projectId: string;
|
|
25
|
+
authToken: string;
|
|
26
|
+
baseUrl: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
//#endregion
|
|
30
|
+
export { getConfig, updateGitLabCommitStatuses };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { createClient } from "@argos-ci/api-client";
|
|
2
|
+
import { Gitlab } from "@gitbeaker/rest";
|
|
3
|
+
//#region src/statuses.ts
|
|
4
|
+
/**
|
|
5
|
+
* Run the main logic of the action.
|
|
6
|
+
*/
|
|
7
|
+
async function run(input) {
|
|
8
|
+
const { argosClient, gitlabClient, gitlabProjectId, pullInterval, commit } = input;
|
|
9
|
+
const { data, error } = await argosClient.GET("/project/builds", { params: { query: {
|
|
10
|
+
distinctName: "true",
|
|
11
|
+
commit
|
|
12
|
+
} } });
|
|
13
|
+
if (error) {
|
|
14
|
+
console.error(error);
|
|
15
|
+
throw new Error(error.error);
|
|
16
|
+
}
|
|
17
|
+
if (data.results.length === 0) {
|
|
18
|
+
console.log("No builds found for commit", commit);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
await Promise.all(data.results.map(async (build) => {
|
|
22
|
+
if (build.notification) {
|
|
23
|
+
console.log(`Setting status for build #${build.number}: "${build.status}" (Argos) → "${build.notification.gitlab.state}" (GitLab)`);
|
|
24
|
+
await gitlabClient.Commits.editStatus(gitlabProjectId, commit, build.notification.gitlab.state, {
|
|
25
|
+
context: build.notification.context,
|
|
26
|
+
targetUrl: build.url,
|
|
27
|
+
description: build.notification.description
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}));
|
|
31
|
+
if (data.results.some((build) => build.status === "pending" || build.status === "progress")) {
|
|
32
|
+
await new Promise((resolve) => setTimeout(resolve, pullInterval));
|
|
33
|
+
run(input);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Upate GitLab commit statuses based on Argos builds.
|
|
38
|
+
*/
|
|
39
|
+
async function updateGitLabCommitStatuses(input) {
|
|
40
|
+
await run({
|
|
41
|
+
argosClient: createClient({ authToken: input.argosToken }),
|
|
42
|
+
gitlabClient: new Gitlab({
|
|
43
|
+
oauthToken: input.gitlab.authToken,
|
|
44
|
+
host: input.gitlab.baseUrl
|
|
45
|
+
}),
|
|
46
|
+
gitlabProjectId: input.gitlab.projectId,
|
|
47
|
+
commit: input.commit,
|
|
48
|
+
pullInterval: input.pullInterval ?? 3e3
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/config.ts
|
|
53
|
+
/**
|
|
54
|
+
* Get the configuration from the environment variables.
|
|
55
|
+
*/
|
|
56
|
+
function getConfig() {
|
|
57
|
+
if (!process.env.CI_PROJECT_ID) throw new Error("CI_PROJECT_ID is not set");
|
|
58
|
+
if (!process.env.CI_SERVER_URL) throw new Error("CI_SERVER_URL is not set");
|
|
59
|
+
if (!process.env.CI_COMMIT_SHA) throw new Error("CI_COMMIT_SHA is not set");
|
|
60
|
+
if (!process.env.ARGOS_GITLAB_TOKEN) throw new Error("ARGOS_GITLAB_TOKEN is not set");
|
|
61
|
+
if (!process.env.ARGOS_TOKEN) throw new Error("ARGOS_TOKEN is not set");
|
|
62
|
+
return {
|
|
63
|
+
commit: process.env.CI_COMMIT_SHA,
|
|
64
|
+
argosToken: process.env.ARGOS_TOKEN,
|
|
65
|
+
gitlab: {
|
|
66
|
+
projectId: process.env.CI_PROJECT_ID,
|
|
67
|
+
authToken: process.env.ARGOS_GITLAB_TOKEN,
|
|
68
|
+
baseUrl: process.env.CI_SERVER_URL
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
//#endregion
|
|
73
|
+
export { getConfig, updateGitLabCommitStatuses };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@argos-ci/gitlab",
|
|
3
3
|
"description": "GitLab utilities for visual testing with Argos.",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.4",
|
|
5
5
|
"author": "Smooth Code",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -30,29 +30,29 @@
|
|
|
30
30
|
},
|
|
31
31
|
"exports": {
|
|
32
32
|
".": {
|
|
33
|
-
"types": "./dist/index.d.
|
|
34
|
-
"import": "./dist/index.
|
|
35
|
-
"default": "./dist/index.
|
|
33
|
+
"types": "./dist/index.d.mts",
|
|
34
|
+
"import": "./dist/index.mjs",
|
|
35
|
+
"default": "./dist/index.mjs"
|
|
36
36
|
},
|
|
37
37
|
"./package.json": "./package.json"
|
|
38
38
|
},
|
|
39
|
-
"types": "./dist/index.d.
|
|
39
|
+
"types": "./dist/index.d.mts",
|
|
40
40
|
"engines": {
|
|
41
41
|
"node": ">=20.0.0"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
|
-
"build": "
|
|
44
|
+
"build": "tsdown",
|
|
45
45
|
"check-types": "tsc",
|
|
46
46
|
"check-format": "prettier --check --ignore-unknown --ignore-path=../../.gitignore --ignore-path=../../.prettierignore .",
|
|
47
47
|
"lint": "eslint ."
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@argos-ci/api-client": "0.16.
|
|
50
|
+
"@argos-ci/api-client": "0.16.1",
|
|
51
51
|
"@gitbeaker/rest": "^43.8.0",
|
|
52
52
|
"commander": "^14.0.3"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/node": "catalog:"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "b49d186d5eb6e1338982a4cd5c3cb29e6cb0b7af"
|
|
58
58
|
}
|
package/dist/cli.js
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
// src/cli.ts
|
|
2
|
-
import { readFile } from "fs/promises";
|
|
3
|
-
import { fileURLToPath } from "url";
|
|
4
|
-
import { resolve } from "path";
|
|
5
|
-
import { program } from "commander";
|
|
6
|
-
|
|
7
|
-
// src/statuses.ts
|
|
8
|
-
import { createClient } from "@argos-ci/api-client";
|
|
9
|
-
import { Gitlab } from "@gitbeaker/rest";
|
|
10
|
-
async function run(input) {
|
|
11
|
-
const { argosClient, gitlabClient, gitlabProjectId, pullInterval, commit } = input;
|
|
12
|
-
const { data, error } = await argosClient.GET("/project/builds", {
|
|
13
|
-
params: {
|
|
14
|
-
query: {
|
|
15
|
-
distinctName: "true",
|
|
16
|
-
commit
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
if (error) {
|
|
21
|
-
console.error(error);
|
|
22
|
-
throw new Error(error.error);
|
|
23
|
-
}
|
|
24
|
-
if (data.results.length === 0) {
|
|
25
|
-
console.log("No builds found for commit", commit);
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
await Promise.all(
|
|
29
|
-
data.results.map(async (build) => {
|
|
30
|
-
if (build.notification) {
|
|
31
|
-
console.log(
|
|
32
|
-
`Setting status for build #${build.number}: "${build.status}" (Argos) \u2192 "${build.notification.gitlab.state}" (GitLab)`
|
|
33
|
-
);
|
|
34
|
-
await gitlabClient.Commits.editStatus(
|
|
35
|
-
gitlabProjectId,
|
|
36
|
-
commit,
|
|
37
|
-
build.notification.gitlab.state,
|
|
38
|
-
{
|
|
39
|
-
context: build.notification.context,
|
|
40
|
-
targetUrl: build.url,
|
|
41
|
-
description: build.notification.description
|
|
42
|
-
}
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
})
|
|
46
|
-
);
|
|
47
|
-
if (data.results.some(
|
|
48
|
-
(build) => build.status === "pending" || build.status === "progress"
|
|
49
|
-
)) {
|
|
50
|
-
await new Promise((resolve2) => setTimeout(resolve2, pullInterval));
|
|
51
|
-
run(input);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
async function updateGitLabCommitStatuses(input) {
|
|
55
|
-
const argos = createClient({
|
|
56
|
-
authToken: input.argosToken
|
|
57
|
-
});
|
|
58
|
-
const gitlab = new Gitlab({
|
|
59
|
-
oauthToken: input.gitlab.authToken,
|
|
60
|
-
host: input.gitlab.baseUrl
|
|
61
|
-
});
|
|
62
|
-
await run({
|
|
63
|
-
argosClient: argos,
|
|
64
|
-
gitlabClient: gitlab,
|
|
65
|
-
gitlabProjectId: input.gitlab.projectId,
|
|
66
|
-
commit: input.commit,
|
|
67
|
-
pullInterval: input.pullInterval ?? 3e3
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// src/config.ts
|
|
72
|
-
function getConfig() {
|
|
73
|
-
if (!process.env.CI_PROJECT_ID) {
|
|
74
|
-
throw new Error("CI_PROJECT_ID is not set");
|
|
75
|
-
}
|
|
76
|
-
if (!process.env.CI_SERVER_URL) {
|
|
77
|
-
throw new Error("CI_SERVER_URL is not set");
|
|
78
|
-
}
|
|
79
|
-
if (!process.env.CI_COMMIT_SHA) {
|
|
80
|
-
throw new Error("CI_COMMIT_SHA is not set");
|
|
81
|
-
}
|
|
82
|
-
if (!process.env.ARGOS_GITLAB_TOKEN) {
|
|
83
|
-
throw new Error("ARGOS_GITLAB_TOKEN is not set");
|
|
84
|
-
}
|
|
85
|
-
if (!process.env.ARGOS_TOKEN) {
|
|
86
|
-
throw new Error("ARGOS_TOKEN is not set");
|
|
87
|
-
}
|
|
88
|
-
return {
|
|
89
|
-
commit: process.env.CI_COMMIT_SHA,
|
|
90
|
-
argosToken: process.env.ARGOS_TOKEN,
|
|
91
|
-
gitlab: {
|
|
92
|
-
projectId: process.env.CI_PROJECT_ID,
|
|
93
|
-
authToken: process.env.ARGOS_GITLAB_TOKEN,
|
|
94
|
-
baseUrl: process.env.CI_SERVER_URL
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// src/cli.ts
|
|
100
|
-
var __dirname = fileURLToPath(new URL(".", import.meta.url));
|
|
101
|
-
var rawPkg = await readFile(resolve(__dirname, "..", "package.json"), "utf8");
|
|
102
|
-
var pkg = JSON.parse(rawPkg);
|
|
103
|
-
program.name(pkg.name).description("Run Argos GitLab commands from the command line.").version(pkg.version);
|
|
104
|
-
program.command("update-statuses").description("Update GitLab commit statuses based on Argos builds.").action(async () => {
|
|
105
|
-
const config = getConfig();
|
|
106
|
-
try {
|
|
107
|
-
await updateGitLabCommitStatuses(config);
|
|
108
|
-
} catch (error) {
|
|
109
|
-
console.error(error.stack);
|
|
110
|
-
process.exit(1);
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
if (!process.argv.slice(2).length) {
|
|
114
|
-
program.outputHelp();
|
|
115
|
-
} else {
|
|
116
|
-
program.parse(process.argv);
|
|
117
|
-
}
|
package/dist/index.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Upate GitLab commit statuses based on Argos builds.
|
|
3
|
-
*/
|
|
4
|
-
declare function updateGitLabCommitStatuses(input: {
|
|
5
|
-
commit: string;
|
|
6
|
-
pullInterval?: number;
|
|
7
|
-
argosToken: string;
|
|
8
|
-
gitlab: {
|
|
9
|
-
projectId: string;
|
|
10
|
-
authToken: string;
|
|
11
|
-
baseUrl: string;
|
|
12
|
-
};
|
|
13
|
-
}): Promise<void>;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Get the configuration from the environment variables.
|
|
17
|
-
*/
|
|
18
|
-
declare function getConfig(): {
|
|
19
|
-
commit: string;
|
|
20
|
-
argosToken: string;
|
|
21
|
-
gitlab: {
|
|
22
|
-
projectId: string;
|
|
23
|
-
authToken: string;
|
|
24
|
-
baseUrl: string;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export { getConfig, updateGitLabCommitStatuses };
|
package/dist/index.js
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
// src/statuses.ts
|
|
2
|
-
import { createClient } from "@argos-ci/api-client";
|
|
3
|
-
import { Gitlab } from "@gitbeaker/rest";
|
|
4
|
-
async function run(input) {
|
|
5
|
-
const { argosClient, gitlabClient, gitlabProjectId, pullInterval, commit } = input;
|
|
6
|
-
const { data, error } = await argosClient.GET("/project/builds", {
|
|
7
|
-
params: {
|
|
8
|
-
query: {
|
|
9
|
-
distinctName: "true",
|
|
10
|
-
commit
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
if (error) {
|
|
15
|
-
console.error(error);
|
|
16
|
-
throw new Error(error.error);
|
|
17
|
-
}
|
|
18
|
-
if (data.results.length === 0) {
|
|
19
|
-
console.log("No builds found for commit", commit);
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
await Promise.all(
|
|
23
|
-
data.results.map(async (build) => {
|
|
24
|
-
if (build.notification) {
|
|
25
|
-
console.log(
|
|
26
|
-
`Setting status for build #${build.number}: "${build.status}" (Argos) \u2192 "${build.notification.gitlab.state}" (GitLab)`
|
|
27
|
-
);
|
|
28
|
-
await gitlabClient.Commits.editStatus(
|
|
29
|
-
gitlabProjectId,
|
|
30
|
-
commit,
|
|
31
|
-
build.notification.gitlab.state,
|
|
32
|
-
{
|
|
33
|
-
context: build.notification.context,
|
|
34
|
-
targetUrl: build.url,
|
|
35
|
-
description: build.notification.description
|
|
36
|
-
}
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
})
|
|
40
|
-
);
|
|
41
|
-
if (data.results.some(
|
|
42
|
-
(build) => build.status === "pending" || build.status === "progress"
|
|
43
|
-
)) {
|
|
44
|
-
await new Promise((resolve) => setTimeout(resolve, pullInterval));
|
|
45
|
-
run(input);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
async function updateGitLabCommitStatuses(input) {
|
|
49
|
-
const argos = createClient({
|
|
50
|
-
authToken: input.argosToken
|
|
51
|
-
});
|
|
52
|
-
const gitlab = new Gitlab({
|
|
53
|
-
oauthToken: input.gitlab.authToken,
|
|
54
|
-
host: input.gitlab.baseUrl
|
|
55
|
-
});
|
|
56
|
-
await run({
|
|
57
|
-
argosClient: argos,
|
|
58
|
-
gitlabClient: gitlab,
|
|
59
|
-
gitlabProjectId: input.gitlab.projectId,
|
|
60
|
-
commit: input.commit,
|
|
61
|
-
pullInterval: input.pullInterval ?? 3e3
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// src/config.ts
|
|
66
|
-
function getConfig() {
|
|
67
|
-
if (!process.env.CI_PROJECT_ID) {
|
|
68
|
-
throw new Error("CI_PROJECT_ID is not set");
|
|
69
|
-
}
|
|
70
|
-
if (!process.env.CI_SERVER_URL) {
|
|
71
|
-
throw new Error("CI_SERVER_URL is not set");
|
|
72
|
-
}
|
|
73
|
-
if (!process.env.CI_COMMIT_SHA) {
|
|
74
|
-
throw new Error("CI_COMMIT_SHA is not set");
|
|
75
|
-
}
|
|
76
|
-
if (!process.env.ARGOS_GITLAB_TOKEN) {
|
|
77
|
-
throw new Error("ARGOS_GITLAB_TOKEN is not set");
|
|
78
|
-
}
|
|
79
|
-
if (!process.env.ARGOS_TOKEN) {
|
|
80
|
-
throw new Error("ARGOS_TOKEN is not set");
|
|
81
|
-
}
|
|
82
|
-
return {
|
|
83
|
-
commit: process.env.CI_COMMIT_SHA,
|
|
84
|
-
argosToken: process.env.ARGOS_TOKEN,
|
|
85
|
-
gitlab: {
|
|
86
|
-
projectId: process.env.CI_PROJECT_ID,
|
|
87
|
-
authToken: process.env.ARGOS_GITLAB_TOKEN,
|
|
88
|
-
baseUrl: process.env.CI_SERVER_URL
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
export {
|
|
93
|
-
getConfig,
|
|
94
|
-
updateGitLabCommitStatuses
|
|
95
|
-
};
|