Skip to content

Commit

Permalink
Update to the latest jenkins plugin version 4.1
Browse files Browse the repository at this point in the history
* update the pom definition to the jenkins plugin version 4.1
* update the plugin specific code to support plugin version 4.1 and
  be fully compatible with the casc plugin (configuration as code)
  • Loading branch information
fr123k authored and timja committed Jan 22, 2021
1 parent e7dfdb2 commit f4ca81d
Show file tree
Hide file tree
Showing 77 changed files with 613 additions and 530 deletions.
4 changes: 2 additions & 2 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
The MIT License

Copyright (c) 2020-, Frank Ittermann
Copyright (c) 2013-, Magnus Sandberg
Copyright (c) 2010-, Brad Larson

Expand All @@ -15,9 +16,8 @@ all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

28 changes: 28 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
DOCKER_COMMAND=docker run -it --rm --name priority-sorter -v $(PWD):/usr/src/priority-sorter -v "${HOME}/.m2":/root/.m2 --env-file ./maven.env -w /usr/src/priority-sorter maven:3-jdk-8

build: ## build priority sorter plugn
$(DOCKER_COMMAND) mvn install

plugin: ## create jenkins plugin archetype skeleton
$(DOCKER_COMMAND) mvn archetype:generate -Dfilter="io.jenkins.archetypes:"

test-coverage: clean ## package priority sorter plugin
$(DOCKER_COMMAND) mvn -P enable-jacoco -Dmaven.spotbugs.skip=true test verify

test: clean ## package priority sorter plugin
$(DOCKER_COMMAND) mvn -Dmaven.spotbugs.skip=true test

test-only: clean ## package priority sorter plugin
$(DOCKER_COMMAND) mvn -Djava.util.logging.config.file=./src/test/resources/logging.properties -Dtest=$(TEST_NAME) -Dmaven.spotbugs.skip=true test

package: clean ## package priority sorter plugin
$(DOCKER_COMMAND) mvn -P quick-build -Xlint:all -Dmaven.spotbugs.skip=true -Dmaven.test.skip=true versions:use-latest-versions package
cat target/classes/META-INF/annotations/hudson.Extension.txt

clean:
# delete all target foldes except jenkins-for-test reduce test time by 80 seconds
@bash -c $$'cd target; shopt -s extglob\nrm -rf !("jenkins-for-test"); cd ..'

spotbugs: ## package priority sorter plugin
$(DOCKER_COMMAND) mvn -Dmaven.test.skip=true install spotbugs:check
#spotbugs:gui
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,7 @@ The Sorter Strategies will allow you to select how you want the queue to be sort
The Priority Strategies will allow you to have different priorities based on how the Job is started. This enables you to give Jobs started directly by a user higher priority than Jobs started by cron or by a commit.

See Jenkins Wiki @ [Priority Sorter Plugin](https://wiki.jenkins-ci.org/display/JENKINS/Priority+Sorter+Plugin) for more information.

## Dependencies

* [job-restrictions](https://plugins.jenkins.io/job-restrictions/)
1 change: 1 addition & 0 deletions maven.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MAVEN_OPTS=-XX:+TieredCompilation -XX:TieredStopAtLevel=1
116 changes: 67 additions & 49 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.580</version>
</parent>
<artifactId>PrioritySorter</artifactId>
<version>3.6.1-SNAPSHOT</version>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.1</version>
<relativePath />
</parent>
<properties>
<jenkins.version>2.222.1</jenkins.version>
<java.level>8</java.level>
</properties>
<artifactId>PrioritySorter</artifactId>
<version>4.0.1-SNAPSHOT</version>
<packaging>hpi</packaging>
<name>Jenkins Priority Sorter Plugin</name>
<description>This plugin allows for the build queue to be sorted based on configurable Sorting and Priority Assigment Strategies.</description>
Expand All @@ -17,6 +22,7 @@
<name>MIT</name>
<url>http://www.opensource.org/licenses/mit-license.php</url>
<comments>
Copyright 2020- Frank Ittermann. All rights reserved.
Copyright 2013- Magnus Sandberg. All rights reserved.
Copyright 2010- Brad Larson. All rights reserved.
</comments>
Expand All @@ -25,6 +31,16 @@

<developers>
<developer>
<id>emsa23</id>
<name>Frank Ittermann</name>
<email>[email protected]</email>
<roles>
<role>developer</role>
<role>maintainer</role>
</roles>
<timezone>CET</timezone>
</developer>
<!-- Removed not to show on Wiki <developer>
<id>emsa23</id>
<name>Magnus Sandberg</name>
<email>[email protected]</email>
Expand All @@ -33,77 +49,79 @@
<role>maintainer</role>
</roles>
<timezone>CET</timezone>
</developer>
</developer> -->
<!-- Removed not to show on Wiki <developer> <id>bklarson</id> <name>Brad
Larson</name> <email>[email protected]</email> <roles> <role>developer</role>
<role>retired maintainer</role> </roles> <timezone>-6</timezone> </developer> -->
</developers>

<build>
<plugins>
<plugin>
<groupId>org.jenkins-ci.tools</groupId>
<artifactId>maven-hpi-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<compatibleSinceVersion>3.1</compatibleSinceVersion>
</configuration>
</plugin>
<!-- http://stackoverflow.com/questions/15166781/mvn-releaseprepare-not-committing-changes-to-pom-xml -->
<plugin>
<artifactId>maven-release-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-gitexe</artifactId>
<version>1.8.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.7</version>
<configuration>
<generateBackupPoms>false</generateBackupPoms>
<allowSnapshots>false</allowSnapshots>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>matrix-project</artifactId>
<version>1.4</version>
<version>1.14</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>cloudbees-folder</artifactId>
<version>5.0</version>
<version>6.12</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.synopsys.arc.jenkinsci.plugins</groupId>
<artifactId>job-restrictions</artifactId>
<version>0.4</version>
<version>0.8</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-durable-task-step</artifactId>
<version>2.4</version>
<version>2.35</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>structs</artifactId>
<version>1.20</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>script-security</artifactId>
<version>1.71</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>sectioned-view</artifactId>
<version>1.18</version>
<version>1.25</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>nested-view</artifactId>
<version>1.14</version>
<version>1.17</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>credentials</artifactId>
<version>1.22</version>
<version>2.3.7</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand All @@ -122,18 +140,18 @@
</pluginRepository>
</pluginRepositories>

<!--TODO: temporary hack, remove after the upgrade of Parent POM-->
<distributionManagement>
<repository>
<uniqueVersion>false</uniqueVersion>
<id>maven.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/releases/</url>
</repository>
<snapshotRepository>
<id>maven.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/snapshots/</url>
</snapshotRepository>
</distributionManagement>
<!-- TODO: temporary hack, remove after the upgrade of Parent POM
<distributionManagement>
<repository>
<uniqueVersion>false</uniqueVersion>
<id>maven.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/releases/</url>
</repository>
<snapshotRepository>
<id>maven.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/snapshots/</url>
</snapshotRepository>
</distributionManagement> -->

<scm>
<connection>scm:git:git://github.com/jenkinsci/priority-sorter-plugin.git</connection>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@

import java.util.logging.Level;
import java.util.logging.Logger;

import javax.annotation.Nonnull;

import jenkins.advancedqueue.sorter.ItemInfo;
import jenkins.model.Jenkins;

/**
* @author Magnus Sandberg
Expand Down
Loading

0 comments on commit f4ca81d

Please sign in to comment.