-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
Jenkins 2.401.1
Audit Trail : 333.vb_e1b_b_0f1238c
Azure VM Agents : 859.v7213476e4fea_
-
Powered by SuggestiMate
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
[JENKINS-71637] node names are not logged
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
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.
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.
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.
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
cpottiers
I'm really not sure what's wrong here. My development works with clouds I tested with the Kubernetes plugin. I just made a quick check against Azure and got the proper agent name. I'm also using the same syntax to declare the agent...
I made a change to the PR (https://github.com/jenkinsci/audit-trail-plugin/pull/128) to log a bunch of additional details about your Pipeline in the hope of finding the root cause for this discrepancy. Could you run again the pipeline again this special version. After running the Pipeline, you should find a block looking like the following in your Jenkins logs:
```
2023-11-15 20:08:46.770+0000 [id=109] INFO h.p.a.AuditTrailRunListener#printNodes: -----------
Node enumeration starting-----------2023-11-15 20:08:46.777+0000 [id=109] INFO h.p.a.AuditTrailRunListener#lambda$printNodes$0: Node: FlowEndNode[id=32, exec=CpsFlowExecutionOwner[pipeline3/5:pipeline3 #5]] | Display name: End of Pipeline | StepArgumentsAsString: null
2023-11-15 20:08:46.780+0000 [id=109] INFO h.p.a.AuditTrailRunListener#lambda$printNodes$0: Node: StepEndNode[id=31, exec=CpsFlowExecutionOwner[pipeline3/5:pipeline3 #5]] | Display name: Stage : End | StepArgumentsAsString: null
// ...
2023-11-15 20:08:46.784+0000 [id=109] INFO h.p.a.AuditTrailRunListener#printNodes: -----------
Node enumeration done-----------```
Could you please attach those logs to the ticket? Make sure to go through them to make sure it doesn't contain any private information you don't want shared (it should log things like agent name, execute steps etc).