jenkins 命令行操作说明文档

Jenkins 脚本命令行应用总结 Python微信订餐小程序课程视频 https://edu.youkuaiyun.com/course/detail/36074 Python实战量化交易理财系统 https://edu.youkuaiyun.com/course/detail/35475 Jenkins脚本命令行应用总结 测试环境 Jenkins 2.304 脚本命令行入口 Jenkins主页→系统管理→脚本命令行 遍历项目 例子:获取所有自由风格项目及相关项目信息 def projects = Jenkins.instance.projects.collect 阅读详情

假设Jenkins的URL为http://22.11.140.38:9080/jenkins/

 

基本的格式为

java -jar jenkins-cli.jar [-s JENKINS_URL] command[options][args]

 

下面具体介绍各个命令的作用及基本使用方法

 

1.      help 查看所有内嵌命令的基本功能  无参数

Eg.

java -jar jenkins-cli.jar -shttp://22.11.140.38:9080/jenkins/  help

 

2.      build                      执行一次构建

参数说明:

JOB                : Name of the job to build 要构建的job名称

 -c                 : Check for SCM changes before starting the build, andif

                      there's no change, exit without doing a build

 -p                 : Specify the build parameters in the key=value format.

 -rVAL             : Number of times to retry reading of the output log ifit

                      does not exists on first attempt. Defaults to 0. Use

                      with -v.

 -s                 : Wait until the completion/abortion of the command

 -v                 : Prints out the console output of the build. Use with-s

 -w                 : Wait until the start of the command

 --usernameVAL     : User name to authenticate yourself to Jenkins

 --passwordVAL     : Password for authentication. Note that passing a

                      passwordin arguments is insecure.

    --password-file VAL : File that contains the password

 

3.      cancel-quiet-down: Cancel the effect of the "quiet-down"command.

4.      clear-queue: Clears the build queue

5.      connect-node: Reconnect to a node

6.      console:Retrieves console output of a build 显示某job某次构建的的控制台输出

参数说明:

JOB                : Name of the job

 BUILD              : Build number or permalink to point to the build.

                      Defaults to the last build

 -f                 : If the build is in progress, stay around and append

                      console output as it comes, like 'tail -f'

 -nN               : Display the last N lines

 --usernameVAL     : User name to authenticate yourself to Jenkins

 --passwordVAL     : Password for authentication. Note that passing a

                      password in arguments is insecure.

   --password-file VAL : File that contains the password

 

7.      copy-job:Copies a job

参数说明:

 SRC                : Name of the job to copy

 DST                : Name of the new job to be created.

 --usernameVAL     : User name to authenticate yourself to Jenkins

 --passwordVAL     : Password for authentication. Note that passing a

                      password in arguments is insecure.

    --password-file VAL : File that contains the password

 

8.      create-job: Creates a new job by reading stdin as aconfiguration XML file.

从一个XML文档中创建一个job

Eg.

   java -jar/home/jboss/.jenkins/jenkins-cli.jar -shttp://22.11.140.61:9080/jenkins/ create-job testttt

 

9.      create-node: Creates a new node by reading stdin as a XMLconfiguration.

10.  delete-builds: Deletes build record(s)

参数说明:

JOB                : Name of the job to build

RANGE             : Range of the build records to delete. 'N-M', 'N,M', or

                      'N'

--usernameVAL     : User name to authenticate yourself to Jenkins

--passwordVAL     : Password for authentication. Note that passing a

                      passwordin arguments is insecure.

--password-file VAL : File that contains thepassword

Eg.

java -jar/home/jboss/.jenkins/jenkins-cli.jar -shttp://22.11.140.61:9080/jenkins/  delete-builds3-5

 

11.  delete-job

参数说明:

NAME               : Job name

--usernameVAL     : User name to authenticate yourself to Jenkins

--passwordVAL     : Password for authentication. Note that passing a

                      password in arguments is insecure.

   --password-file VAL : File that contains the password

 

12.  delete-node  Deletes a node

13.  disable-job   Disables a job 相当于“停止构建”

参数说明:

