Skip to content
Permalink
Browse files
Merge branch 'master' into feature/JENKINS-38644-class-restriction
  • Loading branch information
oleg-nenashev committed Oct 1, 2016
2 parents c2f2052 + efec8e7 commit 2f214643fc43612b75d2b6d47401a5daeed40ee7
Showing with 25 additions and 20 deletions.
  1. +5 −5 pom.xml
  2. +18 −14 src/main/java/com/synopsys/arc/jenkinsci/plugins/jobrestrictions/util/QueueHelper.java
  3. +2 −1 src/main/resources/index.jelly
10 pom.xml
@@ -3,34 +3,34 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>2.12</version>
<version>2.16</version>
</parent>

<groupId>com.synopsys.arc.jenkinsci.plugins</groupId>
<artifactId>job-restrictions</artifactId>
<version>0.6-SNAPSHOT</version>
<name>Jenkins Job Restrictions Plugin</name>
<description>Provides Additional options to restrict jobs execution</description>
<description>This plugin allows restricting execution of jobs on nodes depending on criterias like name pattern and ownership</description>
<packaging>hpi</packaging>
<url>https://wiki.jenkins-ci.org/display/JENKINS/Job+Restrictions+Plugin</url>

<properties>
<jenkins.version>1.580.3</jenkins.version>
<jenkins.version>1.609.3</jenkins.version>
<java.level>6</java.level>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
<url>https://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>

<pluginRepositories>
<pluginRepository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
<url>https://repo.jenkins-ci.org/public/</url>
</pluginRepository>
</pluginRepositories>

@@ -23,14 +23,14 @@
*/
package com.synopsys.arc.jenkinsci.plugins.jobrestrictions.util;

import javax.annotation.Nonnull;

import hudson.model.Item;
import hudson.model.Job;
import hudson.model.Queue;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;

import javax.annotation.Nonnull;

/**
* Provides additional for Queue objects.
* @author Oleg Nenashev
@@ -48,22 +48,26 @@ public class QueueHelper {
@Deprecated
public static String getFullName(@Nonnull Queue.BuildableItem item) {
Queue.Task current = item.task;
String res = current.getName();
//Fetching the full path of the item
if (current instanceof Item) {
Item stub = (Item)current;
return stub.getFullName();
}

// Default approach via interface
while (true) {
String res = getItemName(current);

// this is only executed if we didn't call Item.getFullName() in getItemName
while (!(current instanceof Item)) {
Queue.Task parent = current.getOwnerTask();
if (parent == current || parent == null) {
break;
}
res = parent.getName() + "/" + res;
}
res = getItemName(parent) + "/" + res;
current = parent;
}
}
return res;
}

private static String getItemName(Queue.Task task) {
if (task instanceof Item) {
Item stub = (Item)task;
return stub.getFullName();
} else {
return task.getName();
}
}
}
@@ -1,4 +1,5 @@
<?jelly escape-by-default='true'?>
<div>
This plugin provides additional options, which allow to restrict execution of jobs
Allows restricting execution of jobs on nodes depending on criterias like name pattern, ownership, etc.
Also can restrict job triggering by other jobs and users.
</div>

0 comments on commit 2f21464

Please sign in to comment.