Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
6

No, there still isn't any common practice for this since this is not very common. I would recommend you to create a Development Jenkins Environment and run tests against it. Right now you will have to do that from scratch since there are not many open source repositories that could help you. So, how does this Jenkins Development Environment look like? For ...


3

You need to use double quotes instead of single quotes. Single-quoted strings don't perform string interpolation. For instance: parameters { string( name: 'DEPLOY_BUILD_NUMBER', defaultValue: "${BUILD_NUMBER}", description: 'Fresh Build and Deploy OR Deploy Previous Build Number' ) }


3

In order to get a success, you need to avoid non-zero exit codes. A simple solution would be to change the last line of your script to git commit -a -m 'Changes pushed by Jenkins' | true, but better solutions would parse the output of git-add and only run git-commit when there is something to commit.


2

One could use ansible geerlingguy.jenkins role. When this role is applied, a Jenkins system will be created without any plugins. Subsequently, one could install plugins manually, but also define them in ansible, i.e. plugins as code.


2

I'm going to assume that you have a way to know if the commit is empty or not. You can use the following code to mark the job as a success instead of relying on error codes. if( some use case ) { currentBuild.result = 'SUCCESS' echo "Job succeeded." return } You have two options for placement. Putting this inside a stage will exit only that ...


2

I assume you would like to run locally to test logic? If so there is a unit testing framework for Jenkins declarative / scripted pipeline. I have not personally used it but this would enable me to test stubbed logic locally. Alternatively, as you're no ta fan of GUIs you could have a look at Jenkins X which has a very powerful CLI and is more gitops driven.


1

I'm not very familiar with Jenkins on Windows, but I imagine your issue lies in the fact installing Jenkins on drives other than C:\ are more difficult to deal with. Since Jenkins is not running, you'll have to configure config.xml by hand. Here's a post on stackoverflow.com that may help you. As they state, you'll probably need to find the Workspace Root ...


1

I've done this before. Essentially you can use the Jenkins CLI to import/export jobs, which will allow you to create and/or update a job with the definition you want to run. Be it JenkinsFile or some groovy script or whatever. Check this blog for details. Once you (re)define the job, you will simply remotely execute it using the same Jenkins CLI. You can ...


1

One could also use docker Jenkins LTS. If one wants to start from scratch, just remove the mounted Jenkins home folder and there will be a clean Jenkins in no time. https://github.com/jenkinsci/docker/blob/master/README.md


1

One possible approach, although a bit tedious (and a bit dumb), would be to: make a fresh Jenkins installation of the exact same version on another (maybe scrappable) machine get the list of the (default) plugins it ends up with add/remove/update the plugins in the original Jenkins installation to match that list


1

I would recommend against importing if at all possible. You can use built-in functionality to achieve the same results. Also be aware of "In-process Script Approval" https://stackoverflow.com/a/42662243/1678094 // GET def get = new URL("https://httpbin.org/get").openConnection(); def getRC = get.getResponseCode(); println(getRC); if(getRC.equals(200)) { ...


1

Sounds like the docker image you are using doesn't have the correct name, or is stored in a private repository which requires login. Please post more information


1

In my automatic jenkins job, launched daily, if there are no changes the git commit command returns 1. That will mark the build as failed. To solve this problem I use these two commands in my shell build step: git add -A git diff-index --quiet HEAD || git commit -m "Jenkins automatic update commit" the first will eventually add all unstaged files in the ...


Only top voted, non community-wiki answers of a minimum length are eligible