NAME               : Job name

 --usernameVAL     : User name to authenticate yourself to Jenkins

 --passwordVAL     : Password for authentication. Note that passing a

                      passwordin arguments is insecure.

    --password-file VAL : File that contains the password

 

14.  disconnect-node      Disconnects from a node

15.  enable-job              Enables a job 相当于恢复可构建状态

参数说明:

NAME               : Job name

 --usernameVAL     : User name to authenticate yourself to Jenkins

 --passwordVAL     : Password for authentication. Note that passing a

                      password in arguments is insecure.

    --password-file VAL : File that contains the password

 

16.  get-job   Dumps the job definition XML to stdout 得到job定义的XML文档

参数说明:

JOB                : Name of the job

 --usernameVAL     : User name to authenticate yourself to Jenkins

 --passwordVAL     : Password for authentication. Note that passing a

                      password in arguments is insecure.

    --password-file VAL : File that contains the password

 

17.  get-node     Dumps the node definition XML to stdout

18.  groovy       Executes the specified Groovy script.

19.  groovysh    Runs an interactive groovy shell.

20.  help                       Lists all the available commands. 无参数

21.  install-plugin          Installs a plugin either from a file, an URL, or from updatecenter. 安装插件

22.  install-tool   Performsautomatic tool installation, and print its location to stdout. Canbe only called from inside a build.

23.  keep-build              Mark the build to keep the build forever.

24.  list-changes  Dumps the changelog for thespecified build(s).输出某一次或几次构建的变更记录

参数说明:

JOB                        : Name of the job to build

 RANGE                      : Range of the build records to delete. 'N-M',

                              'N,M', or 'N'

 -format [XML | CSV | PLAIN] : Controls howthe output from this command is

                              printed.

 --usernameVAL             :User name to authenticate yourself to Jenkins

 --passwordVAL             : Password for authentication. Note that passing a

                              password in arguments is insecure.

 --password-fileVAL        : File that contains the password

 

25.  list-jobs      Lists all jobs in a specific view or item group.列出所有的jobs名称,其后可以接视图名称,默认显示全部

Eg.

   java -jar/home/jboss/.jenkins/jenkins-cli.jar -s http://22.11.140.61:9080/jenkins/  list-jobsviewname

 

26.  list-plugins  Outputs a list of installedplugins. 列出安装的所有插件

27.  login                     Saves the current credential to allow future commands to runwithout explicit credential information.保存登录状态

参数说明:

--usernameVAL     : User name to authenticate yourself to Jenkins

 --passwordVAL     : Password for authentication. Note that passing a

                      password in arguments is insecure.

    --password-file VAL : File that contains the password

 

28.  logout        Deletes the credential stored with the login command.注销

29.  mail           Reads stdin and sends that out as an e-mail.

30.  offline-node           Stop using a node for performing builds temporarily, until the next"online-node" command.

31.  online-node Resume using a node for performing builds, to cancelout the earlier "offline-node" command.

32.  quiet-down  Quiet down Jenkins, in preparationfor a restart. Don?. start any builds.

33.  reload-configuration            Discard all the loaded data in memory and reload everything fromfile system. Useful when you modified config files directly ondisk.重新加载配置文件无参数

34.  restart        Restart Jenkins 重启Jenkins

35.  safe-restart   Safely restartJenkins 安全重启Jenkins,即等待已有的构建完成再重启

36.  safe-shutdown                     Puts Jenkins into the quiet mode, wait for existing builds to becompleted, and then shut down Jenkins.安全关闭Jenkins

37.  session-id               Outputs the session ID, which changes every time Jenkinsrestarts

38.  set-build-description            Sets the description of a build.为已有构建添加描述

参数说明:

JOB                : Name of the job to build

 BUILD#             : Number of the build

 DESCRIPTION        : Description to be set. '=' to read from stdin.

 --usernameVAL     : User name to authenticate yourself to Jenkins

 --passwordVAL     : Password for authentication. Note that passing a

                      password in arguments is insecure.

    --password-file VAL : File that contains the password

 

39.  set-build-display-name        Sets the displayName of a build重命名默认的构建编号

参数说明:

