jenkinsci / jenkinsci/agent-setup-plugin
[JENKINS-48207] "Start Script" starts after a job is finished
- Dominant language
- Java
- Stars
- 11
- Forks
- 23
- Avg merge
- 21h 13m
- Merged PRs (30d)
- 1
Description
Setup is a node from Libvirt-plugin. This node is configured as seen in the graphic below.
What is not working:
- incomming Job for node with Lable L_Ub1604 (Xen image for Ubuntu 1604 Guest)
- Node is starting after a while
- Installed slave (run as a service) is connecting
- Job is executed successfully on the node
- After job the Script mentioned under "Start Script" is executed
- Afterwards or the same time the other script "Stop Script" is executed twice
The Error is that according to my assumption the "Start Script" should have been executed before the node is powered up. So step 5 should follow sep 1. I'm new to this, so maybe there is a mistake on my side.
EDIT:
I've written script output to a logfile. According to this the Stopscript runs twice.
Logfile:
```
[2017-11-24_12-58-25.928578822] copyDummyStart.sh (Disconnecting computer xml1604)
[2017-11-24_12-59-27.644064994] copyDummyStop.sh
[2017-11-24_12-59-27.653089703] copyDummyStop.sh
```
Jenkins output:
```
Nov 24, 2017 12:57:25 PM hudson.slaves.RetentionStrategy$Demand check
INFO: Launching computer xml1604 as it has been in demand for 2 min 21 sec
Nov 24, 2017 12:58:04 PM hudson.TcpSlaveAgentListener$ConnectionHandler run
INFO: Accepted JNLP4-connect connection #4 from /192.168.5.109:38584
Nov 24, 2017 12:58:04 PM jenkins.slaves.DefaultJnlpSlaveReceiver afterProperties
INFO: Connecting xml1604 as a JNLP agent where the launcher class hudson.plugins.libvirt.VirtualMachineLauncher does not mark itself correctly as being a JNLP agent
Nov 24, 2017 12:58:07 PM org.jenkinsci.plugins.workflow.job.WorkflowRun finish
INFO: JobXml1604 #24 completed: SUCCESS
...
Nov 24, 2017 12:59:25 PM hudson.slaves.RetentionStrategy$Demand check
INFO: Disconnecting computer xml1604 as it has been idle for 1 min 17 sec
Nov 24, 2017 12:59:25 PM hudson.plugins.libvirt.VirtualMachineSlaveComputer disconnect
INFO: Virtual machine "xml1604" (slave "xml1604") is to be shut down. reason: Offline because computer was idle; it will be relaunched when needed. (hudson.slaves.OfflineCause$IdleOfflineCause)
method: destroy
```
Pipline job
pipeline {
agent any
stages {
stage('Info') {
agent {label 'L_Ub1604'}
steps {
sh 'uname -a'
sh 'hostname'
}
}
}
}
Snapshot from node-configuration machine xml1604

---
Originally reported by cutton_eye, imported from: "Start Script" starts after a job is finished
peppe
Raw content of original issue
Setup is a node from Libvirt-plugin. This node is configured as seen in the graphic below.
What is not working:
- incomming Job for node with Lable L_Ub1604 (Xen image for Ubuntu 1604 Guest)
- Node is starting after a while
- Installed slave (run as a service) is connecting
- Job is executed successfully on the node
- After job the Script mentioned under "Start Script" is executed
- Afterwards or the same time the other script "Stop Script" is executed twice
The Error is that according to my assumption the "Start Script" should have been executed before the node is powered up. So step 5 should follow sep 1. I'm new to this, so maybe there is a mistake on my side.
EDIT:
I've written script output to a logfile. According to this the Stopscript runs twice.
Logfile:
[2017-11-24_12-58-25.928578822] copyDummyStart.sh (Disconnecting computer xml1604)
[2017-11-24_12-59-27.644064994] copyDummyStop.sh
[2017-11-24_12-59-27.653089703] copyDummyStop.sh
Jenkins output:
Nov 24, 2017 12:57:25 PM hudson.slaves.RetentionStrategy$Demand check
INFO: Launching computer xml1604 as it has been in demand for 2 min 21 sec
Nov 24, 2017 12:58:04 PM hudson.TcpSlaveAgentListener$ConnectionHandler run
INFO: Accepted JNLP4-connect connection #4 from /192.168.5.109:38584
Nov 24, 2017 12:58:04 PM jenkins.slaves.DefaultJnlpSlaveReceiver afterProperties
INFO: Connecting xml1604 as a JNLP agent where the launcher class hudson.plugins.libvirt.VirtualMachineLauncher does not mark itself correctly as being a JNLP agent
Nov 24, 2017 12:58:07 PM org.jenkinsci.plugins.workflow.job.WorkflowRun finish
INFO: JobXml1604 #24 completed: SUCCESS
...
Nov 24, 2017 12:59:25 PM hudson.slaves.RetentionStrategy$Demand check
INFO: Disconnecting computer xml1604 as it has been idle for 1 min 17 sec
Nov 24, 2017 12:59:25 PM hudson.plugins.libvirt.VirtualMachineSlaveComputer disconnect
INFO: Virtual machine "xml1604" (slave "xml1604") is to be shut down. reason: Offline because computer was idle; it will be relaunched when needed. (hudson.slaves.OfflineCause$IdleOfflineCause)
method: destroy
Pipline job
pipeline {
agent anystages {
stage('Info') {
agent {label 'L_Ub1604'}
steps {
sh 'uname -a'
sh 'hostname'
}
}
}
}Snapshot from node-configuration machine xml1604
environment
```
Ubuntu 16.04 x64
/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64
jenkins via apt-get
libvirt-slave 1.8.5
slave-setup 1.10
```
1 attachment
- [JenkinsSlaveSetupPlugin.png](https://issues.jenkins.io/secure/attachment/40485/JenkinsSlaveSetupPlugin.png)
> 
Contributor guide
Assessment
This issue has not been assessed yet.