Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/model/Build.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
*
* @author Kohsuke Kawaguchi
*/
public abstract class Build<P extends Project<P, B>, B extends Build<P, B>>
public abstract class Build<P extends Project<P, B>, B extends Build<P, B>>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm sorry for that.
Isn't spotless detecting such things? Or checkstyle?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't spotless detecting such things? Or checkstyle?

The spotless configuration on Jenkins core is much less rigorous than the spotless configuration for plugins. It doesn't detect or correct that type of change.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(mostly because of all the PRs we have open and the effort to migrate them, do-able of course)

extends AbstractBuild<P, B> {

/**
Expand Down
10 changes: 10 additions & 0 deletions core/src/main/java/hudson/model/BuildableItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,14 @@
}

boolean scheduleBuild(int quietPeriod, Cause c);

/**
* Whether the item is buildable.
*
* @return true, if the item can be built.
* @since TODO
*/
default boolean isBuildable() {
return true;

Check warning on line 68 in core/src/main/java/hudson/model/BuildableItem.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 68 is not covered by tests
}
}
12 changes: 11 additions & 1 deletion core/src/main/java/jenkins/model/ParameterizedJobMixIn.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import hudson.model.Cause;
import hudson.model.CauseAction;
import hudson.model.Item;
import hudson.model.ItemGroup;
import hudson.model.Items;
import hudson.model.Job;
import hudson.model.ParameterDefinition;
Expand Down Expand Up @@ -562,8 +563,17 @@
return null;
}

@Override
default boolean isBuildable() {
return !isDisabled() && !((Job) this).isHoldOffBuildUntilSave();
if (isDisabled() || ((Job) this).isHoldOffBuildUntilSave()) {
return false;
}
// If parent is disabled, child jobs (e.g., branch jobs) should not be buildable
ItemGroup<? extends Item> parentGroup = ((Job) this).getParent();
if (parentGroup instanceof BuildableItem bi) {

Check warning on line 573 in core/src/main/java/jenkins/model/ParameterizedJobMixIn.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 573 is only partially covered, one branch is missing
return bi.isBuildable();

Check warning on line 574 in core/src/main/java/jenkins/model/ParameterizedJobMixIn.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 574 is not covered by tests
}
return true;
}

@Extension
Expand Down
Loading