Skip to content

Commit 4188aa2

Browse files
authored
Merge pull request #38 from jonesbusy/feature/modernize-plugin
Modernize plugin configuration and configure automatic releases
2 parents 62bbb44 + 572bdc6 commit 4188aa2

14 files changed

+103
-140
lines changed

Diff for: .github/dependabot.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- package-ecosystem: github-actions
2+
directory: /
3+
schedule:
4+
interval: weekly

Diff for: .github/workflows/cd.yaml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Note: additional setup is required, see https://www.jenkins.io/redirect/continuous-delivery-of-plugins
2+
3+
name: cd
4+
on:
5+
workflow_dispatch:
6+
check_run:
7+
types:
8+
- completed
9+
10+
jobs:
11+
maven-cd:
12+
uses: jenkins-infra/github-reusable-workflows/.github/workflows/maven-cd.yml@v1
13+
secrets:
14+
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
15+
MAVEN_TOKEN: ${{ secrets.MAVEN_TOKEN }}

Diff for: .mvn/extensions.xml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<extensions xmlns="http://maven.apache.org/EXTENSIONS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.0.0 http://maven.apache.org/xsd/core-extensions-1.0.0.xsd">
2+
<extension>
3+
<groupId>io.jenkins.tools.incrementals</groupId>
4+
<artifactId>git-changelist-maven-extension</artifactId>
5+
<version>1.4</version>
6+
</extension>
7+
</extensions>

Diff for: .mvn/maven.config

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-Pconsume-incrementals
2+
-Pmight-produce-incrementals
3+
-Dchangelist.format=%d.v%s

Diff for: Jenkinsfile

+10-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
1-
buildPlugin()
1+
/*
2+
See the documentation for more options:
3+
https://github.com/jenkins-infra/pipeline-library/
4+
*/
5+
buildPlugin(
6+
useContainerAgent: true, // Set to `false` if you need to use Docker for containerized tests
7+
configurations: [
8+
[platform: 'linux', jdk: 17],
9+
[platform: 'windows', jdk: 11],
10+
])

Diff for: pom.xml

