Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI and VCS provider for GitLab Server #1160

Open
huseyin-tumer opened this issue Jul 26, 2022 · 1 comment
Open

CI and VCS provider for GitLab Server #1160

huseyin-tumer opened this issue Jul 26, 2022 · 1 comment
Labels
good first issue Good for newcomers

Comments

@huseyin-tumer
Copy link

Hi,
Firstly many thanks for plugin.
I am using GitLab server. Could you please add ci and vcs providers for GitLab server?

@YOU54F
Copy link
Owner

YOU54F commented Dec 9, 2022

Happy to accept a PR!

You just need to find out the relevant GitLab env vars and map them here

switch (ciProvider) {
case "circleci":
{
(CI_SHA1 = process.env.CIRCLE_SHA1),
(CI_BRANCH = process.env.CIRCLE_BRANCH),
(CI_USERNAME = process.env.CIRCLE_USERNAME),
(CI_BUILD_URL = process.env.CIRCLE_BUILD_URL),
(CI_BUILD_NUM = process.env.CIRCLE_BUILD_NUM),
(CI_PULL_REQUEST = process.env.CIRCLE_PULL_REQUEST),
(CI_PROJECT_REPONAME = process.env.CIRCLE_PROJECT_REPONAME),
(CI_PROJECT_USERNAME = process.env.CIRCLE_PROJECT_USERNAME),
(JOB_NAME = process.env.CIRCLE_JOB);
CIRCLE_PROJECT_ID = process.env.CIRCLE_PROJECT_ID;
CIRCLE_WORKFLOW_JOB_ID = process.env.CIRCLE_WORKFLOW_JOB_ID;
}
break;
case "github":
{
(CI_SHA1 = process.env.GITHUB_SHA),
(CI_BRANCH =
process.env.GITHUB_BASE_REF || process.env.GITHUB_HEAD_REF),
(CI_USERNAME = process.env.GITHUB_ACTOR),
(CI_BUILD_URL = process.env.CIRCLE_BUILD_URL || "CI_BUILD_URL"),
(CI_BUILD_NUM = process.env.CIRCLE_BUILD_NUM || "CIRCLE_BUILD_NUM"),
(CI_PULL_REQUEST =
process.env.CIRCLE_PULL_REQUEST || "CIRCLE_PULL_REQUEST"),
(CI_PROJECT_REPONAME = process.env.GITHUB_REPOSITORY), // The owner and repository name. For example, octocat/Hello-World.
(CI_PROJECT_USERNAME = process.env.GITHUB_REPOSITORY_OWNER),
(JOB_NAME = process.env.GITHUB_ACTION);
CIRCLE_PROJECT_ID =
process.env.CIRCLE_PROJECT_ID || "CIRCLE_PROJECT_ID";
}
break;
case "jenkins":
{
if (typeof process.env.GIT_URL === "undefined") {
throw new Error("GIT_URL not defined!");
}
const urlParts = process.env.GIT_URL.replace(
"https://github.com/",
""
).replace(".git", "");
const arr = urlParts.split("/");
(CI_SHA1 = process.env.GIT_COMMIT),
(CI_BRANCH = process.env.BRANCH_NAME),
(CI_USERNAME = process.env.CHANGE_AUTHOR),
(CI_BUILD_URL = process.env.BUILD_URL),
(CI_BUILD_NUM = process.env.BUILD_ID),
(CI_PULL_REQUEST = process.env.CHANGE_ID),
(CI_PROJECT_REPONAME = arr[1]),
(CI_PROJECT_USERNAME = arr[0]);
}
break;
case "bitbucket": {
(CI_SHA1 = process.env.BITBUCKET_COMMIT),
(CI_BUILD_NUM = process.env.BITBUCKET_BUILD_NUMBER),
(CI_PROJECT_REPONAME = process.env.BITBUCKET_REPO_SLUG),
(CI_PROJECT_USERNAME = process.env.BITBUCKET_WORKSPACE);
break;
}
default: {
break;

Just dropping these here for anyone that wants to pick it up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants