When logging build start/end on azure vm agents, the node name is not displayed, we have #unknown# instead.
Jul 13, 2023 11:23:28,889 AM - myjob #1 Push event to branch main, Parameters:[] on node #unknown# started at 2023-07-13T09:12:02Z completed in 685713ms completed: SUCCESS
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener printNodes
------------Node enumeration starting------------
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener lambda$printNodes$0
Node: FlowEndNode[id=21, exec=CpsFlowExecution[Owner[myorg/test/master/6:myorg/test/master #6]]] | Display name: End of Pipeline | StepArgumentsAsString: null
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener lambda$printNodes$0
Node: StepEndNode[id=20, exec=CpsFlowExecution[Owner[myorg/test/master/6:myorg/test/master #6]]] | Display name: Allocate node : End | StepArgumentsAsString: null
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener lambda$printNodes$0
Node: StepEndNode[id=19, exec=CpsFlowExecution[Owner[myorg/test/master/6:myorg/test/master #6]]] | Display name: Allocate node : Body : End | StepArgumentsAsString: null
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener lambda$printNodes$0
Node: StepEndNode[id=18, exec=CpsFlowExecution[Owner[myorg/test/master/6:myorg/test/master #6]]] | Display name: Set environment variables : End | StepArgumentsAsString: null
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener lambda$printNodes$0
Node: StepEndNode[id=17, exec=CpsFlowExecution[Owner[myorg/test/master/6:myorg/test/master #6]]] | Display name: Set environment variables : Body : End | StepArgumentsAsString: null
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener lambda$printNodes$0
Node: StepEndNode[id=16, exec=CpsFlowExecution[Owner[myorg/test/master/6:myorg/test/master #6]]] | Display name: Stage : End | StepArgumentsAsString: null
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener lambda$printNodes$0
Node: StepEndNode[id=15, exec=CpsFlowExecution[Owner[myorg/test/master/6:myorg/test/master #6]]] | Display name: Stage : Body : End | StepArgumentsAsString: null
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener lambda$printNodes$0
Node: StepAtomNode[id=14, exec=CpsFlowExecution[Owner[myorg/test/master/6:myorg/test/master #6]]] | Display name: Print Message | StepArgumentsAsString: Hello World
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener lambda$printNodes$0
Node: StepStartNode[id=13, exec=CpsFlowExecution[Owner[myorg/test/master/6:myorg/test/master #6]]] | Display name: Hello | StepArgumentsAsString: null
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener lambda$printNodes$0
Node: StepStartNode[id=12, exec=CpsFlowExecution[Owner[myorg/test/master/6:myorg/test/master #6]]] | Display name: Stage : Start | StepArgumentsAsString: Hello
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener lambda$printNodes$0
Node: StepStartNode[id=11, exec=CpsFlowExecution[Owner[myorg/test/master/6:myorg/test/master #6]]] | Display name: Set environment variables : Body : Start | StepArgumentsAsString: null
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener lambda$printNodes$0
Node: StepStartNode[id=10, exec=CpsFlowExecution[Owner[myorg/test/master/6:myorg/test/master #6]]] | Display name: Set environment variables : Start | StepArgumentsAsString: GIT_BRANCH, GIT_COMMIT, GIT_PREVIOUS_COMMIT, GIT_PREVIOUS_SUCCESSFUL_COMMIT, GIT_URL
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener lambda$printNodes$0
Node: StepEndNode[id=9, exec=CpsFlowExecution[Owner[myorg/test/master/6:myorg/test/master #6]]] | Display name: Stage : End | StepArgumentsAsString: null
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener lambda$printNodes$0
Node: StepEndNode[id=8, exec=CpsFlowExecution[Owner[myorg/test/master/6:myorg/test/master #6]]] | Display name: Stage : Body : End | StepArgumentsAsString: null
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener lambda$printNodes$0
Node: StepAtomNode[id=7, exec=CpsFlowExecution[Owner[myorg/test/master/6:myorg/test/master #6]]] | Display name: Check out from version control | StepArgumentsAsString: null
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener lambda$printNodes$0
Node: StepStartNode[id=6, exec=CpsFlowExecution[Owner[myorg/test/master/6:myorg/test/master #6]]] | Display name: Declarative: Checkout SCM | StepArgumentsAsString: null
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener lambda$printNodes$0
Node: StepStartNode[id=5, exec=CpsFlowExecution[Owner[myorg/test/master/6:myorg/test/master #6]]] | Display name: Stage : Start | StepArgumentsAsString: Declarative: Checkout SCM
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener lambda$printNodes$0
Node: StepStartNode[id=4, exec=CpsFlowExecution[Owner[myorg/test/master/6:myorg/test/master #6]]] | Display name: Allocate node : Body : Start | StepArgumentsAsString: null
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener lambda$printNodes$0
Node: StepStartNode[id=3, exec=CpsFlowExecution[Owner[myorg/test/master/6:myorg/test/master #6]]] | Display name: Allocate node : Start | StepArgumentsAsString: null
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener lambda$printNodes$0
Node: FlowStartNode[id=2, exec=CpsFlowExecution[Owner[myorg/test/master/6:myorg/test/master #6]]] | Display name: Start of Pipeline | StepArgumentsAsString: null
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener printNodes
------------Node enumeration done------------
The job start the azure agent vm-forge-agent0e8090 but no trace of this agent is present neither in this log file, neither in the audit.log file
Nov 16, 2023 1:40:20,507 PM - job/myorg/job/test/job/master/ #6 Started by user POTTIERS Cyril, Parameters:[]
Nov 16, 2023 1:42:33,972 PM - myorg » test » master #6 Started by user POTTIERS Cyril, Parameters:[] on node no agent started at 2023-11-16T12:40:20Z completed in 133138ms completed: SUCCESS
Cyril Pottiers
added a comment - pierrebtz
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener printNodes
------------Node enumeration starting------------
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener lambda$printNodes$0
Node: FlowEndNode[id=21, exec=CpsFlowExecution[Owner[myorg/test/master/6:myorg/test/master #6]]] | Display name: End of Pipeline | StepArgumentsAsString: null
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener lambda$printNodes$0
Node: StepEndNode[id=20, exec=CpsFlowExecution[Owner[myorg/test/master/6:myorg/test/master #6]]] | Display name: Allocate node : End | StepArgumentsAsString: null
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener lambda$printNodes$0
Node: StepEndNode[id=19, exec=CpsFlowExecution[Owner[myorg/test/master/6:myorg/test/master #6]]] | Display name: Allocate node : Body : End | StepArgumentsAsString: null
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener lambda$printNodes$0
Node: StepEndNode[id=18, exec=CpsFlowExecution[Owner[myorg/test/master/6:myorg/test/master #6]]] | Display name: Set environment variables : End | StepArgumentsAsString: null
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener lambda$printNodes$0
Node: StepEndNode[id=17, exec=CpsFlowExecution[Owner[myorg/test/master/6:myorg/test/master #6]]] | Display name: Set environment variables : Body : End | StepArgumentsAsString: null
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener lambda$printNodes$0
Node: StepEndNode[id=16, exec=CpsFlowExecution[Owner[myorg/test/master/6:myorg/test/master #6]]] | Display name: Stage : End | StepArgumentsAsString: null
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener lambda$printNodes$0
Node: StepEndNode[id=15, exec=CpsFlowExecution[Owner[myorg/test/master/6:myorg/test/master #6]]] | Display name: Stage : Body : End | StepArgumentsAsString: null
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener lambda$printNodes$0
Node: StepAtomNode[id=14, exec=CpsFlowExecution[Owner[myorg/test/master/6:myorg/test/master #6]]] | Display name: Print Message | StepArgumentsAsString: Hello World
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener lambda$printNodes$0
Node: StepStartNode[id=13, exec=CpsFlowExecution[Owner[myorg/test/master/6:myorg/test/master #6]]] | Display name: Hello | StepArgumentsAsString: null
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener lambda$printNodes$0
Node: StepStartNode[id=12, exec=CpsFlowExecution[Owner[myorg/test/master/6:myorg/test/master #6]]] | Display name: Stage : Start | StepArgumentsAsString: Hello
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener lambda$printNodes$0
Node: StepStartNode[id=11, exec=CpsFlowExecution[Owner[myorg/test/master/6:myorg/test/master #6]]] | Display name: Set environment variables : Body : Start | StepArgumentsAsString: null
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener lambda$printNodes$0
Node: StepStartNode[id=10, exec=CpsFlowExecution[Owner[myorg/test/master/6:myorg/test/master #6]]] | Display name: Set environment variables : Start | StepArgumentsAsString: GIT_BRANCH, GIT_COMMIT, GIT_PREVIOUS_COMMIT, GIT_PREVIOUS_SUCCESSFUL_COMMIT, GIT_URL
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener lambda$printNodes$0
Node: StepEndNode[id=9, exec=CpsFlowExecution[Owner[myorg/test/master/6:myorg/test/master #6]]] | Display name: Stage : End | StepArgumentsAsString: null
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener lambda$printNodes$0
Node: StepEndNode[id=8, exec=CpsFlowExecution[Owner[myorg/test/master/6:myorg/test/master #6]]] | Display name: Stage : Body : End | StepArgumentsAsString: null
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener lambda$printNodes$0
Node: StepAtomNode[id=7, exec=CpsFlowExecution[Owner[myorg/test/master/6:myorg/test/master #6]]] | Display name: Check out from version control | StepArgumentsAsString: null
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener lambda$printNodes$0
Node: StepStartNode[id=6, exec=CpsFlowExecution[Owner[myorg/test/master/6:myorg/test/master #6]]] | Display name: Declarative: Checkout SCM | StepArgumentsAsString: null
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener lambda$printNodes$0
Node: StepStartNode[id=5, exec=CpsFlowExecution[Owner[myorg/test/master/6:myorg/test/master #6]]] | Display name: Stage : Start | StepArgumentsAsString: Declarative: Checkout SCM
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener lambda$printNodes$0
Node: StepStartNode[id=4, exec=CpsFlowExecution[Owner[myorg/test/master/6:myorg/test/master #6]]] | Display name: Allocate node : Body : Start | StepArgumentsAsString: null
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener lambda$printNodes$0
Node: StepStartNode[id=3, exec=CpsFlowExecution[Owner[myorg/test/master/6:myorg/test/master #6]]] | Display name: Allocate node : Start | StepArgumentsAsString: null
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener lambda$printNodes$0
Node: FlowStartNode[id=2, exec=CpsFlowExecution[Owner[myorg/test/master/6:myorg/test/master #6]]] | Display name: Start of Pipeline | StepArgumentsAsString: null
Nov 16, 2023 1:42:33 PM INFO hudson.plugins.audit_trail.AuditTrailRunListener printNodes
------------Node enumeration done------------
The job start the azure agent vm-forge-agent0e8090 but no trace of this agent is present neither in this log file, neither in the audit.log file
Nov 16, 2023 1:40:20,507 PM - job/myorg/job/test/job/master/ #6 Started by user POTTIERS Cyril, Parameters:[]
Nov 16, 2023 1:42:33,972 PM - myorg » test » master #6 Started by user POTTIERS Cyril, Parameters:[] on node no agent started at 2023-11-16T12:40:20Z completed in 133138ms completed: SUCCESS
cpottiers thanks for bearing with me! I did additional tests using various agent names, various durability, various agent types and various syntax but had no luck reproducing. I understood reading the source comments of the pipeline plugin that security reasons could prevent the fields I'm reading from getting populated but I have no clue which exact setting would be triggering this behavior.
One thing I'd like to check is whether the Pipeline steps screen is showing the same issue or not. Could you go to the page of a run of the job, then click on the Pipeline step action on the left side of the screen. Then have a look to see whether the node name is displayed or not. As a reference, here is a screenshot I took on my system
Pierre Beitz
added a comment - cpottiers thanks for bearing with me! I did additional tests using various agent names, various durability, various agent types and various syntax but had no luck reproducing. I understood reading the source comments of the pipeline plugin that security reasons could prevent the fields I'm reading from getting populated but I have no clue which exact setting would be triggering this behavior.
One thing I'd like to check is whether the Pipeline steps screen is showing the same issue or not. Could you go to the page of a run of the job, then click on the Pipeline step action on the left side of the screen. Then have a look to see whether the node name is displayed or not. As a reference, here is a screenshot I took on my system
Mhhh, the node name is not displayed here too (unsurprisingly since I use more or less the same method as the pipeline plugin to grab the node name from the workflow run). I'm really not sure what's going on here, my understanding is that some security things could prevent the node name from being kept, but I have no idea what drives this exactly. I'll try to poke around, no promises though...
Pierre Beitz
added a comment - Mhhh, the node name is not displayed here too (unsurprisingly since I use more or less the same method as the pipeline plugin to grab the node name from the workflow run). I'm really not sure what's going on here, my understanding is that some security things could prevent the node name from being kept, but I have no idea what drives this exactly. I'll try to poke around, no promises though...
Sadly no, since the Pipeline steps view also does not have the information, I'm not even sure it even exists in your case.
Pierre Beitz
added a comment - Sadly no, since the Pipeline steps view also does not have the information, I'm not even sure it even exists in your case.
I installed the Pipeline Agent Build History plugin and this plugin print well the node names used in each build.
I think it could help you.
Cyril Pottiers
added a comment - Hi pierrebtz ,
I installed the Pipeline Agent Build History plugin and this plugin print well the node names used in each build.
I think it could help you.
Michael Keppler
added a comment - Not sure if that's the root cause of this issue, but I recently saw this in the log, also leading to unknown node name:
Run is not an AbstractBuild but a org.jenkinsci.plugins.workflow.job.WorkflowRun, will log the build node as #unknown#.
That's from https://github.com/jenkinsci/audit-trail-plugin/blob/d22186ef2e405b0276ca425972520c0d4afb86f3/src/main/java/hudson/plugins/audit_trail/AuditTrailRunListener.java#L103 . I don't know what kind of job or build that was, so I can't look for any definition.
Jan
added a comment - I guess mawinter69 solved this in pipeline-agent-build-history. Have not worked with FlowExecutions / DepthFirstScanner before, but I think it should be straight forward:
https://github.com/jenkinsci/pipeline-agent-build-history-plugin/blob/main/src/main/java/io/jenkins/plugins/agent_build_history/AgentBuildHistory.java#L208-L221
Chiming in, in the hope this gets fixed based on how it's done in Agent Build History. As it is now, the node names never make it to the audit log for "pipeline" builds, and we get "#unknown#" instead.
Radoslaw Moszczynski
added a comment - Chiming in, in the hope this gets fixed based on how it's done in Agent Build History. As it is now, the node names never make it to the audit log for "pipeline" builds, and we get "#unknown#" instead.
Could you also consider moving the "#unknown# node" log message to maybe Level.FINE https://github.com/jenkinsci/audit-trail-plugin/blob/bfdd5d9c2d6ef9593ad9a0ec86a13680d6e41e24/src/main/java/hudson/plugins/audit_trail/AuditTrailRunListener.java#L104 ? It's INFO now, and this floods the logs on large instances where many pipeline builds run. I'm getting 100-200 of those messages per hour.
pierrebtz
The job start the azure agent vm-forge-agent0e8090 but no trace of this agent is present neither in this log file, neither in the audit.log file