+49-109
Original file line numberDiff line numberDiff line change
@@ -3,168 +3,108 @@
33
<parent>
44
<groupId>org.jenkins-ci.plugins</groupId>
55
<artifactId>plugin</artifactId>
6-
<version>2.19</version>
6+
<version>4.54</version>
7+
<relativePath />
78
</parent>
8-
99
<groupId>org.jenkins-ci.plugins</groupId>
1010
<artifactId>ansible</artifactId>
11-
<version>1.2-SNAPSHOT</version>
11+
<version>${changelist}</version>
1212
<packaging>hpi</packaging>
1313
<name>Jenkins Ansible plugin</name>
1414
<description>Ansible support in Jenkins</description>
15-
<url>https://github.com/jenkinsci/ansible-plugin</url>
16-
15+
<scm>
16+
<connection>scm:git:git://github.com/${gitHubRepo}.git</connection>
17+
<developerConnection>scm:git:[email protected]:${gitHubRepo}.git</developerConnection>
18+
<url>https://github.com/${gitHubRepo}</url>
19+
<tag>${scmTag}</tag>
20+
</scm>
21+
<properties>
22+
<changelist>999999-SNAPSHOT</changelist>
23+
<gitHubRepo>jenkinsci/ansible-plugin</gitHubRepo>
24+
<jenkins.version>2.361.4</jenkins.version>
25+
</properties>
1726
<licenses>
1827
<license>
1928
<name>Apache License, Version 2.0</name>
2029
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
2130
<distribution>repo</distribution>
2231
</license>
2332
</licenses>
24-
25-
<developers>
26-
<developer>
27-
<id>jcsirot</id>
28-
<name>Jean-Christophe Sirot</name>
29-
<email>[email protected]</email>
30-
</developer>
31-
</developers>
32-
33-
<scm>
34-
<connection>scm:git:ssh://github.com/jenkinsci/ansible-plugin.git</connection>
35-
<developerConnection>scm:git:ssh://[email protected]/jenkinsci/ansible-plugin.git</developerConnection>
36-
<url>https://github.com/jenkinsci/ansible-plugin</url>
37-
<tag>HEAD</tag>
38-
</scm>
39-
40-
<repositories>
41-
<repository>
42-
<id>repo.jenkins-ci.org</id>
43-
<url>https://repo.jenkins-ci.org/public/</url>
44-
</repository>
45-
</repositories>
46-
<pluginRepositories>
47-
<pluginRepository>
48-
<id>repo.jenkins-ci.org</id>
49-
<url>https://repo.jenkins-ci.org/public/</url>
50-
</pluginRepository>
51-
</pluginRepositories>
52-
33+
<dependencyManagement>
34+
<dependencies>
35+
<dependency>
36+
<groupId>io.jenkins.tools.bom</groupId>
37+
<artifactId>bom-2.361.x</artifactId>
38+
<version>1798.vc671fe94856f</version>
39+
<scope>import</scope>
40+
<type>pom</type>
41+
</dependency>
42+
</dependencies>
43+
</dependencyManagement>
5344
<dependencies>
5445
<dependency>
5546
<groupId>org.jenkins-ci.plugins</groupId>
5647
<artifactId>credentials</artifactId>
57-
<version>${credentials.version}</version>
5848
</dependency>
5949
<dependency>
6050
<groupId>org.jenkins-ci.plugins</groupId>
6151
<artifactId>ssh-credentials</artifactId>
62-
<version>${ssh-credentials.version}</version>
6352
</dependency>
6453
<dependency>
6554
<groupId>org.jenkins-ci.plugins</groupId>
6655
<artifactId>plain-credentials</artifactId>
67-
<version>${plain-credentials.version}</version>
6856
</dependency>
6957
<dependency>
7058
<groupId>org.jenkins-ci.plugins.workflow</groupId>
7159
<artifactId>workflow-step-api</artifactId>
72-
<version>${workflow-step-api.version}</version>
7360
<optional>true</optional>
7461
</dependency>
7562
<dependency>
7663
<groupId>org.jenkins-ci.plugins</groupId>
7764
<artifactId>job-dsl</artifactId>
78-
<version>${job-dsl.version}</version>
65+
<version>1.81</version>
7966
<optional>true</optional>
8067
</dependency>
8168
<dependency>
8269
<groupId>org.jenkins-ci</groupId>
8370
<artifactId>symbol-annotation</artifactId>
84-
<version>${symbol-annotation.version}</version>
8571
<optional>true</optional>
8672
</dependency>
8773
<!-- Test -->
8874
<dependency>
8975
<groupId>junit</groupId>
9076
<artifactId>junit</artifactId>
91-
<version>${junit.version}</version>
9277
<scope>test</scope>
9378
</dependency>
9479
<dependency>
9580
<groupId>org.assertj</groupId>
9681
<artifactId>assertj-core</artifactId>
97-
<version>${assertj.version}</version>
82+
<version>3.24.2</version>
83+
<scope>test</scope>
9884
</dependency>
9985
<dependency>
10086
<groupId>org.mockito</groupId>
101-
<artifactId>mockito-all</artifactId>
102-
<version>${mockito.version}</version>
87+
<artifactId>mockito-core</artifactId>
88+
<version>5.1.0</version>
89+
<scope>test</scope>
90+
</dependency>
91+
<dependency>
92+
<groupId>org.mockito</groupId>
93+
<artifactId>mockito-inline</artifactId>
94+
<version>5.1.0</version>
10395
<scope>test</scope>
10496
</dependency>
10597
</dependencies>
106-
107-
<build>
108-
<pluginManagement>
109-
<plugins>
110-
<plugin>
111-
<groupId>org.apache.maven.plugins</groupId>
112-
<artifactId>maven-compiler-plugin</artifactId>
113-
<version>${maven-compiler-plugin.version}</version>
114-
<configuration>
115-
<encoding>${project.build.sourceEncoding}</encoding>
116-
<source>1.6</source>
117-
<target>1.6</target>
118-
</configuration>
119-
</plugin>
120-
<plugin>
121-
<groupId>org.apache.maven.plugins</groupId>
122-
<artifactId>maven-resources-plugin</artifactId>
123-
<version>${maven-resources-plugin.version}</version>
124-
<configuration>
125-
<encoding>${project.build.sourceEncoding}</encoding>
126-
</configuration>
127-
</plugin>
128-
<plugin>
129-
<groupId>org.apache.maven.plugins</groupId>
130-
<artifactId>maven-release-plugin</artifactId>
131-
<version>${maven-release-plugin.version}</version>
132-
</plugin>
133-
<plugin>
134-
<groupId>org.apache.commons</groupId>
135-
<artifactId>commons-lang3</artifactId>
136-
<version>${commons-lang.version.version}</version>
137-
</plugin>
138-
</plugins>
139-
</pluginManagement>
140-
<plugins>
141-
<plugin>
142-
<groupId>org.jenkins-ci.tools</groupId>
143-
<artifactId>maven-hpi-plugin</artifactId>
144-
<extensions>true</extensions>
145-
<configuration>
146-
<compatibleSinceVersion>1.0</compatibleSinceVersion>
147-
</configuration>
148-
</plugin>
149-
</plugins>
150-
</build>
151-
152-
<properties>
153-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
154-
<jenkins.version>1.609.1</jenkins.version>
155-
<maven-compiler-plugin.version>3.2</maven-compiler-plugin.version>
156-
<maven-resources-plugin.version>2.6</maven-resources-plugin.version>
157-
<maven-release-plugin.version>2.5.2</maven-release-plugin.version>
158-
<ssh-credentials.version>1.10</ssh-credentials.version>
159-
<plain-credentials.version>1.4</plain-credentials.version>
160-
<credentials.version>2.1.0</credentials.version>
161-
<workflow-step-api.version>1.10</workflow-step-api.version>
162-
<junit.version>4.12</junit.version>
163-
<mockito.version>1.10.19</mockito.version>
164-
<assertj.version>1.7.1</assertj.version>
165-
<commons-lang.version>3.4</commons-lang.version>
166-
<job-dsl.version>1.36</job-dsl.version>
167-
<symbol-annotation.version>1.14</symbol-annotation.version>
168-
</properties>
169-
170-
</project>
98+
<repositories>
99+
<repository>
100+
<id>repo.jenkins-ci.org</id>
101+
<url>https://repo.jenkins-ci.org/public/</url>
102+
</repository>
103+
</repositories>
104+
<pluginRepositories>
105+
<pluginRepository>
106+
<id>repo.jenkins-ci.org</id>
107+
<url>https://repo.jenkins-ci.org/public/</url>
108+
</pluginRepository>
109+
</pluginRepositories>
110+
</project>

