@allurereport/ci 3.0.0-beta.23 → 3.0.0-beta.24
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/detect.js +3 -1
- package/dist/detectors/amazon.js +8 -1
- package/dist/detectors/azure.js +4 -0
- package/dist/detectors/bitbucket.js +3 -0
- package/dist/detectors/circle.js +3 -0
- package/dist/detectors/drone.js +3 -0
- package/dist/detectors/github.js +5 -1
- package/dist/detectors/gitlab.js +3 -0
- package/dist/detectors/index.d.ts +9 -0
- package/dist/detectors/index.js +9 -0
- package/dist/detectors/jenkins.js +8 -1
- package/dist/detectors/local.d.ts +2 -0
- package/dist/detectors/local.js +47 -0
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +1 -0
- package/package.json +2 -2
package/dist/detect.js
CHANGED
|
@@ -6,6 +6,8 @@ import { drone } from "./detectors/drone.js";
|
|
|
6
6
|
import { github } from "./detectors/github.js";
|
|
7
7
|
import { gitlab } from "./detectors/gitlab.js";
|
|
8
8
|
import { jenkins } from "./detectors/jenkins.js";
|
|
9
|
+
import { local } from "./detectors/local.js";
|
|
9
10
|
export const detect = () => {
|
|
10
|
-
return [amazon, azure, bitbucket, circle, drone, github, gitlab, jenkins].find((descriptor) => descriptor.detected)
|
|
11
|
+
return ([amazon, azure, bitbucket, circle, drone, github, gitlab, jenkins].find((descriptor) => descriptor.detected) ??
|
|
12
|
+
local);
|
|
11
13
|
};
|
package/dist/detectors/amazon.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CiType } from "@allurereport/core-api";
|
|
2
|
-
import { getEnv } from "../utils.js";
|
|
2
|
+
import { getEnv, getReponameFromRepoUrl } from "../utils.js";
|
|
3
3
|
const AMAZON_REGEXP = /^arn:aws:codebuild:([^:]+):([\d]+):(?:build|build-batch)\/([^:]+):([\da-f-]+)$/;
|
|
4
4
|
const PIPELINE_REGEXP = /^(?:codepipeline\/)(.+)$/;
|
|
5
5
|
export const parseArnValues = (source) => {
|
|
@@ -27,6 +27,13 @@ export const amazon = {
|
|
|
27
27
|
const buildArn = getEnv("CODEBUILD_BUILD_ARN");
|
|
28
28
|
return buildArn !== "" && parseArnValues(buildArn).length > 0;
|
|
29
29
|
},
|
|
30
|
+
get repoName() {
|
|
31
|
+
const repoUrl = getEnv("CODEBUILD_SOURCE_REPO_URL");
|
|
32
|
+
if (!repoUrl) {
|
|
33
|
+
return "";
|
|
34
|
+
}
|
|
35
|
+
return getReponameFromRepoUrl(repoUrl);
|
|
36
|
+
},
|
|
30
37
|
get jobUid() {
|
|
31
38
|
const buildArn = getEnv("CODEBUILD_BUILD_ARN");
|
|
32
39
|
const pipelineName = getPipelineName();
|
package/dist/detectors/azure.js
CHANGED
|
@@ -9,6 +9,10 @@ export const azure = {
|
|
|
9
9
|
get detected() {
|
|
10
10
|
return getEnv("SYSTEM_DEFINITIONID") !== "";
|
|
11
11
|
},
|
|
12
|
+
get repoName() {
|
|
13
|
+
const repoName = getEnv("BUILD_REPOSITORY_NAME");
|
|
14
|
+
return repoName.split("/")?.[1] ?? repoName;
|
|
15
|
+
},
|
|
12
16
|
get jobUid() {
|
|
13
17
|
return `${getProjectID()}_${getDefinitionID()}`;
|
|
14
18
|
},
|
package/dist/detectors/circle.js
CHANGED
package/dist/detectors/drone.js
CHANGED
package/dist/detectors/github.js
CHANGED
|
@@ -11,6 +11,10 @@ export const github = {
|
|
|
11
11
|
get detected() {
|
|
12
12
|
return getEnv("GITHUB_ACTIONS") !== "";
|
|
13
13
|
},
|
|
14
|
+
get repoName() {
|
|
15
|
+
const repo = getRepo();
|
|
16
|
+
return repo.split("/")?.[1] ?? repo;
|
|
17
|
+
},
|
|
14
18
|
get jobUid() {
|
|
15
19
|
return `${getRepo()}_${getWorkflow()}`;
|
|
16
20
|
},
|
|
@@ -33,7 +37,7 @@ export const github = {
|
|
|
33
37
|
return `${job} #${runNumber}`;
|
|
34
38
|
},
|
|
35
39
|
get jobRunBranch() {
|
|
36
|
-
return getEnv("GITHUB_REF");
|
|
40
|
+
return getEnv("GITHUB_HEAD_REF") || getEnv("GITHUB_REF");
|
|
37
41
|
},
|
|
38
42
|
get pullRequestUrl() {
|
|
39
43
|
const refName = getEnv("GITHUB_REF_NAME");
|
package/dist/detectors/gitlab.js
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { amazon } from "./amazon.js";
|
|
2
|
+
export { azure } from "./azure.js";
|
|
3
|
+
export { bitbucket } from "./bitbucket.js";
|
|
4
|
+
export { circle } from "./circle.js";
|
|
5
|
+
export { drone } from "./drone.js";
|
|
6
|
+
export { github } from "./github.js";
|
|
7
|
+
export { gitlab } from "./gitlab.js";
|
|
8
|
+
export { jenkins } from "./jenkins.js";
|
|
9
|
+
export { local } from "./local.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { amazon } from "./amazon.js";
|
|
2
|
+
export { azure } from "./azure.js";
|
|
3
|
+
export { bitbucket } from "./bitbucket.js";
|
|
4
|
+
export { circle } from "./circle.js";
|
|
5
|
+
export { drone } from "./drone.js";
|
|
6
|
+
export { github } from "./github.js";
|
|
7
|
+
export { gitlab } from "./gitlab.js";
|
|
8
|
+
export { jenkins } from "./jenkins.js";
|
|
9
|
+
export { local } from "./local.js";
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import { CiType } from "@allurereport/core-api";
|
|
2
|
-
import { getEnv } from "../utils.js";
|
|
2
|
+
import { getEnv, getReponameFromRepoUrl } from "../utils.js";
|
|
3
3
|
export const jenkins = {
|
|
4
4
|
type: CiType.Jenkins,
|
|
5
5
|
get detected() {
|
|
6
6
|
return getEnv("JENKINS_URL") !== "";
|
|
7
7
|
},
|
|
8
|
+
get repoName() {
|
|
9
|
+
const gitUrl = getEnv("GIT_URL");
|
|
10
|
+
if (!gitUrl) {
|
|
11
|
+
return "";
|
|
12
|
+
}
|
|
13
|
+
return getReponameFromRepoUrl(gitUrl);
|
|
14
|
+
},
|
|
8
15
|
get jobUid() {
|
|
9
16
|
return getEnv("JOB_NAME");
|
|
10
17
|
},
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { CiType } from "@allurereport/core-api";
|
|
2
|
+
import { spawnSync } from "node:child_process";
|
|
3
|
+
import { basename } from "node:path";
|
|
4
|
+
export const local = {
|
|
5
|
+
type: CiType.Local,
|
|
6
|
+
get detected() {
|
|
7
|
+
return true;
|
|
8
|
+
},
|
|
9
|
+
get repoName() {
|
|
10
|
+
const output = spawnSync("git", ["rev-parse", "--show-toplevel"]);
|
|
11
|
+
if (output.error) {
|
|
12
|
+
return "";
|
|
13
|
+
}
|
|
14
|
+
return basename(output.stdout.toString().trim());
|
|
15
|
+
},
|
|
16
|
+
get jobUid() {
|
|
17
|
+
return "";
|
|
18
|
+
},
|
|
19
|
+
get jobUrl() {
|
|
20
|
+
return "";
|
|
21
|
+
},
|
|
22
|
+
get jobName() {
|
|
23
|
+
return "";
|
|
24
|
+
},
|
|
25
|
+
get jobRunUid() {
|
|
26
|
+
return "";
|
|
27
|
+
},
|
|
28
|
+
get jobRunUrl() {
|
|
29
|
+
return "";
|
|
30
|
+
},
|
|
31
|
+
get jobRunName() {
|
|
32
|
+
return "";
|
|
33
|
+
},
|
|
34
|
+
get jobRunBranch() {
|
|
35
|
+
const output = spawnSync("git", ["rev-parse", "--abbrev-ref", "HEAD"]);
|
|
36
|
+
if (output.error) {
|
|
37
|
+
return "";
|
|
38
|
+
}
|
|
39
|
+
return output.stdout.toString().trim();
|
|
40
|
+
},
|
|
41
|
+
get pullRequestUrl() {
|
|
42
|
+
return "";
|
|
43
|
+
},
|
|
44
|
+
get pullRequestName() {
|
|
45
|
+
return "";
|
|
46
|
+
},
|
|
47
|
+
};
|
package/dist/utils.d.ts
CHANGED
package/dist/utils.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allurereport/ci",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.24",
|
|
4
4
|
"description": "Utilities set to get useful report data from different CI",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"test": "rimraf ./out && vitest run"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@allurereport/core-api": "3.0.0-beta.
|
|
33
|
+
"@allurereport/core-api": "3.0.0-beta.24"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@stylistic/eslint-plugin": "^2.6.1",
|