Innovenergy_trunk/frontend/node_modules/testcafe-reporter-dashboard/lib/env/ci-detection.js

75 lines
3.4 KiB
JavaScript
Raw Permalink Normal View History

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.detectCISystem = exports.CISystems = void 0;
const utils_1 = require("./utils");
const AWS_CODE_BUILD_RE = /^CODEBUILD_/;
const CONCOURSE_RE = /^CONCOURSE_/;
const CODESHIP_CI_NAME = 'codeship';
var CISystems;
(function (CISystems) {
CISystems["appVeyor"] = "AppVeyor";
CISystems["awsCodeBuild"] = "AWSCodeBuild";
CISystems["azure"] = "Azure";
CISystems["bamboo"] = "Bamboo";
CISystems["bitbucketPipelines"] = "BitbucketPipelines";
CISystems["buddy"] = "Buddy";
CISystems["buildkite"] = "Buildkite";
CISystems["circleCI"] = "CircleCI";
CISystems["codeFresh"] = "CodeFresh";
CISystems["codeship"] = "Codeship";
CISystems["concourse"] = "Concourse";
CISystems["drone"] = "Drone";
CISystems["gitlab"] = "GitLab";
CISystems["goCD"] = "GoCD";
CISystems["googleCloud"] = "GoogleCloud";
CISystems["githubActions"] = "GithubActions";
CISystems["jenkins"] = "Jenkins";
CISystems["layerCI"] = "LayerCI";
CISystems["netlify"] = "Netlify";
CISystems["semaphore"] = "Semaphore";
CISystems["shippable"] = "Shippable";
CISystems["teamCity"] = "TeamCity";
CISystems["teamFoundation"] = "TeamFoundation";
CISystems["travis"] = "Travis";
CISystems["wercker"] = "Wercker";
})(CISystems = exports.CISystems || (exports.CISystems = {}));
;
function detectCISystem() {
const { env } = process;
const ciDetectors = {
[CISystems.appVeyor]: utils_1.parseBooleanVariable(env.APPVEYOR),
[CISystems.awsCodeBuild]: Object.keys(env).find(key => AWS_CODE_BUILD_RE.test(key) && env[key]),
[CISystems.azure]: env.AZURE_HTTP_USER_AGENT,
[CISystems.bamboo]: env.bamboo_buildNumber,
[CISystems.bitbucketPipelines]: env.BITBUCKET_BUILD_NUMBER,
[CISystems.buddy]: utils_1.parseBooleanVariable(env.BUDDY),
[CISystems.buildkite]: utils_1.parseBooleanVariable(env.BUILDKITE),
[CISystems.circleCI]: utils_1.parseBooleanVariable(env.CIRCLECI),
[CISystems.codeFresh]: env.CF_BUILD_ID,
[CISystems.codeship]: utils_1.parseBooleanVariable(env.CODESHIP) || env.CI_NAME && env.CI_NAME.toLowerCase() === CODESHIP_CI_NAME,
[CISystems.concourse]: Object.keys(env).find(key => CONCOURSE_RE.test(key)),
[CISystems.drone]: utils_1.parseBooleanVariable(env.DRONE),
[CISystems.githubActions]: utils_1.parseBooleanVariable(env.GITHUB_ACTIONS),
[CISystems.gitlab]: utils_1.parseBooleanVariable(env.GITLAB_CI),
[CISystems.goCD]: env.GO_JOB_NAME,
[CISystems.googleCloud]: env.GCP_PROJECT,
[CISystems.jenkins]: env.JENKINS_HOME || env.JENKINS_URL,
[CISystems.layerCI]: utils_1.parseBooleanVariable(env.LAYERCI),
[CISystems.netlify]: utils_1.parseBooleanVariable(env.NETLIFY),
[CISystems.semaphore]: utils_1.parseBooleanVariable(env.SEMAPHORE),
[CISystems.shippable]: utils_1.parseBooleanVariable(env.SHIPPABLE),
[CISystems.teamCity]: utils_1.parseBooleanVariable(env.TEAMCITY_VERSION),
[CISystems.teamFoundation]: env.TF_BUILD_BUILDNUMBER,
[CISystems.travis]: utils_1.parseBooleanVariable(env.TRAVIS),
[CISystems.wercker]: utils_1.parseBooleanVariable(env.WERCKER)
};
for (const ciSystem of Object.values(CISystems)) {
if (ciDetectors[ciSystem])
return ciSystem;
}
;
return null;
}
exports.detectCISystem = detectCISystem;
;