Diff for: src/main/java/org/jenkinsci/plugins/ansible/AnsibleAdHocCommandBuilder.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ public void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath ws, @Nonnull Launc
225225
}
226226
} catch (IOException ioe) {
227227
Util.displayIOException(ioe, listener);
228-
ioe.printStackTrace(listener.fatalError(hudson.tasks.Messages.CommandInterpreter_CommandFailed()));
228+
ioe.printStackTrace(listener.fatalError("command execution failed"));
229229
throw ioe;
230230
} catch (AnsibleInvocationException aie) {
231231
listener.fatalError(aie.getMessage());

Diff for: src/main/java/org/jenkinsci/plugins/ansible/AnsiblePlaybookBuilder.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ public void perform(@Nonnull Run<?, ?> run, @Nonnull Node node, @Nonnull FilePat
263263
}
264264
} catch (IOException ioe) {
265265
Util.displayIOException(ioe, listener);
266-
ioe.printStackTrace(listener.fatalError(hudson.tasks.Messages.CommandInterpreter_CommandFailed()));
266+
ioe.printStackTrace(listener.fatalError("command execution failed"));
267267
throw ioe;
268268
} catch (AnsibleInvocationException aie) {
269269
listener.fatalError(aie.getMessage());

Diff for: src/main/java/org/jenkinsci/plugins/ansible/AnsibleVaultBuilder.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public void perform(@Nonnull Run<?, ?> run, @Nonnull Node node, @Nonnull FilePat
131131
}
132132
} catch (IOException ioe) {
133133
Util.displayIOException(ioe, listener);
134-
ioe.printStackTrace(listener.fatalError(hudson.tasks.Messages.CommandInterpreter_CommandFailed()));
134+
ioe.printStackTrace(listener.fatalError("command execution failed"));
135135
throw ioe;
136136
} catch (AnsibleInvocationException aie) {
137137
listener.fatalError(aie.getMessage());

Diff for: src/test/java/org/jenkinsci/plugins/ansible/AnsibleAdHocCommandInvocationTest.java

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
package org.jenkinsci.plugins.ansible;
22

3-
import static org.assertj.core.api.Assertions.assertThat;
4-
import static org.mockito.Matchers.any;
5-
import static org.mockito.Matchers.anyMap;
6-
import static org.mockito.Mockito.mock;
7-
import static org.mockito.Mockito.verify;
8-
import static org.mockito.Mockito.when;
3+
import static org.assertj.core.api.Assertions.*;
4+
import static org.mockito.Mockito.*;
95

106
import java.util.Map;
117

Diff for: src/test/java/org/jenkinsci/plugins/ansible/AnsibleVaultInvocationTest.java

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
package org.jenkinsci.plugins.ansible;
22

3-
import static org.assertj.core.api.Assertions.assertThat;
4-
import static org.mockito.Matchers.any;
5-
import static org.mockito.Matchers.anyMap;
6-
import static org.mockito.Mockito.mock;
7-
import static org.mockito.Mockito.verify;
8-
import static org.mockito.Mockito.when;
3+
import static org.assertj.core.api.Assertions.*;
4+
import static org.mockito.Mockito.*;
95

106
import java.io.IOException;
117

Diff for: src/test/java/org/jenkinsci/plugins/ansible/CompatibilityTest.java

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.jenkinsci.plugins.ansible;
22

3-
import hudson.model.AbstractProject;
43
import hudson.model.FreeStyleProject;
54
import org.junit.Rule;
65
import org.junit.Test;

Diff for: src/test/java/org/jenkinsci/plugins/ansible/jobdsl/DslJobRule.java

+7-13
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import static java.lang.annotation.RetentionPolicy.RUNTIME;
55
import static org.hamcrest.Matchers.hasItem;
66
import static org.hamcrest.Matchers.is;
7-
import static org.junit.Assert.assertThat;
7+
import static org.hamcrest.MatcherAssert.assertThat;
88

99
import java.lang.annotation.Retention;
1010
import java.lang.annotation.Target;
@@ -52,18 +52,12 @@ private void before(Description description) throws Exception {
5252
String script = description.getAnnotation(WithJobDsl.class).value();
5353
String scriptText = Resources.toString(Resources.getResource(script), Charsets.UTF_8);
5454

55-
job.getBuildersList().add(
56-
new ExecuteDslScripts(
57-
new ExecuteDslScripts.ScriptLocation(
58-
null, null,
59-
scriptText
60-
),
61-
false,
62-
RemovedJobAction.DELETE,
63-
RemovedViewAction.DELETE,
64-
LookupStrategy.JENKINS_ROOT
65-
)
66-
);
55+
ExecuteDslScripts builder = new ExecuteDslScripts();
56+
builder.setScriptText(scriptText);
57+
builder.setRemovedJobAction(RemovedJobAction.DELETE);
58+
builder.setRemovedViewAction(RemovedViewAction.DELETE);
59+
builder.setLookupStrategy(LookupStrategy.JENKINS_ROOT);
60+
job.getBuildersList().add(builder);
6761

6862
jRule.buildAndAssertSuccess(job);
6963

Diff for: src/test/java/org/jenkinsci/plugins/ansible/jobdsl/JobDslIntegrationTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import static org.hamcrest.Matchers.is;
44
import static org.hamcrest.Matchers.isA;
55
import static org.hamcrest.Matchers.notNullValue;
6-
import static org.junit.Assert.assertThat;
6+
import static org.hamcrest.MatcherAssert.assertThat;
77

88
import org.hamcrest.Matcher;
99
import org.jenkinsci.plugins.ansible.AnsibleAdHocCommandBuilder;

0 commit comments

Comments
 (0)