JOB                : Name of the job to build

 BUILD#             : Number of the build

 DISPLAYNAME        : DisplayName to be set. '-' to read from stdin.

 --usernameVAL     : User name to authenticate yourself to Jenkins

 --passwordVAL     : Password for authentication. Note that passing a

                      password in arguments is insecure.

    --password-file VAL : File that contains the password

 

40.  set-build-parameter   Update/set the buildparameter of the current build in progress

参数说明:

NAME               : Name of the build variable

 VALUE              : Value of the build variable

 --usernameVAL     : User name to authenticate yourself to Jenkins

 --passwordVAL     : Password for authentication. Note that passing a

                      password in arguments is insecure.

    --password-file VAL : File that contains the password

 

41.  set-build-result       Sets the result of the current build. Works only if invoked fromwithin a build.

42.  shutdown    Immediatelyshuts down Jenkins server 立即关闭jenkins

43.  update-job  Updates the job definition XML from stdin. Theopposite of the get-job command

44.  update-node           Updates the node definition XML from stdin. The opposite of theget-node command

45.  version      Outputs the current version. 查看当前版本

46.  wait-node-offline    Wait for a node to become offline

47.  wait-node-online    Wait for a node to become online

48.  who-am-i   Reports your credential andpermissions 查看当前登录用户

 

Tips:为了操作方便,建议先通过login命令保存登录状态,这样就不需要每次执行操作都加上用户名密码参数了;缺点是安全性不好,记得操作结束之后logout

RobotFramework接口测试方案 Robot Framework是用于验收测试和回归测试的通用测试自动化框架。它使用易于理解的表格数据语法,非常友好的实现了关键字驱动和数据驱动模式。它的测试功能可以通过使用Python或Java实现的测试库进行扩展,用户可以使用与创建测试用例相同的语法,从现有的关键字创建新的更高级别的关键字。利用Robot Framework编写测试用例,往往需要开发自己的关键字,有的关键字需要通过自己编写python代码来实现。这在rf中,就需要自己定义python库。这个过程其实不复杂,本文来介绍下。 阅读详情

相关推荐

Git push与pull底层原理:命令行与GUI协同工作流详解

Git push和pull是分布式版本控制的核心操作,其本质区别在于push是单向快照广播,pull是双向状态协商。理解工作区、暂存区、本地仓库与远程仓库的四层模型,是掌握分支同步、上游设置(-u)、认证机制(SSH/PAT)及冲突规避的前提。技术价值体现在协作安全边界的确立与历史可追溯性保障;典型应用场景包括首次推送初始化、Fork后PR发起、团队多分支协同开发。本文聚焦真实项目中高频踩坑点——如‘Everything up-to-date’误推、pull自动合并冲突、GitHub Desktop隐藏的-

weixin_34277853的博客 360

Jenkins的授权和访问控制

一 Jenkins的授权和访问控制默认地Jenkins不包含任何的安全检查,任何人可以修改Jenkins设置,job和启动build等。显然地在大规模的公司需要多个部门一起协调工作的时候,没有任何安全检查会带来很多的问题。 我们可以通过以下2方面来增强Jenkins的安全:1) Security Realm,用来决定用户名和密码,且指定用户属于哪个组;2) Authorization Strate...

weixin_34168880的博客 476

Windows PATH环境变量配置全攻略:解决STM32CubeProgrammer命令不可用问题

PATH环境变量是操作系统查找可执行程序的核心机制,其本质是一组以分号分隔的目录路径列表。当用户在命令行输入命令(如STM32_Programmer_CLI.exe)时,系统按顺序遍历PATH中各路径,匹配同名.exe/.bat文件。配置失效常源于作用域混淆(用户变量vs系统变量)、路径格式错误(空格未转义、结尾反斜杠、大小写不一致)或权限隔离(管理员CMD不继承用户PATH)。该机制直接影响嵌入式开发中的CLI工具调用、ST-Link烧录及CI/CD自动化部署。本文聚焦Windows平台下PATH的底层原

weixin_34192816的博客 315

【漏洞通告】 Jenkins CLI 任意文件读取漏洞

