Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

Commit

Permalink
Moderne v2 for GitLab
Browse files Browse the repository at this point in the history
  • Loading branch information
timtebeek committed Dec 27, 2023
1 parent dd4222d commit 27633e2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 49 deletions.
37 changes: 2 additions & 35 deletions src/main/java/io/moderne/connect/commands/GitLab.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,30 +192,6 @@ public class GitLab implements Callable<Integer> {
"the Expand button inside your GitLab repository.\n")
String downloadCLIPasswordSecretName;

@CommandLine.Option(names = "--gradlePluginVersion",
description = "The version of the Moderne Gradle plugin that should be used to build the artifacts.\n\n" +
"Will default to the environment variable @|bold MODERNE_GRADLE_PLUGIN_VERSION|@ or " +
"@|bold latest.release|@ if it doesn't exist.\n\n" +
"@|bold Example|@: 0.37.0\n",
defaultValue = "${MODERNE_GRADLE_PLUGIN_VERSION}")
String gradlePluginVersion;

@CommandLine.Option(names = "--mvnPluginVersion",
description = "The version of the Moderne Maven plugin that should be used to build the artifacts.\n\n" +
"Will default to the environment variable @|bold MODERNE_MVN_PLUGIN_VERSION|@ or " +
"@|bold RELEASE|@ if it doesn't exist.\n\n" +
"@|bold Example|@: v0.38.0\n",
defaultValue = "${MODERNE_MVN_PLUGIN_VERSION}")
String mvnPluginVersion;

@CommandLine.Option(
names = "--mirrorUrl",
defaultValue = "${MODERNE_MIRROR_URL}",
description = "For Gradle projects, this can be specified as a Maven repository cache/mirror to check " +
"before any other repositories.\n\n" +
"Will default to the environment variable @|bold MODERNE_MIRROR_URL|@ if one exists.\n")
String mirrorUrl;

@CommandLine.Option(
names = "--jobTag",
description = "If specified, GitLab jobs will be tagged with this value for runners to pick up.\n",
Expand Down Expand Up @@ -302,8 +278,8 @@ public Integer call() {
return 1;
}

if (!cliVersion.startsWith("v0.4") && !cliVersion.startsWith("v0.5") && !cliVersion.startsWith("v1")) {
System.err.println("Unsupported CLI version: " + cliVersion + ". Please use a version greater than v0.4");
if (!cliVersion.startsWith("v2")) {
System.err.println("Unsupported CLI version: " + cliVersion + ". Please use a version greater than v2");
return 1;
}

Expand Down Expand Up @@ -498,15 +474,6 @@ private String createConfigTenantCommand() {

private String createBuildCommand() {
String args = "build $REPO_PATH --no-download";
if (!StringUtils.isBlank(mirrorUrl)) {
args += " --mirror-url " + mirrorUrl;
}
if (!StringUtils.isBlank(gradlePluginVersion)) {
args += " --gradle-plugin-version " + gradlePluginVersion;
}
if (!StringUtils.isBlank(mvnPluginVersion)) {
args += " --maven-plugin-version " + mvnPluginVersion;
}
if (!StringUtils.isBlank(commandSuffix)) {
args += " " + commandSuffix;
}
Expand Down
15 changes: 1 addition & 14 deletions src/test/java/io/moderne/connect/commands/GitlabTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class GitlabTest {
void setup() {
gitlab.downloadCLI = true;
gitlab.platform = "linux";
gitlab.cliVersion = "v1.0.3";
gitlab.cliVersion = "v2.0.5";
}

@Nested
Expand Down Expand Up @@ -220,19 +220,6 @@ void modConfigModerneWithSecret() {
);
}

@Test
void submitJobWithMavenPluginVersion() {
gitlab.mvnPluginVersion = "5.0.2";
assertBuildSteps("./mod build $REPO_PATH --no-download --maven-plugin-version 5.0.2",
"./mod publish $REPO_PATH");
}

@Test
void submitJobWithGradlePluginVersion() {
gitlab.gradlePluginVersion = "5.0.2";
assertBuildSteps("./mod build $REPO_PATH --no-download --gradle-plugin-version 5.0.2",
"./mod publish $REPO_PATH");
}

@Test
void useProvidedGitLabCredentials() {
Expand Down

0 comments on commit 27633e2

Please sign in to comment.