jenkinsci / pipeline-agent-build-history-plugin

Agent Build History with pipeline jobs for Jenkins
https://plugins.jenkins.io/pipeline-agent-build-history/
MIT License
2 stars 2 forks source link

show badges #47

Open mawinter69 opened 1 month ago

mawinter69 commented 1 month ago

What feature do you want to see added?

badges are shown in the build history widget. This could be a valuable information to be shown on the agent history page

Upstream changes

No response

Are you interested in contributing this feature?

No response

ganesh-sadanala commented 1 month ago

working on it

mawinter69 commented 1 month ago

beware that this task is not newby friendly

ganesh-sadanala commented 1 month ago

Is this a bug? Jenkins cannot verify the agent, so the agent can't connect to the controller. All the configuration is correct and no network or firewall blocking. Can access Jenkins from UI and curl, but 'agent-1' can't connect to it. I am currently working on the https://github.com/jenkinsci/pipeline-agent-build-history-plugin/issues/47 My Jenkins instance is from the build of the above Repo using mvn hpi:run. Java version: 17 LTS . Instance identity is generated by Jenkins, but when executed, it is throwing invalid X-instance-identity. Have been working on this for 2 days, to see if I am making any mistake, but issue is on the jenkins @mawinter69

Screenshot 2024-05-25 at 3 01 27 PM Screenshot 2024-05-25 at 3 01 09 PM Screenshot 2024-05-25 at 3 00 49 PM Screenshot 2024-05-25 at 3 00 44 PM Screenshot 2024-05-25 at 3 00 38 PM Screenshot 2024-05-25 at 3 00 24 PM
gsadanala@Ganeshs-Air jenkins % java -jar agent.jar -url http://localhost:8080/jenkins/ -secret 8e54e781cd66c7f7605838caf360418b41cd556245a2f07d2709b310118b253f -name "agent-1" -workDir "/Users/gsadanala/jenkins"
May 25, 2024 2:37:45 PM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir
INFO: Using /Users/gsadanala/jenkins/remoting as a remoting work directory
May 25, 2024 2:37:45 PM org.jenkinsci.remoting.engine.WorkDirManager setupLogging
INFO: Both error and output logs will be printed to /Users/gsadanala/jenkins/remoting
May 25, 2024 2:37:45 PM hudson.remoting.Launcher createEngine
INFO: Setting up agent: agent-1
May 25, 2024 2:37:45 PM hudson.remoting.Engine startEngine
INFO: Using Remoting version: 3206.vb_15dcf73f6a_9
May 25, 2024 2:37:45 PM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir
INFO: Using /Users/gsadanala/jenkins/remoting as a remoting work directory
May 25, 2024 2:37:45 PM hudson.remoting.Launcher$CuiListener status
INFO: Locating server among [http://localhost:8080/jenkins/]
May 25, 2024 2:37:45 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve
INFO: Remoting server accepts the following protocols: [JNLP4-connect, Ping]
May 25, 2024 2:37:45 PM hudson.remoting.Launcher$CuiListener status
INFO: Could not locate server among [http://localhost:8080/jenkins/]; waiting 10 seconds before retry
java.io.IOException: http://localhost:8080/jenkins/tcpSlaveAgentListener/ appears to be publishing an invalid X-Instance-Identity.
    at org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver.resolve(JnlpAgentEndpointResolver.java:277)
    at hudson.remoting.Engine.innerRun(Engine.java:809)
    at hudson.remoting.Engine.run(Engine.java:563)
mawinter69 commented 1 month ago

Hard to tell if this is a bug anywhere but unlikely. I don't use inbound agents (usually I have outbound with ssh) and for development I usually use the Mock-Agent plugin

mawinter69 commented 1 month ago

Can you try to add -webSocket to the java process

java -jar agent.jar -url http://localhost:8080/jenkins/ -secret 8e54e781cd66c7f7605838caf360418b41cd556245a2f07d2709b310118b253f -name "agent-1" -workDir "/Users/gsadanala/jenkins"  -webSocket 
ganesh-sadanala commented 1 month ago

Can you try to add -webSocket to the java process

java -jar agent.jar -url http://localhost:8080/jenkins/ -secret 8e54e781cd66c7f7605838caf360418b41cd556245a2f07d2709b310118b253f -name "agent-1" -workDir "/Users/gsadanala/jenkins"  -webSocket 

The websocket connection worked. Amazing! So is this a bug? It would be better if Jenkins provided this as an option to use for traditional TCP/IP connection. Thanks! [Edit]: I see that issue with TCP connection was only for 1st agent, when I created another agent without websocket, it worked with TCP

ganesh-sadanala commented 1 month ago
Screenshot 2024-05-25 at 5 49 57 PM

@mawinter69 Just a small clarification. I am assuming that "badges" here means icons that need to be added for example beside: Failure, Success in the attached Extended Build History of the agent. Please correct me if I am wrong. Thanks for the Mock-Agent plugin suggestion!

mawinter69 commented 1 month ago

I meant the icons you can see in the history widget of a job image Currently the progressive rendering is working by sending json data to javascript and then in javascript the html is generated. But the badges contain inline svgs so this would mean to transfer bigger amount of data and potentially also duplicate data. For an easier integration both extended history pages would need to switch away from the progressive rendering approach to a direct approach where everything is done within jelly. That is a bigger change (any why I said it is not newby friendly).

mawinter69 commented 1 month ago

partially solved with #50 for the job history