Skip to content

Commit

Permalink
Merge pull request #96 from basil/refresh
Browse files Browse the repository at this point in the history
Refresh plugin
  • Loading branch information
klimas7 authored Jun 27, 2023
2 parents 20baddb + e787f29 commit 149e028
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 72 deletions.
5 changes: 4 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
buildPlugin(platforms: ['linux'], jdkVersions: [8])
buildPlugin(useContainerAgent: true, configurations: [
[platform: 'linux', jdk: 17],
[platform: 'windows', jdk: 11],
])
66 changes: 18 additions & 48 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.31</version>
<version>4.63</version>
<relativePath />
</parent>

Expand All @@ -29,10 +29,9 @@
</repositories>

<properties>
<java.level>8</java.level>
<!-- Baseline Jenkins version you use to build and test the plugin. Users
must have this version or newer to run. -->
<jenkins.version>2.319.3</jenkins.version>
<jenkins.version>2.361.4</jenkins.version>
</properties>

<developers>
Expand All @@ -54,87 +53,59 @@
</pluginRepository>
</pluginRepositories>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.361.x</artifactId>
<version>2081.v85885a_d2e5c5</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>git</artifactId>
<version>4.11.2</version>
<exclusions>
<exclusion>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.jenkins.plugins</groupId>
<artifactId>jquery3-api</artifactId>
<version>3.6.0-4</version>
<groupId>io.jenkins.plugins</groupId>
<artifactId>jquery3-api</artifactId>
</dependency>
<dependency>
<groupId>com.sonyericsson.hudson.plugins.rebuild</groupId>
<artifactId>rebuild</artifactId>
<version>1.32</version>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>matrix-project</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- Test scope -->
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>junit</artifactId>
<version>1.53</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>script-security</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>4.1.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-aggregator</artifactId>
<version>2.6</version>
<version>596.v8c21c963d92d</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-support</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-support</artifactId>
<version>3.8</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>template-project</artifactId>
<version>1.5.2</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</exclusion>
<exclusion>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>matrix-project</artifactId>
</exclusion>
</exclusions>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
Expand All @@ -145,7 +116,6 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>matrix-project</artifactId>
<version>1.20</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package net.uaznia.lukanus.hudson.plugins.gitparameter;

