1.在参数部分添加bool参数
parameters { booleanParam( name: 'CleanWorkspace', defaultValue: false, description: '清理工作空间,默认不清理!' ) }
2.在脚本用引用这个参数
stage("Initializationt") { steps { echo "初始化信息" script { if(params.CleanWorkspace) { echo "=========================================清理工作空间:${params.CleanWorkspace}=========================================" cleanWs() } } } }
标签:缓存,清理,echo,CleanWorkspace,params,Jenkins From: https://www.cnblogs.com/xiaoxiaomuyuyu/p/18101967