diff --git a/Jenkinsfile b/Jenkinsfile
index 4e8d4e4..f63977d 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -4,7 +4,9 @@ node('docker') {
docker.image('jenkins/ath:acceptance-test-harness-1.73').inside {
stage('test') {
checkout scm
- sh 'mvn -B --no-transfer-progress clean package -Dmaven.test.failure.ignore'
+ // Skipping enforcer inside ATH container as the maven there is too old
+ // TODO: remove after https://github.com/jenkinsci/acceptance-test-harness/pull/690
+ sh 'mvn -B --no-transfer-progress clean package -Dmaven.test.failure.ignore -Denforcer.skip'
junit '**/target/surefire-reports/TEST-*.xml'
}
}
diff --git a/pom.xml b/pom.xml
index bf95e66..4e61772 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
org.jenkins-ci.plugins
plugin
- 3.55
+ 4.27
xvnc
@@ -31,58 +31,54 @@
HEAD
- 2.60
+ 2.277.3
8
- 1.8
+
+
+
+ io.jenkins.tools.bom
+ bom-2.277.x
+ 950.v396cb834de1e
+ import
+ pom
+
+
+
org.jenkins-ci.plugins
structs
- 1.5
org.jenkins-ci.plugins.workflow
workflow-job
- ${workflow.version}
test
org.jenkins-ci.plugins.workflow
workflow-basic-steps
- ${workflow.version}
test
org.jenkins-ci.plugins.workflow
workflow-cps
- ${workflow.version}
test
org.jenkins-ci.plugins.workflow
workflow-durable-task-step
- ${workflow.version}
test
org.jenkins-ci.plugins.workflow
workflow-step-api
- ${workflow.version}
tests
test
org.jenkins-ci.plugins.workflow
workflow-support
- ${workflow.version}
- tests
- test
-
-
- org.jenkins-ci.plugins.workflow
- workflow-aggregator
- ${workflow.version}
tests
test
diff --git a/src/main/java/hudson/plugins/xvnc/DisplayAllocator.java b/src/main/java/hudson/plugins/xvnc/DisplayAllocator.java
index 21ee9d3..c0bc224 100644
--- a/src/main/java/hudson/plugins/xvnc/DisplayAllocator.java
+++ b/src/main/java/hudson/plugins/xvnc/DisplayAllocator.java
@@ -15,6 +15,7 @@
*/
final class DisplayAllocator {
+ public static final Random RANDOM = new Random();
transient Saveable owner;
/**
@@ -37,7 +38,7 @@ private void save() {
}
private int getRandomValue(final int min, final int max) {
- return min + (new Random().nextInt(getRange(min, max)));
+ return min + (RANDOM.nextInt(getRange(min, max)));
}
private int getRange(final int min, final int max) {
diff --git a/src/main/java/hudson/plugins/xvnc/Xvnc.java b/src/main/java/hudson/plugins/xvnc/Xvnc.java
index 630fc23..94e98bb 100644
--- a/src/main/java/hudson/plugins/xvnc/Xvnc.java
+++ b/src/main/java/hudson/plugins/xvnc/Xvnc.java
@@ -45,7 +45,6 @@
*/
public class Xvnc extends SimpleBuildWrapper {
private static final String XAUTHORITY_ENV = "XAUTHORITY";
- public static final String VNCSERVER = "vncserver";
/**
* Whether or not to take a screenshot upon completion of the build.
*/
@@ -138,13 +137,13 @@ private void doSetUp(Context context, Run,?> build, FilePath workspace, Node n
final Proc proc = launcher.launch().cmds(cmds).envs(xauthorityEnv).stdout(logger).pwd(workspace).start();
final String vncserverCommand;
- if (cmds[0].endsWith(VNCSERVER) && cmd.contains(":$DISPLAY_NUMBER")) {
- // Command just started the server; -kill will stop it.
+ if (cmds[0].endsWith("vncserver") && cmd.contains(":$DISPLAY_NUMBER")) {
+ // vncserver command starts the server in the background; -kill will stop it.
vncserverCommand = cmds[0];
int exit = proc.join();
if (exit != 0) {
// XXX I18N
- String message = "Failed to run \'" + actualCmd + "\' (exit code " + exit + "), blacklisting display #" + displayNumber +
+ String message = "Failed to run '" + actualCmd + "' (exit code " + exit + "), blacklisting display #" + displayNumber +
"; consider checking the \"Clean up before start\" option";
// Do not release it; it may be "stuck" until cleaned up by an administrator.
//allocator.free(displayNumber);
@@ -165,24 +164,25 @@ private void doSetUp(Context context, Run,?> build, FilePath workspace, Node n
context.setDisposer(new DisposerImpl(displayNumber, xauthorityEnv, vncserverCommand, takeScreenshot, xauthority != null ? xauthority.getRemote() : null));
}
- // vncserver was the default choice for years. Use it if it is present, fallback to Xvnc if that is present, use
- // vncserver if all that fails to error in a predictable way.
+ // vncserver was the default choice for years, distributions switching to systemd activation stopped supporting it.
+ // The vncserver from tigervnc 1.11.0+ does not support needed options at all, so Xvnc is prefered
private String detectXvncCommand(FilePath workspace, Launcher launcher) throws InterruptedException {
try {
- launcher.launch().cmds(VNCSERVER, "-list").pwd(workspace).join();
- return VNCSERVER;
- } catch (IOException ex) {
+ launcher.launch().cmds("Xvnc", "-help").pwd(workspace).join();
+ return "Xvnc";
+ } catch (IOException exx) {
// Fallback
}
try {
- launcher.launch().cmds("Xvnc", "-help").pwd(workspace).join();
- return "Xvnc";
- } catch (IOException exx) {
+ launcher.launch().cmds("vncserver", "-list").pwd(workspace).join();
+ return "vncserver";
+ } catch (IOException ex) {
// Fallback
}
- return VNCSERVER;
+
+ return "Xvnc"; // Return default choice, so the build fails pointing out the problem
}
/**