Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”.

preface

When the machine where our Jenkins service is located cannot be accessed externally, or the port is disconnected, it is difficult for us to check the project status on Jenkins. What should we do? I recommend one of the simplest tools.

jenkinsclient

Jenkinsclient is a Third party python package, easy to install, easy to use, is an excellent Jenkins third party client tool.

The installation

pip3 install jenkinsclient
Copy the code

configuration

# 1, generate configuration files (located in the/root /. Jenkinsclient. Yaml) Jenkins config the generate # 2, Jenkins configuration information vi/root /. Jenkinsclient. Yaml # modified according to actual condition, The template is as follows: jenkins_Servers: -name: default URL: http://0:8080 username: 'admin' Token: 'pwd@123' use: defaultCopy the code

use

[root@localhost ~]# Jenkins jobs -------- -------- -------- Auto_Test_Pipline WorkflowJob http://x.x.x.22:8888/job/Auto_Test_Pipline/ xxx-FT-Pipline FreeStyleProject http://x.x.x.22:8888/job/xxz-FT-Pipline/ [root@localhost ~]# Jenkins job info Auto_Test_Pipline Actions: [{}, {}, {}, {}, {}, {}, {}, {}, {"_class": "com.cloudbees.plugins.credentials.ViewCredentialsAction"}] description: null displayName: Auto_Test_Pipline displayNameOrNull: null fullDisplayName: Auto_Test_Pipline fullName: Auto_Test_Pipline name: Auto_Test_Pipline url: http://x.x.x.22:8888/job/Auto_Test_Pipline/ buildable: true builds: [{"_class": "org.jenkinsci.plugins.workflow.job.WorkflowRun", "number": 1, "url": "http://x.x.x.22:8888/job/Auto_Test_Pipline/1/"}] color: red firstBuild: {"_class": "org.jenkinsci.plugins.workflow.job.WorkflowRun", "number": 1, "url": "http://x.x.x.22:8888/job/Auto_Test_Pipline/1/"} healthReport: [{"description": "Build stability: All recent builds failed.", "iconClassName": "icon-health-00to19", "iconUrl": "health-00to19.png", "score": 0}] inQueue: false keepDependencies: false lastBuild: {"_class": "org.jenkinsci.plugins.workflow.job.WorkflowRun", "number": 1, "url": "http://x.x.x.22:8888/job/Auto_Test_Pipline/1/"} lastCompletedBuild: {"_class": "org.jenkinsci.plugins.workflow.job.WorkflowRun", "number": 1, "url": "http://x.x.x.22:8888/job/Auto_Test_Pipline/1/"} lastFailedBuild: {"_class": "org.jenkinsci.plugins.workflow.job.WorkflowRun", "number": 1, "url": "http://x.x.x.22:8888/job/Auto_Test_Pipline/1/"} lastStableBuild: null lastSuccessfulBuild: null lastUnstableBuild: null lastUnsuccessfulBuild: {"_class": "org.jenkinsci.plugins.workflow.job.WorkflowRun", "number": 1, "url": "http://x.x.x.22:8888/job/Auto_Test_Pipline/1/"} nextBuildNumber: 2 property: [] queueItem: null concurrentBuild: true resumeBlocked: [root@localhost ~]# Jenkins Nodes Node name Architecture Available swap space Available memory space available Temporary space Available disk space -------- -------- -------- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- (master) Linux (amd64) 799.23/4096.0 389.78/128385.95 MB MB, 3220446 MB to 3220446 MB Test_vm_x.x.x Linux (AMd64) 0.0/0.0 MB 30587.82/32003.24 MB9387 MB 17359 MB test_vm_x.x.x Linux (AMd64) 0.0/0.0 MB 30587.82/32003.24 MB 17359 MB 3968.0/3968.0MB 12455.17/15884.35mb43546 MB 24488 MB [root@localhost ~]#Copy the code

Well, isn’t that easy?!

For more information: pypi.org/project/jen…

That’s all for today, thank you for reading, and we’ll see you next time.