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

feature: including new logic to handle versions from gitlab tags and … #877

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,21 @@ else if (GitUtil.isCircleCi(providerFactory)) {
logger.lifecycle("Using CIRCLE_BRANCH '{}' as version: {}", circleBranch, version);
return version;
}

} else if (GitUtil.isGitLab(providerFactory)) {
Provider<String> gitLabTag = providerFactory.environmentVariable("CI_COMMIT_TAG");
if (gitLabTag.isPresent()) {
String version = resolveTagVersion(gitLabTag.get().trim());
logger.lifecycle("Using CI_COMMIT_TAG '{}' as version: {}", gitLabTag, version);
return version;
}

Provider<String> gitLabBranch = providerFactory.environmentVariable("CI_COMMIT_BRANCH");
if (gitLabBranch.isPresent()) {
String version = resolveBranchVersion(gitLabBranch.get());
logger.lifecycle("Using CI_COMMIT_BRANCH '{}' as version: {}", gitLabBranch, version);
return version;
}
}

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ public boolean isJenkins(ProviderFactory providerFactory) {
return providerFactory.environmentVariable("JENKINS_HOME").isPresent();
}

public boolean isGitLab(ProviderFactory providerFactory) {
return providerFactory.environmentVariable("GITLAB_CI").isPresent();
}

public String getSha(Project project) {
if (isGithubActions(project.getProviders())) {
return project.getProviders().environmentVariable("GITHUB_SHA").get();
Expand Down
Loading