Skip to content

Commit

Permalink
[JENKINS-30269] Upgrade baseline to pick up a recent version of Pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
amuniz committed Mar 11, 2016
1 parent d5b44a4 commit 810e1e9
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 8 deletions.
27 changes: 24 additions & 3 deletions pom.xml
Expand Up @@ -13,7 +13,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.580.3</version>
<version>1.609.1</version>
</parent>

<groupId>org.6wind.jenkins</groupId>
Expand All @@ -28,6 +28,12 @@
</description>
<url>https://wiki.jenkins-ci.org/display/JENKINS/Lockable+Resources+Plugin</url>

<properties>
<!-- First version including TailCall is 1.9, and the same baseline is maintained
until 1.14, so let's pick up the greatest -->
<workflow.version>1.14</workflow.version>
</properties>

<licenses>
<license>
<name>MIT</name>
Expand All @@ -46,6 +52,16 @@
</roles>
<timezone>CET</timezone>
</developer>
<developer>
<id>amuniz</id>
<name>Antonio Muñiz</name>
<email>amuniz@cloudbees.com</email>
<roles>
<role>developer</role>
<role>maintainer</role>
</roles>
<timezone>CET</timezone>
</developer>
</developers>

<dependencies>
Expand All @@ -57,13 +73,18 @@
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-step-api</artifactId>
<version>1.4</version>
<version>${workflow.version}</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>matrix-project</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>annotations</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>com.infradna.tool</groupId>
<artifactId>bridge-method-annotation</artifactId>
Expand All @@ -73,7 +94,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-aggregator</artifactId>
<version>1.4</version>
<version>${workflow.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Expand Up @@ -120,7 +120,7 @@ public LockableResource fromName(String resourceName) {
}

public synchronized boolean queue(List<LockableResource> resources,
int queueItemId) {
long queueItemId) {
for (LockableResource r : resources)
if (r.isReserved() || r.isQueued(queueItemId) || r.isLocked())
return false;
Expand All @@ -130,7 +130,7 @@ public synchronized boolean queue(List<LockableResource> resources,
}

public synchronized List<LockableResource> queue(LockableResourcesStruct requiredResources,
int queueItemId,
long queueItemId,
String queueItemProject,
int number, // 0 means all
Map<String, Object> params,
Expand Down Expand Up @@ -185,7 +185,7 @@ public synchronized List<LockableResource> queue(LockableResourcesStruct require
// Return false if another item queued for this project -> bail out
private boolean checkCurrentResourcesStatus(List<LockableResource> selected,
String project,
int taskId,
long taskId,
Logger log) {
for (LockableResource r : resources) {
// This project might already have something in queue
Expand Down Expand Up @@ -216,6 +216,7 @@ public synchronized boolean lock(List<LockableResource> resources,
for (LockableResource r : resources) {
r.unqueue();
r.setBuild(build);
save();
}
return true;
}
Expand All @@ -226,6 +227,7 @@ public synchronized void unlock(List<LockableResource> resources,
if (build == null || build == r.getBuild()) {
r.unqueue();
r.setBuild(null);
save();
}
}
}
Expand Down
Expand Up @@ -10,6 +10,7 @@

import hudson.Extension;
import hudson.Util;
import hudson.model.AbstractProject;
import hudson.model.AutoCompletionCandidates;
import hudson.model.JobProperty;
import hudson.model.JobPropertyDescriptor;
Expand Down Expand Up @@ -75,6 +76,11 @@ public String getDisplayName() {
return "Required Lockable Resources";
}

@Override
public boolean isApplicable(Class<? extends Job> jobType) {
return AbstractProject.class.isAssignableFrom(jobType);
}

@Override
public RequiredResourcesProperty newInstance(StaplerRequest req,
JSONObject formData) throws FormException {
Expand Down
Expand Up @@ -66,7 +66,7 @@ public CauseOfBlockage canRun(Queue.Item item) {

List<LockableResource> selected = LockableResourcesManager.get().queue(
resources,
item.id,
item.getId(),
project.getFullName(),
resourceNumber,
params,
Expand All @@ -81,7 +81,7 @@ public CauseOfBlockage canRun(Queue.Item item) {
}

} else {
if (LockableResourcesManager.get().queue(resources.required, item.id)) {
if (LockableResourcesManager.get().queue(resources.required, item.getId())) {
LOGGER.finest(project.getName() + " reserved resources " + resources.required);
return null;
} else {
Expand Down

0 comments on commit 810e1e9

Please sign in to comment.