Jenkins

Can Jenkins show me the total number/percent of broken builds per month?

北城以北 提交于 2020-12-05 14:34:56
问题 I have a Jenkins server that builds/tests about 50 projects. Unfortunately, some of these builds fail, but I don't have a good way to measure whether build failures are increasing or decreasing in frequency over time. What I'd like is something along these lines: A report that shows me, over the course of a month, how many jobs were unstable/failed A report that says "X Days without a broken build" (kind of like at construction sites) A "Red/Green calendar", that would show on a per-day basis

Can Jenkins show me the total number/percent of broken builds per month?

ぃ、小莉子 提交于 2020-12-05 14:34:07
问题 I have a Jenkins server that builds/tests about 50 projects. Unfortunately, some of these builds fail, but I don't have a good way to measure whether build failures are increasing or decreasing in frequency over time. What I'd like is something along these lines: A report that shows me, over the course of a month, how many jobs were unstable/failed A report that says "X Days without a broken build" (kind of like at construction sites) A "Red/Green calendar", that would show on a per-day basis

Jenkins Pipeline Conditional Environmental Variables

烈酒焚心 提交于 2020-12-05 14:13:45
问题 I have a set of static environmental variables in the environmental directive section of a declarative pipeline. These values are available to every stage in the pipeline. I want the values to change based on an arbitrary condition. Is there a way to do this? pipeline { agent any environment { if ${params.condition} { var1 = '123' var2 = abc } else { var1 = '456' var2 = def } } stages { stage('One') { steps { script { ... echo env.var1 echo env.var2 ... } } } } stag('Two'){ steps { script { .

Jenkins Pipeline Conditional Environmental Variables

半世苍凉 提交于 2020-12-05 14:06:55
问题 I have a set of static environmental variables in the environmental directive section of a declarative pipeline. These values are available to every stage in the pipeline. I want the values to change based on an arbitrary condition. Is there a way to do this? pipeline { agent any environment { if ${params.condition} { var1 = '123' var2 = abc } else { var1 = '456' var2 = def } } stages { stage('One') { steps { script { ... echo env.var1 echo env.var2 ... } } } } stag('Two'){ steps { script { .

How to fail a Jenkins job based on pass rate threshold of testng tests

夙愿已清 提交于 2020-12-05 09:44:52
问题 We are trying to use Jenkins as our CI/CD solution, and want ability to fail a deployment if our TestNG tests do not meet a set pass rate threshold. Currently our Jenkins job executes our TestNG tests via maven, thus any test failure marks the build as failed. I.e. anything less than 100% pass rate, will fail the build job. We want ability to make it configurable - i.e. fail the test job if pass rate is below, say, 98%. Is this something i can control or configure inside the Jenkins job via

How to fail a Jenkins job based on pass rate threshold of testng tests

被刻印的时光 ゝ 提交于 2020-12-05 09:41:23
问题 We are trying to use Jenkins as our CI/CD solution, and want ability to fail a deployment if our TestNG tests do not meet a set pass rate threshold. Currently our Jenkins job executes our TestNG tests via maven, thus any test failure marks the build as failed. I.e. anything less than 100% pass rate, will fail the build job. We want ability to make it configurable - i.e. fail the test job if pass rate is below, say, 98%. Is this something i can control or configure inside the Jenkins job via

国内jenkins搭建不再龟速的方式

∥☆過路亽.° 提交于 2020-12-04 19:11:05
最新国内jenkins搭建过程 第一步下载jenkins 点击进入 清华源jenkins下载地址 ,我们下载的是jenkins-2.204.2.zip版本 之后解压后安装。 第二步配置管理员密码 自动弹出到浏览器的 http://localhost:8080/login?from=%2F网址,开始配置过程 按照给出的路径去找到密码并填入 第三步配置插件 如果你在国内的话,建议还是跳过插件安装,下载会有问题 点击跳过插件安装。 第四步注册账号 可以创建账号也可以用admin,我选择创建账号 弄完之后点击下一步 第五步配置jenkins URL地址 这个我没有做改变,如果你觉的这个端口号需要换的话也可以换掉,但是相应的需要去改变配置文件,有很多博客讲如何处理修改端口号的问题。 点击保存并完成,看到欢迎图片 修改插件源 点击 Manage Jenkins->Manage Plugins 点击 Advance 向下拉,可以看到Update Site 在Update Site下的URL填入 http://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json 然后点击Submit之后点击右下角的Check Now 此时很多的博客就停止了,然而你去看下载速度依旧是龟速。 所以要去找到问题所在: 打开jenkins

How can I determine if a variable exists from within the Groovy code running in the Scripting Engine?

此生再无相见时 提交于 2020-12-04 16:01:46
问题 How can I determine if a variable exists from within the Groovy code running in the Scripting Engine? The variable was put by ScriptEngine's put method 回答1: In the groovy.lang.Script there is a method public Binding getBinding() . See also groovy.lang.Binding with method public boolean hasVariable(String name) . Thus you can simple check variable existence like if (binding.hasVariable('superVariable')) { // your code here } 回答2: // Example usage: defaultIfInexistent({myVar}, "default") def

How can I determine if a variable exists from within the Groovy code running in the Scripting Engine?

你。 提交于 2020-12-04 16:00:39
问题 How can I determine if a variable exists from within the Groovy code running in the Scripting Engine? The variable was put by ScriptEngine's put method 回答1: In the groovy.lang.Script there is a method public Binding getBinding() . See also groovy.lang.Binding with method public boolean hasVariable(String name) . Thus you can simple check variable existence like if (binding.hasVariable('superVariable')) { // your code here } 回答2: // Example usage: defaultIfInexistent({myVar}, "default") def

构建一个属于自己的Jenkins镜像

∥☆過路亽.° 提交于 2020-12-03 16:11:36
本文目标 不使用Jenkins官方提供的镜像,从最简系统镜像搭建一个最新稳定版的Jenkins镜像 ,自定义镜像内有的工具如jdk、gradle、node等,使用Dockfile与Shell脚本搭建而成 自定义的原因是官方镜像不能满足我们对于镜像内部工具的需求 本文面向 面向对象:smile: ——本文面向有定制Jenkins镜像需求的小白兔,大神请轻喷~ 环境说明 操作系统:Centos 7 Docker版本:19.03.5 镜像内部依赖说明 基础系统镜像: ubuntu:bionic , 也就是18.04 LTS Gradle: gradle-6.0.1 JDK: jdk1.8.0_221 Node: node-v11.4.0 Jenkins: 最新stable war Dockerfile:构建镜像的蓝图 FROM ubuntu:bionic #基础镜像 #修改国内源,清华大学的 RUN echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse" > /etc/apt/sources.list && \ echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates