11 votes

Jenkins shows the job as failed if there is nothing to commit to gitlab

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 ...
Francesco Fornari's user avatar
6 votes
Accepted

Jenkins shows the job as failed if there is nothing to commit to gitlab

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 ...
Jesusaur's user avatar
  • 198
6 votes

How to upgrade job-dsl files to Jenkins 2 pipelines?

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 ...
Gepser Hoil's user avatar
  • 1,312
3 votes
Accepted

Jenkins parameters default to env variable?

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', ...
jayhendren's user avatar
  • 2,932
3 votes

How to restore default Jenkins plugins?

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/...
030's user avatar
  • 13.1k
3 votes

Is there a way to run the Jenkinsfile from command line?

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 ...
Jiri Klouda's user avatar
  • 5,807
2 votes

Is there a way to run the Jenkinsfile from command line?

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 ...
Robert's user avatar
  • 133
2 votes

How to restore default Jenkins plugins?

I find it strange that nobody mentioned the Configuration as Code plugin. Our solution to this problem is to maintain a base Docker image for jenkins, provisioned with two config files: jenkins.yml ...
Bruce Becker's user avatar
  • 3,570
2 votes

Jenkins shows the job as failed if there is nothing to commit to gitlab

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 ) { ...
Alex's user avatar
  • 4,522
2 votes

How to restore default Jenkins plugins?

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 (...
Dan Cornilescu's user avatar
2 votes
Accepted

How to restore default Jenkins plugins?

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 ...
030's user avatar
  • 13.1k
2 votes

Jenkins - restrict which nodes can be selected by user when creating jobs

How Do I Restrict Access to Agents (previously called Slaves)? You haven't specified what Jenkins you're running or whether you have licensed Cloudbees plugins. If you have the Cloudbees folder plugin ...
Steven the Easily Amused's user avatar
2 votes
Accepted

Trigger a job and get the job log on the same page in Jenkins

It looks like there exists a plugin to do exactly what you want: Display console output plugin. However, I haven't tried this plugin myself, and it looks like this plugin is not well-maintained, so I ...
jayhendren's user avatar
  • 2,932
1 vote
Accepted

after automatic update jenkins fails with `InvalidBuildsDir: .../${ITEM_FULL_NAME}/builds does not resolve to an absolute path`

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'...
SaxDaddy's user avatar
  • 226
1 vote

Jenkins - restrict which nodes can be selected by user when creating jobs

You could use Project-based Matrix Authorization Strategy for user authorisation in Jenkins. Works well with Folders plugin, then you have each project in a separate folder and permissions on each ...
MasterBuilder's user avatar
1 vote
Accepted

Jenkins - load scripted parameters from a SCM repo

As far as I can tell, there is no native functionality in Active Choice Parameters to load the Active Choice code from SCM. There are a couple ways to build this functionality yourself, however they'...
jayhendren's user avatar
  • 2,932
1 vote

Load Balancing of Jenkins Nodes without Load Balancing Plugin?

This is similar to: https://stackoverflow.com/questions/55023570/how-to-run-a-job-on-first-available-node/55567958 Have you considered Least Load plugin? https://plugins.jenkins.io/leastload By ...
Ian W's user avatar
  • 449
1 vote

Compatibility of http-builder-ng Groovy module with Jenkins 2

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/...
casey vega's user avatar
1 vote

How can a Windows server be a slave to Jenkins running on Linux when there in an error installing the slave-agent.jnlp file?

You have two arguments that are empty: <application-desc main-class="hudson.remoting.jnlp.Main"> <argument>32ba31ca5f150c2b3491802b0b60e56574d970a9e601cebad656a113fe325a85</argument&...
Logan's user avatar
  • 11
1 vote
Accepted

docker as slave for jenkins

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
Adam's user avatar
  • 26

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