import hudson.EnvVars;
import hudson.Functions;
import hudson.cli.CLICommand;
import hudson.cli.ConsoleCommand;
import hudson.model.*;
Expand All @@ -10,6 +11,7 @@
import hudson.plugins.git.extensions.impl.RelativeTargetDirectory;
import hudson.plugins.templateproject.ProxySCM;
import hudson.scm.SCM;
import hudson.tasks.BatchFile;
import hudson.tasks.Shell;
import hudson.util.FormValidation;
import hudson.util.FormValidation.Kind;
Expand Down Expand Up @@ -96,7 +98,7 @@ public void testDoFillValueItems_withoutSCM() throws Exception {
@Test
public void testDoFillValueItems_listTags() throws Exception {
project = jenkins.createFreeStyleProject("testListTags");
project.getBuildersList().add(new Shell("echo test"));
project.getBuildersList().add(Functions.isWindows() ? new BatchFile("echo test") : new Shell("echo test"));
setupGit();

GitParameterDefinition def = new GitParameterDefinition("testName",
Expand All @@ -119,7 +121,7 @@ public void testDoFillValueItems_listTags() throws Exception {
@Test
public void testGetListBranchNoBuildProject() throws Exception {
project = jenkins.createFreeStyleProject("testListTags");
project.getBuildersList().add(new Shell("echo test"));
project.getBuildersList().add(Functions.isWindows() ? new BatchFile("echo test") : new Shell("echo test"));
setupGit();

GitParameterDefinition def = new GitParameterDefinition("testName",
Expand All @@ -139,7 +141,7 @@ public void testGetListBranchNoBuildProject() throws Exception {
@Test
public void testGetListBranchAfterWipeOutWorkspace() throws Exception {
project = jenkins.createFreeStyleProject("testListTags");
project.getBuildersList().add(new Shell("echo test"));
project.getBuildersList().add(Functions.isWindows() ? new BatchFile("echo test") : new Shell("echo test"));
setupGit();

GitParameterDefinition def = new GitParameterDefinition("testName",
Expand All @@ -162,7 +164,7 @@ public void testGetListBranchAfterWipeOutWorkspace() throws Exception {
@Test
public void testDoFillValueItems_listBranches() throws Exception {
project = jenkins.createFreeStyleProject("testListTags");
project.getBuildersList().add(new Shell("echo test"));
project.getBuildersList().add(Functions.isWindows() ? new BatchFile("echo test") : new Shell("echo test"));
setupGit();

GitParameterDefinition def = new GitParameterDefinition("testName",
Expand All @@ -185,7 +187,7 @@ public void testDoFillValueItems_listBranches() throws Exception {
@Test
public void tesListBranchesWrongBranchFilter() throws Exception {
project = jenkins.createFreeStyleProject("testListTags");
project.getBuildersList().add(new Shell("echo test"));
project.getBuildersList().add(Functions.isWindows() ? new BatchFile("echo test") : new Shell("echo test"));
setupGit();

GitParameterDefinition def = new GitParameterDefinition("testName",
Expand All @@ -205,7 +207,7 @@ public void tesListBranchesWrongBranchFilter() throws Exception {
@Test
public void testDoFillValueItems_listBranches_withRegexGroup() throws Exception {
project = jenkins.createFreeStyleProject("testListTags");
project.getBuildersList().add(new Shell("echo test"));
project.getBuildersList().add(Functions.isWindows() ? new BatchFile("echo test") : new Shell("echo test"));
setupGit();

GitParameterDefinition def = new GitParameterDefinition("testName",
Expand All @@ -229,7 +231,7 @@ public void testDoFillValueItems_listBranches_withRegexGroup() throws Exception
@Test
public void testSortAscendingTag() throws Exception {
project = jenkins.createFreeStyleProject("testListTags");
project.getBuildersList().add(new Shell("echo test"));
project.getBuildersList().add(Functions.isWindows() ? new BatchFile("echo test") : new Shell("echo test"));
setupGit();

GitParameterDefinition def = new GitParameterDefinition("testName",
Expand All @@ -249,7 +251,7 @@ public void testSortAscendingTag() throws Exception {
@Test
public void testWrongTagFilter() throws Exception {
project = jenkins.createFreeStyleProject("testListTags");
project.getBuildersList().add(new Shell("echo test"));
project.getBuildersList().add(Functions.isWindows() ? new BatchFile("echo test") : new Shell("echo test"));
setupGit();

GitParameterDefinition def = new GitParameterDefinition("testName",
Expand All @@ -269,7 +271,7 @@ public void testWrongTagFilter() throws Exception {
@Test
public void testSortDescendingTag() throws Exception {
project = jenkins.createFreeStyleProject("testListTags");
project.getBuildersList().add(new Shell("echo test"));
project.getBuildersList().add(Functions.isWindows() ? new BatchFile("echo test") : new Shell("echo test"));
setupGit();

GitParameterDefinition def = new GitParameterDefinition("testName",
Expand All @@ -289,7 +291,7 @@ public void testSortDescendingTag() throws Exception {
@Test
public void testDoFillValueItems_listTagsAndBranches() throws Exception {
project = jenkins.createFreeStyleProject("testListTags");
project.getBuildersList().add(new Shell("echo test"));
project.getBuildersList().add(Functions.isWindows() ? new BatchFile("echo test") : new Shell("echo test"));
setupGit();

GitParameterDefinition def = new GitParameterDefinition("testName",
Expand All @@ -313,7 +315,7 @@ public void testDoFillValueItems_listTagsAndBranches() throws Exception {
@Test
public void testDoFillValueItems_listRevisions() throws Exception {
project = jenkins.createFreeStyleProject("testListRevisions");
project.getBuildersList().add(new Shell("echo test"));
project.getBuildersList().add(Functions.isWindows() ? new BatchFile("echo test") : new Shell("echo test"));
setupGit();

GitParameterDefinition def = new GitParameterDefinition("testName",
Expand All @@ -338,7 +340,7 @@ public void testDoFillValueItems_listRevisions() throws Exception {
@Test
public void testDoFillValueItems_listRevisionsWithBranch() throws Exception {
project = jenkins.createFreeStyleProject("testListRevisions");
project.getBuildersList().add(new Shell("echo test"));
project.getBuildersList().add(Functions.isWindows() ? new BatchFile("echo test") : new Shell("echo test"));
setupGit();
GitParameterDefinition def = new GitParameterDefinition("testName",
PT_REVISION,
Expand All @@ -360,7 +362,7 @@ public void testDoFillValueItems_listRevisionsWithBranch() throws Exception {
@Test
public void testDoFillValueItems_listPullRequests() throws Exception {
project = jenkins.createFreeStyleProject("testListPullRequests");
project.getBuildersList().add(new Shell("echo test"));
project.getBuildersList().add(Functions.isWindows() ? new BatchFile("echo test") : new Shell("echo test"));
setupGit();
GitParameterDefinition def = new GitParameterDefinition("testName",
Consts.PARAMETER_TYPE_PULL_REQUEST,
Expand Down Expand Up @@ -444,7 +446,7 @@ public void testDefaultValueIsNotRequired() {
@Test
public void testGetDefaultValueWhenDefaultValueIsSet() throws Exception {
project = jenkins.createFreeStyleProject("testDefaultValue");
project.getBuildersList().add(new Shell("echo test"));
project.getBuildersList().add(Functions.isWindows() ? new BatchFile("echo test") : new Shell("echo test"));
setupGit();
String testDefaultValue = "testDefaultValue";
GitParameterDefinition def = new GitParameterDefinition("testName",
Expand All @@ -464,7 +466,7 @@ public void testGetDefaultValueWhenDefaultValueIsSet() throws Exception {
@Test
public void testGetDefaultValueAsTop() throws Exception {
project = jenkins.createFreeStyleProject("testDefaultValueAsTOP");
project.getBuildersList().add(new Shell("echo test"));
project.getBuildersList().add(Functions.isWindows() ? new BatchFile("echo test") : new Shell("echo test"));
setupGit();
GitParameterDefinition def = new GitParameterDefinition("testName",
Consts.PARAMETER_TYPE_TAG,
Expand All @@ -484,7 +486,7 @@ public void testGetDefaultValueAsTop() throws Exception {
public void testGlobalVariableRepositoryUrl() throws Exception {
EnvVars.masterEnvVars.put("GIT_REPO_URL", GIT_PARAMETER_REPOSITORY_URL);
project = jenkins.createFreeStyleProject("testGlobalValue");
project.getBuildersList().add(new Shell("echo test"));
project.getBuildersList().add(Functions.isWindows() ? new BatchFile("echo test") : new Shell("echo test"));
setupGit("$GIT_REPO_URL");
GitParameterDefinition def = new GitParameterDefinition("testName",
Consts.PARAMETER_TYPE_BRANCH,
Expand Down Expand Up @@ -625,7 +627,7 @@ public void testWorkflowJobWithCpsFlowDefinition() throws IOException, Interrupt
@Test
public void testProxySCM() throws IOException {
FreeStyleProject anotherProject = jenkins.createFreeStyleProject("AnotherProject");
anotherProject.getBuildersList().add(new Shell("echo test"));
anotherProject.getBuildersList().add(Functions.isWindows() ? new BatchFile("echo test") : new Shell("echo test"));
anotherProject.setScm(getGitSCM());

project = jenkins.createFreeStyleProject("projectHaveProxySCM");
Expand All @@ -648,7 +650,7 @@ public void testProxySCM() throws IOException {
@Test
public void testParameterDefinedRepositoryUrl() throws Exception {
project = jenkins.createFreeStyleProject("testLocalValue");
project.getBuildersList().add(new Shell("echo test"));
project.getBuildersList().add(Functions.isWindows() ? new BatchFile("echo test") : new Shell("echo test"));

StringParameterDefinition stringParameterDef = new StringParameterDefinition("GIT_REPO_URL", GIT_PARAMETER_REPOSITORY_URL, "Description");
GitParameterDefinition def = new GitParameterDefinition("testName",
Expand All @@ -673,7 +675,7 @@ public void testParameterDefinedRepositoryUrl() throws Exception {
@Test
public void testMultiRepositoryInOneSCM() throws IOException {
project = jenkins.createFreeStyleProject("projectHaveMultiRepositoryInOneSCM");
project.getBuildersList().add(new Shell("echo test"));
project.getBuildersList().add(Functions.isWindows() ? new BatchFile("echo test") : new Shell("echo test"));
SCM gitSCM = getGitSCM(EXAMPLE_REPOSITORY_A_URL, EXAMPLE_REPOSITORY_B_URL);
project.setScm(gitSCM);

Expand Down Expand Up @@ -701,7 +703,7 @@ public void testMultiRepositoryInOneSCM() throws IOException {
@Test
public void testMultiSCM() throws IOException {
project = jenkins.createFreeStyleProject("projectHaveMultiSCM");
project.getBuildersList().add(new Shell("echo test"));
project.getBuildersList().add(Functions.isWindows() ? new BatchFile("echo test") : new Shell("echo test"));
MultiSCM multiSCM = new MultiSCM(Arrays.asList(getGitSCM(EXAMPLE_REPOSITORY_A_URL), getGitSCM(EXAMPLE_REPOSITORY_B_URL)));
project.setScm(multiSCM);

Expand All @@ -728,7 +730,7 @@ public void testMultiSCM() throws IOException {
@Test
public void testMultiSCM_forSubdirectoryForRepo() throws IOException {
project = jenkins.createFreeStyleProject("projectHaveMultiSCM");
project.getBuildersList().add(new Shell("echo test"));
project.getBuildersList().add(Functions.isWindows() ? new BatchFile("echo test") : new Shell("echo test"));
GitSCM gitSCM = (GitSCM) getGitSCM(GIT_CLIENT_REPOSITORY_URL);
gitSCM.getExtensions().add(new RelativeTargetDirectory("subDirectory"));
MultiSCM multiSCM = new MultiSCM(Arrays.asList(getGitSCM(), gitSCM));
Expand All @@ -755,7 +757,7 @@ public void testMultiSCM_forSubdirectoryForRepo() throws IOException {
@Test
public void testMultiSCM_forSubdirectoryForTheSomeRepo() throws IOException {
project = jenkins.createFreeStyleProject("projectHaveMultiSCM");
project.getBuildersList().add(new Shell("echo test"));
project.getBuildersList().add(Functions.isWindows() ? new BatchFile("echo test") : new Shell("echo test"));
GitSCM gitSCM = (GitSCM) getGitSCM(GIT_CLIENT_REPOSITORY_URL);
gitSCM.getExtensions().add(new RelativeTargetDirectory("subDirectory"));
MultiSCM multiSCM = new MultiSCM(Arrays.asList(getGitSCM(GIT_CLIENT_REPOSITORY_URL), gitSCM));
Expand Down Expand Up @@ -784,7 +786,7 @@ public void testMultiSCM_forSubdirectoryForTheSomeRepo() throws IOException {
@Test
public void testMultiSCM_repositoryUrlIsNotSet() throws IOException {
project = jenkins.createFreeStyleProject("projectHaveMultiSCM");
project.getBuildersList().add(new Shell("echo test"));
project.getBuildersList().add(Functions.isWindows() ? new BatchFile("echo test") : new Shell("echo test"));
GitSCM gitSCM = (GitSCM) getGitSCM(GIT_CLIENT_REPOSITORY_URL);
gitSCM.getExtensions().add(new RelativeTargetDirectory("subDirectory"));
MultiSCM multiSCM = new MultiSCM(Arrays.asList(getGitSCM(""), gitSCM));
Expand Down

0 comments on commit 149e028

Please sign in to comment.