Jenkins是一个开源软件项目,是基于Java开发的一种持续集成工具,用于监控持续重复的工作,旨在提供一个开放易用的软件平台,使软件项目可以进行持续集成。Jenkins 有一个内置的命令行界面(CLI),可从脚本或 shell 环境访问 Jenkins。处理 CLI 命令时, Jenkins 使用args4j库解析 Jenkins 控制器上的命令参数和选项。

y995zq的博客 2411

Linux服务器部署JMeter全攻略:从环境搭建到分布式压测实战

性能测试是保障软件系统稳定性和扩展性的关键环节,其核心原理是通过模拟真实用户并发请求,评估系统在高负载下的表现。JMeter作为一款开源的Java应用,因其强大的可扩展性和丰富的协议支持,成为业界广泛采用的性能测试工具。其技术价值在于能够精准模拟复杂业务场景,生成详细的性能指标报告,为系统容量规划和瓶颈定位提供数据支撑。在持续集成、微服务压测和云端负载测试等应用场景中,JMeter的无头模式运行和分布式部署能力尤为重要。本文聚焦于在Linux服务器上部署JMeter的完整流程,涵盖JDK环境配置、无头模式执

weixin_34310369的博客 349

Ubuntu 16.04 + Docker 安全审计实战:Docker Bench for Security 精准加固指南

Docker 安全审计是容器化生产环境的基础保障,其核心在于配置合规性验证而非漏洞扫描。基于 CIS Docker Benchmark 的 Docker Bench for Security 工具,以 Bash 脚本形式实现轻量、可靠、低依赖的配置检查,特别适配 Ubuntu 16.04 这类 EOL 但仍在工业场景广泛使用的系统。它深度解析 daemon.json 配置、校验 auditd 日志规则覆盖、验证 docker.sock 权限与 systemd 服务状态,将抽象安全标准转化为可执行的工程动作。

weixin_30340617的博客 403

[CVE-2024-23897]Jenkins CLI 任意文件读取漏洞导致远程代码执行漏洞

Jenkins 受影响版本中使用 args4j 库解析CLI命令参数,该库默认将参数中 @ 字符后的文件路径替换为文件内容,攻击者可利用该特性使用 Jenkins 控制器进程的默认字符编码读取 Jenkins 控制器文件系统上的任意文件(如加密密钥的二进制文件),并结合 Resource Root URL、Remember me cookie、存储型 XSS 或 CSRF 等在 Jenkins 控制器中执行任意代码。Jenkins CLI 是 Jenkins 内置的命令行页面。

whoami 5027

使用命令行界面(CLI)管理 Jenkins 服务器

通过使用 Jenkins CLI,您可以通过命令行界面管理 Jenkins 服务器。本文介绍了一些常用的 CLI 命令,包括连接到 Jenkins 服务器、列出作业、创建作业、触发构建、查看构建历史、下载构建日志、更新作业配置和删除作业。通过 CLI 的灵活性,您可以更轻松地自动化和集成 Jenkins 的工作流程。请注意,本文中的示例命令假定您已经安装和配置了 Jenkins 服务器,并具有适当的访问权限。确保在实际使用时根据您的实际情况进行相应的替换和调整。

IsdCoding的博客 790

Jenkins 命令行操作说明文档

假设Jenkins的URL为http://22.11.140.38:9080/jenkins/ 基本的格式为 java 基本的格式为 java -jar jenkins-cli.jar [-s JENKINS_URL] command [options][args] 下面具体介绍各个命令的作用及基本使用方法 1. ...

woshiyuhao的博客 876

Java JAR反编译工程化实践:基于CFR的命令行批量处理脚本

Java反编译是字节码逆向分析的基础技术,其核心原理是将JVM指令流映射回符合Java语言规范的源码结构。随着CI/CD和代码审计场景普及,传统GUI工具(如JD-GUI)因不可编程、难集成、结果不稳定等缺陷,已无法满足自动化、可验证、可沉淀的工程需求。CFR作为当前兼容JDK 8~17、支持正则过滤、命令行完备且输出规范的主流反编译引擎,成为构建可编程反编译能力的理想底层。本文围绕CFR引擎封装Python调度层,实现jar解压→class筛选→并发反编译→错误恢复的完整流水线,覆盖安全审计、API变更比

weixin_32306957的博客 202

Advanced Installer实战:构建专业Windows MSI/EXE安装包与CI自动化

