Skip to content

Commit

Permalink
Merge branch 'master' into improve-project-settings
Browse files Browse the repository at this point in the history
  • Loading branch information
janfaracik committed Jan 11, 2025
2 parents e5b1dc7 + 90f02a2 commit abc6bef
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 295 deletions.
10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>5.1</version>
<version>5.3</version>
<relativePath/>
</parent>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
Expand Down Expand Up @@ -63,9 +63,9 @@
</pluginRepositories>
<properties>
<changelist>999999-SNAPSHOT</changelist>
<!-- TODO: Waiting for JENKINS-73824 and JENKINS-73835 to make it into an LTS line -->
<!-- <jenkins.version>2.481</jenkins.version> -->
<jenkins.version>2.481-rc35491.56cb_9df6e9cd</jenkins.version>
<!-- https://www.jenkins.io/doc/developer/plugin-development/choosing-jenkins-baseline/ -->
<jenkins.baseline>2.479</jenkins.baseline>
<jenkins.version>${jenkins.baseline}.1</jenkins.version>
<no-test-jar>false</no-test-jar>
<useBeta>true</useBeta>
<hpi.compatibleSinceVersion>2.26</hpi.compatibleSinceVersion>
Expand All @@ -75,7 +75,7 @@
<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.479.x</artifactId>
<artifactId>bom-${jenkins.baseline}.x</artifactId>
<version>3482.vc10d4f6da_28a_</version>
<scope>import</scope>
<type>pom</type>
Expand Down
23 changes: 16 additions & 7 deletions src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@
import jenkins.model.queue.AsynchronousExecution;
import jenkins.scm.RunWithSCM;
import jenkins.util.Timer;
import org.acegisecurity.Authentication;
import org.jenkinsci.plugins.workflow.FilePathUtils;
import org.jenkinsci.plugins.workflow.actions.TimingAction;
import org.jenkinsci.plugins.workflow.flow.BlockableResume;
Expand Down Expand Up @@ -132,6 +131,7 @@
import org.kohsuke.stapler.WebMethod;
import org.kohsuke.stapler.export.Exported;
import org.kohsuke.stapler.interceptor.RequirePOST;
import org.springframework.security.core.Authentication;

@SuppressWarnings("SynchronizeOnNonFinalField")
@SuppressFBWarnings(value={"RC_REF_COMPARISON_BAD_PRACTICE_BOOLEAN"},
Expand Down Expand Up @@ -289,10 +289,10 @@ public WorkflowRun(WorkflowJob job, File dir) throws IOException {
charset = "UTF-8"; // cannot override getCharset, and various Run methods do not call it anyway
BuildListener myListener = getListener();
myListener.started(getCauses());
Authentication auth = Jenkins.getAuthentication();
if (!auth.equals(ACL.SYSTEM)) {
Authentication auth = Jenkins.getAuthentication2();
if (!auth.equals(ACL.SYSTEM2)) {
String name = auth.getName();
if (!auth.equals(Jenkins.ANONYMOUS)) {
if (!auth.equals(Jenkins.ANONYMOUS2)) {
User user = User.getById(name, false);
if (user != null) {
name = ModelHyperlinkNote.encodeTo(user);
Expand Down Expand Up @@ -547,24 +547,32 @@ private String key() {

/** Hack to allow {@link #execution} to use an {@link Owner} referring to this run, even when it has not yet been loaded. */
@Override public void reload() throws IOException {
LOGGER.fine(() -> "Adding " + key() + " to LOADING_RUNS");
synchronized (LOADING_RUNS) {
LOADING_RUNS.put(key(), this);
}

// super.reload() forces result to be FAILURE, so working around that
new XmlFile(XSTREAM,new File(getRootDir(),"build.xml")).unmarshal(this);
synchronized (getMetadataGuard()) {
if (Boolean.TRUE.equals(completed) && executionLoaded) {
var _execution = execution;
if (_execution != null) {
_execution.onLoad(new Owner(this));
}
}
}
}

@Override protected void onLoad() {
super.onLoad();
try {
synchronized (getMetadataGuard()) {
if (executionLoaded) {
LOGGER.log(Level.WARNING, "Double onLoad of build "+this);
LOGGER.log(Level.WARNING, "Double onLoad of build " + this, new Throwable());
return;
}
boolean needsToPersist = completed == null;
super.onLoad();

if (Boolean.TRUE.equals(completed) && result == null) {
LOGGER.log(Level.FINE, "Completed build with no result set, defaulting to failure for "+this);
setResult(Result.FAILURE);
Expand Down Expand Up @@ -605,6 +613,7 @@ private String key() {
}
} finally { // Ensure the run is ALWAYS removed from loading even if something failed, so threads awaken.
checkouts(null); // only for diagnostics
LOGGER.fine(() -> "Removing " + key() + " from LOADING_RUNS");
synchronized (LOADING_RUNS) {
LOADING_RUNS.remove(key()); // or could just make the value type be WeakReference<WorkflowRun>
LOADING_RUNS.notifyAll();
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit abc6bef

Please sign in to comment.