Jenkins

Jenkins + Git: Only build if PR introduced changes in subdirectory

泪湿孤枕 提交于 2021-01-21 09:38:04
问题 We have a large monorepo with multiple projects (A and B) inside of it. I currently have Jenkins setup as a Multibranch Pipelines project that watches the monorepo for PRs. If a PR is created, Jenkins builds both A and B. Now, I want Jenkins to be smarter and only build project A if any change in the PR introduced a change in the A/ directory. This is proving very difficult. when { changeset "A/" } only appears to check if the last commit changed a file in A/ , not if the PR changed a file in

How to run Jenkins Groovy scripts directly from Intellij or Eclipse

眉间皱痕 提交于 2021-01-21 09:36:22
问题 The bounty expires in 6 days . Answers to this question are eligible for a +50 reputation bounty. alex is looking for a canonical answer : The question's author is correct: trying to use Jenkins as a Groovy IDE is a living nightmare. I will award the bounty to anyone who describes how to set up a local IntelliJ (or whatever) environment for executing Groovy scripts that you'd ordinarily execute with Jenkins. It's not obvious because many scripts may contain Jenkins-specific methods that rely

How to run Jenkins Groovy scripts directly from Intellij or Eclipse

守給你的承諾、 提交于 2021-01-21 09:35:13
问题 The bounty expires in 6 days . Answers to this question are eligible for a +50 reputation bounty. alex is looking for a canonical answer : The question's author is correct: trying to use Jenkins as a Groovy IDE is a living nightmare. I will award the bounty to anyone who describes how to set up a local IntelliJ (or whatever) environment for executing Groovy scripts that you'd ordinarily execute with Jenkins. It's not obvious because many scripts may contain Jenkins-specific methods that rely

Passing parameters from Jenkinsfile to a shared library

情到浓时终转凉″ 提交于 2021-01-21 08:45:27
问题 I have several components(code projects with their own Bitbucket repositories) and each of them has a Jenkinsfile as follows: properties([parameters([string(defaultValue: "", description: "List of components", name: 'componentsToUpdate'), string(defaultValue: "refs%2Fheads%2Fproject%2Fintegration", description: "BuildInfo CommitID", name: 'commitId'), string(defaultValue: "", description: "Tag to release, e.g. 1.1.0-integration", name: 'releaseTag'), string(defaultValue: "", description:

jenkins build failure shell command permission denied

半世苍凉 提交于 2021-01-21 08:40:57
问题 I am trying to run shell build command on mac but I get permission denied for e.g. ls /Users/... command. I see whoami is jenkins , which is different for my uesr login? I read online I need to run chmod for jenkins user, how do I do that? I changed file permission using chmod 777? Do I need to change jenkins user? 回答1: Maybe you have a problem that jenkins is not a full user. Try this: Create a user for Jenkins It’s best to run Jenkins as it’s own user (it can then be limited in the

jenkins build failure shell command permission denied

*爱你&永不变心* 提交于 2021-01-21 08:39:05
问题 I am trying to run shell build command on mac but I get permission denied for e.g. ls /Users/... command. I see whoami is jenkins , which is different for my uesr login? I read online I need to run chmod for jenkins user, how do I do that? I changed file permission using chmod 777? Do I need to change jenkins user? 回答1: Maybe you have a problem that jenkins is not a full user. Try this: Create a user for Jenkins It’s best to run Jenkins as it’s own user (it can then be limited in the

Jenkins: get environment variables in the body of a global function

て烟熏妆下的殇ゞ 提交于 2021-01-21 05:33:46
问题 I have a shared global function on PublishGitHub.groovy looks like this: #!/usr/bin/env groovy def call(body) { def config = [:] body.resolveStrategy = Closure.DELEGATE_FIRST body.delegate = config echo "\u001B[32mINFO: Publishing...\u001B[m" body() echo "\u001B[32mINFO: End Publish...\u001B[m" } And a code on my JenkinsFile: environment { VERSION = "v1.3.${env.BUILD_NUMBER}" } stages { stage ('Publish WebAPI'){ steps{ echo "\u001B[32mINFO: Start Publish...\u001B[m" PublishGitHub{ echo "This

Jenkins: get environment variables in the body of a global function

落花浮王杯 提交于 2021-01-21 05:33:24
问题 I have a shared global function on PublishGitHub.groovy looks like this: #!/usr/bin/env groovy def call(body) { def config = [:] body.resolveStrategy = Closure.DELEGATE_FIRST body.delegate = config echo "\u001B[32mINFO: Publishing...\u001B[m" body() echo "\u001B[32mINFO: End Publish...\u001B[m" } And a code on my JenkinsFile: environment { VERSION = "v1.3.${env.BUILD_NUMBER}" } stages { stage ('Publish WebAPI'){ steps{ echo "\u001B[32mINFO: Start Publish...\u001B[m" PublishGitHub{ echo "This

云原生 DevOps 的 5 步升级路径

笑着哭i 提交于 2021-01-20 18:19:45
作者 | 张裕 编辑 | 雅纯 来源| 阿里巴巴云原生公众号 什么是云原生 DevOps 点击查看视频: https://v.qq.com/x/page/u3220cutt7v.html 我们先通过上面一个简短视频和下面两张图,来了解什么是云原生 DevOps,它和 DevOps 有什么不同。 上图是一个大排档,图中的大厨在非常努力的去切、炒、制作各种美食,并将它卖出去。从原材料的采购到加工到销售到售后,都是一两个人完成。这是非常典型的 DevOps 场景,团队搞定端到端的所有的事情。这种情况,当厨师水平比较高、销售能力比较强的时候,可以做到高效率、低浪费。但存在的问题是,想要规模化会很难。因为它的流程都是非标准的,需要厨师有很强的个人能力。 我们再看上面这张南京大排档的图,虽然名字里有大排档,但它显然不是我们上面说的大排档。我们随便走进任何一家南京大排档,都可以发现,南京大排档的厨师,可以专注在为客户提供更好的菜品上,研发试验新菜品,并通过小批量的用户来尝试和推广。无论是用户量增加或减少,都能很快的去适应。店铺扩张也可以很快。这种我们可以理解为云原生 DevOps。 那究竟什么是云原生 DevOps 呢?我们认为:云原生 DevOps 是充分利用云原生基础设施,基于微服务/无服务架构体系和开源标准,语言和框架无关,具备持续交付和智能自运维能力,从而做到比传统 DevOps

Is it impossible to checkout a different branch in Jenkinsfile?

独自空忆成欢 提交于 2021-01-20 17:51:33
问题 I have two branches on BitBucket: master and develop . I've also got a BitBucket Team Folder job configured on my Jenkins server to build that repository. On the develop branch there's the following Jenkinsfile: node { stage('Checkout') { checkout scm } stage('Try different branch') { sh "git branch -r" sh "git checkout master" } } When Jenkins runs it, the build fails when it attempts to checkout master : [Pipeline] stage [Pipeline] { (Try different branch) [Pipeline] sh [e_jenkinsfile-tests