The Save/Apply button is missing from Jenkins pipeline configuration page. There seems to be no other way to apply changes to the configuration settings. I am unable to find any useful answers or workarounds as well. I have tried several Javascript workarounds, reinstallation, uninstalled plugins that generated warnings, and stuff but nothing seems to be working. I am using Jenkins version 2.222.3 with BlueOcean.
It would be a great help if anyone can suggest a solution.
Jenkins Pipeline configuration is defined in Jenkins Pipeline (e.g. Jenkinsfile). To change your configuration, you need to edit your Jenkinsfile.
E.g. to change "Build periodically", here's an example of edit you need to do:
pipeline {
triggers {
cron('* * * * *') // run every minute
This is why the page you're looking at is called "View Configuration" — it is for viewing only.
Using the GitHub plugin, we have an organization folder that is scanned for any repositories that contain a Jenkinsfile. The configuration you are viewing is driven by a config.xml that is copied from the organization folder into each job that runs in a repo. So you want your changes to affect jobs/my_organization/config.xml, not jobs/my_organization/jobs/my_repo/config.xml.
In the UI this is accomplished by going up a level or two from the job or job run. There you will see the link change from "View Configuration" to "Configure".
Related
My Jenkins shared pipeline, used by dozens of repos internally, has several parameter fields defined. We have several repos that initially used another library, or their own ad-hoc pipelines, but then imported the shared library.
In some of these cases, the "Build With Parameters" UI shows both the old and new parameters. We have re-run the pipelines several times, but the old fields won't go away.
If we create a new branch, only the new fields are shown.
I am thinking there's an xml file on the controller that we have to wipe, but I'm not sure where.
Has anyone seen this? What's the resolution?
Update 1
I went into the jobs folder for a branch showing this, and backed-up the config.xml file:
> cd /mnt/data/jenkins/jobs/<org>/jobs/workflows/jobs/<repo>/branches/jenkins-test/
> mv config.xml config.xml-bak
Upon re-running the job, it re-creates the config.xml and it has the same issue: old and new fields still showing.
So I deleted the entire jenkins-test branch folder. The job doesn't go away in the UI. I made a test commit to the branch in Github, Jenkins picked it up and ran it. It automatically re-created the jenkins-test folder on the controller, and upon re-trying Build With Parameters, it still shows the old and new params.
Got to keep digging...
Update 2
I created https://issues.jenkins.io/browse/JENKINS-69652 for this.
update 3
I confirmed the commit that triggered the build is the right commit in the source repo, and it is pulling the correct commit of the pipeline library.
Update 4
Interesting. I Replayed a run, and entered a dummy pipeline:
pipeline {
agent none
stages {
stage ('hello') {
steps {
echo 'hello!'
}
}
}
}
Going back to the Build With Parameters UI, it now shows only the old parameter fields. Where is this coming from? Where is it stuck??
My first guess is that you're loading a Pipeline library implicitly and defining the parameters in that implicitly loaded Pipeline library.
Pipeline libraries that are loaded implicitly are loaded into the Jenkinsfile without requiring an #Library reference to load them.
Check the jobs and the parent folders of those jobs and the root for Pipeline libraries that are defined and have the 'Load implicitly" checkbox enabled.
I have a Jenkins pipeline that I have setup with a project I have on GitHub. Initially, I manually initiated a build each time I changed my code by clicking the "Build Now" option. However, I did two things to make my process easier:
I setup a GitHub hook to run the build I defined in my Jenkinsfile after each push to my master branch
I setup a periodic build to build every hour
I left my Jenkins for a day, came back, and everything, even from the dashboard, looks different.
For example:
My dashboard used to have these options:
New Item
People
Build History
Project Relationship
Check File Fingerprint
Manage Jenkins
My Views
Lockable Resources
Credentials
New View
The current dashboard only has three of those options:
People
Build History
Credentials
Also, when I clicked on my pipeline, the options I had were:
Status
Changes
Build Now
Delete Pipeline
Configure
Full Stage View
Rename
Pipeline Syntax
Whereas now, they are:
Status
Full Stage View
GitHub Hook Log
Git Polling Log
How can I change my configurations/settings to see the pages the way I saw them before? It seems I can't create any new items or change my current pipeline, which are things I may need to do in the future.
It turns out I wasn't logged in. I didn't think the initial pages would even show up if I hadn't been logged in, so I didn't even consider it to be a possibility. I logged in and all my issues were resolved.
I have groovy email template(for Selenium Robot framework test execution) for Jenkins. Jenkins master is controlled by a remote team. So for placing this template in $JENKINS_HOME/email-templates, we need to raise a ticket and wait from 2 to 3 days. Also we expect, there might be changes required in template. So we are planning to put our templates inside our source code repository (GIT). so in the Jenkins test job, we checkout the test script together with email templates.
How to instruct Jenkins to look for the template in workspace folder instead of $JENKINS_HOME/email-templates in Jenkins Master
Sadly it seems you would need to modify the email-ext plugin as the search path is hardcoded into it.
You can see it here, check the occurrence on line 69 in file src/main/java/hudson/plugins/emailext/EmailExtTemplateAction.java
Changing it to another path would be trivial, however adding multiple locations you'd probably have to put some work in.
Edit: I wonder if it would be possible to put the wanted stuff into some txt file as a build step, and then load it into the mail content via some template configuration. If you have access to the job configuration this might be worth checking.
You can copy the template into the build workspace (e.g. with SCM step), and then email-ext can reach it:
${SCRIPT, template="${WORKSPACE}/foo.template"}
I have about 200 jenkins, each of them has a long config page but actually most config are the same. Everytime when I need to update something in the common config, I write a groovy script to loop though those jobs and update them one by one. It's a pain because it takes about 5 minutes to update those jobs by the groovy script. I am wondering is there a jenkins plugin(or something else) that I can use to put the common config in one place? jenkins slicing plugin doesn't work well, I think it conflicts with another plugin.
Thanks
Sounds like a job for the job-dsl plugin
From the wiki page
The Jenkins job-dsl-plugin attempts to solve this problem by allowing
jobs to be defined with the absolute minimum necessary in a
programmatic form, with the help of templates that are synced with the
generated jobs. The goal is for your project to be able to define all
the jobs they want to be related to their project, declaring their
intent for the jobs, leaving the common stuff up to a template that
were defined earlier or hidden behind the DSL.
I have all my test environment configurations stored in SVN in .properties files. I also have a Jenkins job that can deploy my artifacts to a specific test environment with delivery/build pipeline manual trigger. However, this can create a sense of uncertainty because I am never quite sure what configurations I deploy to the test environment as Jenkins does not automatically show them to you.
I noticed Jenkins offers parameterized builds, and offers you a page which lets you parameterize some values e.g. using some drop-down before triggering the build. My question is , would it be possible to have Jenkins display all the key/value pairs I have defined in my .properties file, and even let me change them? This way I could always review/edit my environment properties before actually making the deployment. Ofcourse, if I make changes then I need to remember to add them to SVN too... Thanks for your input!