软件交付不能止步于压缩包,尤其是面对企业级部署时,安装包需要处理运行库、注册表、服务与权限等复杂依赖。Windows Installer(MSI)通过文件表、组件和升级码等机制,提供了标准化安装与卸载的基础。结合EXE引导包,还能检查启动条件、预装VC++/.NET运行库,并通过数字签名保障来源可信。在持续集成场景中,采用命令行参数化构建与版本注入,可让MSI产物自动进入CI/CD流水线。Advanced Installer 20.7.1 正是这样一款将MSI/EXE构建、启动条件、多语言、签名与命令行打包

weixin_34224941的博客 252

在WSL上的部署Jenkins

本文介绍了Jenkins的基本概念及其与Ansible的区别,详细指导在WSL上安装和配置Jenkins的步骤。主要内容包括:Jenkins作为开源CI/CD工具的用途和特点;与Ansible在自动化领域的定位差异;WSL的安装方法(默认Ubuntu或自定义发行版本);在CentOS Stream 9上部署Jenkins LTS的具体流程(依赖安装、Java配置、服务启动等);WSL使用注意事项;以及常见CI工具的分类(云托管/SaaS和自建/开源方案)。文章为开发者提供了从环境搭建到服务部署的完整指南

www654321wcn的博客 448

VS2012使用教程:安装、调试与v110工具集避坑指南

在Windows开发工具持续迭代的今天,旧版本工具链的兼容性仍是许多开发者的现实需求。Visual Studio 2012作为.NET Framework 4.5与C++ v110工具集的官方载体,是大量工控、医疗和教育项目锁定的开发环境。其安装过程并非一路顺畅:Win10/11上的组件冲突、离线安装时ISO挂载方式、v110工具集与新版IDE的串扰,都是常见痛点。理解其编译与调试机制,掌握附加进程、OutputDebugString和MSBuild命令行调用,能大幅提升遗留项目的维护效率。从基础概念到工程

weixin_33971977的博客 338

Jmeter接口测试与性能测试实战:从参数化到分布式压测

接口测试是服务端质量保障的重要环节,尤其在微服务和分布式架构下,如何高效验证接口功能和并发能力成为测试工程的核心挑战。Apache JMeter作为一款纯Java编写的开源测试工具,通过线程组模拟多用户请求、断言校验响应结果、聚合报告分析吞吐量与响应时间,将接口测试和性能测试统一到同一套工作流中。其支持HTTP、HTTPS、WebSocket等多种协议,结合CSV参数化和正则/JSON提取器实现数据驱动与Token关联,能够覆盖从单接口冒烟到高并发压测的场景。配合命令行非GUI模式和Jenkins集成,可定

weixin_34151004的博客 416

Understand 2.0 代码分析实战:静态解析、交叉引用与依赖分析

静态代码分析通过解析源码构建符号关系网,帮助工程师快速理解大型项目结构。其核心原理是基于抽象语法树和语义分析建立可查询数据库,支持交叉引用、调用链追踪和依赖分析。在遗留系统维护、重构影响评估和代码考古中,这类工具能显著提升效率。Understand 2.0 作为典型工具,提供图形化视图和命令行接口,可导出引用关系并集成到 CI 流程。本文分享建库解析、交叉引用查询、避坑排查及 Python API 自动化检查的工程实践。

weixin_33868027的博客 289

手把手教你用Python处理MAHNOB-HCI多模态数据集(含脑电EEG/眼动/视频数据同步实战)

本文详细介绍了如何使用Python处理MAHNOB-HCI多模态数据集,涵盖脑电(EEG)、眼动追踪和视频数据的同步解析与对齐。通过MNE-Python、pandas和OpenCV等工具,实现从BDF、TSV到XML格式的高效处理,解决时间轴对齐难题,助力情感计算与人机交互研究。

weixin_30998797的博客 368

NanoVNA-F 项目使用教程

NanoVNA-F 项目使用教程 1. 项目的目录结构及介绍 NanoVNA-F 项目的目录结构如下: NanoVNA-F/ ├── FreeRTOS-Plus-CLI/ ├── Img/ ├── Inc/ ├── Lib/ ├── MDK-ARM/ ├── Src/ ├── Usr/ ├── LICENSE ├── NanoVNA-F.ioc ├── README.md ├── nanoVNA-...

gitblog_00007的博客 592

3D点云修复实战:用PCN网络快速补全缺失的激光雷达数据(附代码)

本文详细介绍了PCN(Point Completion Network)网络在3D点云修复领域的实战应用。针对激光雷达数据常见的缺失问题,PCN通过端到端的深度学习架构,直接处理原始点云,实现由粗到精的快速补全。文章深入解析了其核心思想与编码器-解码器架构,并提供了完整的环境搭建、数据准备、模型实现、训练评估及在真实场景下的优化策略与代码示例,为自动驾驶、机器人等领域的开发者提供了高效的数据修复解决方案。

weixin_29041195的博客 392

Unity AssetBundle自动化打包:从原理到CI/CD集成的工程实践

AssetBundle是Unity引擎中实现资源动态加载与热更新的核心技术,它通过将场景、模型、纹理等资源从主包分离,构建出独立的资源包。其工作原理基于资源依赖分析与打包管线,核心价值在于优化应用包体大小、支持资源按需加载与远程更新,广泛应用于移动端游戏、大型应用等需要管理海量资源或实现热更新的场景。在工程实践中,通过编写编辑器脚本实现资源收集、Bundle命名、依赖处理与版本文件生成的自动化流程,能极大提升开发效率并减少人为错误。本文深入探讨了如何结合CI/CD工具(如Jenkins)构建稳健的自动化打包

weixin_33709364的博客 379

把时间当成数据:SAP ABAP 里的 DATS/TIMS 与 DATN/TIMN,怎么选才不踩坑

SAP项目中日期时间字段的陷阱与优化 日期时间字段(DATS/TIMS)在SAP项目中看似简单却常引发事故,主要问题包括: 非法日期(如20201331)入库后,在月结、对账时爆发异常 空值被处理为00000000导致排序错误 ABAP提供两种处理方案: 经典类型DATS/TIMS:存储为字符格式,校验宽松易存脏数据 HANA原生类型DATN/TIMN:数据库级校验,写入即拦截非法值 优化建议: 在接口层和入库前进行严格校验 新项目优先使用DATN/TIMN类型 对遗留数据使用DATS_IS_VALID等函

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 184

ZYNQ GP总线实现PS与PL交互

3,完成 ZYNQ7 Processing System 的配置更改后,回到 Diagram 界面中,可以看到新出现了名为 M_AXI_GP0_ACLK、M_AXI_GP0 和 FCLK_CLK0 的接口,下面我们要对这些接口进行连接或引出。此处的偏移量,AXI的相邻寄存器偏移量相差4个字节,默认slv_reg0的偏移量是0,可以推导出slv_reg1,slv_reg2的偏移量分别为4和8,这里只用到了slv_reg0,所以偏移量为0。当然了,窗口数量的增加,势必会使得单个窗口的采样深度变小。

wangjie36的博客 7094

GitHub Release Notes:自动化发布说明生成器的终极指南

你是否曾为每次版本发布时的手动编写发布说明而烦恼?GitHub Release Notes(简称gren)正是为了解决这个痛点而生的智能工具。它能自动分析项目的提交历史和标签,生成专业、格式化的发布说明,让你的版本发布流程更加高效规范。 ## 项目亮点:告别手动编写发布说明的烦恼 想象一下,每次发布新版本时,你不再需要手动整理提交记录、分类问题修复和新功能,而是有一个智能助手自动完成这一切。G

gitblog_01193的博客 518

看完就会!手把手教您如何正确开启飞牛Nas 虚拟机的 IOMMU 硬件直通,让虚拟机的性能飙升!

看完就会!手把手教您如何正确开启飞牛Nas 虚拟机的 IOMMU 硬件直通,让虚拟机的性能飙升!

XiaoqiangClub的博客 1万+
上一篇: 印刷充值卡防止印刷商可以根据你提供印刷的卡号和密码进行使用的解决方案
下一篇: jenkins服务脚本
php_sir
博客等级 码龄14年 3粉丝 32原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值