Moving Jobs in Jenkins - jenkins

So I have been asked to create a job on a Jenkins system that is on the university servers. The problem is I was asked to create it in a specific folder. However I accidentally created in the root folder. Is there a way to move the job from the root to the specific folder or do I have to delete it and create a new one?

There is a move option on the GUI:
Stand on the little triangle near the job you want to move/copy/delete, and on the popup menu - choose the wanted operation. On move you can move to another folder.
But, There is also an open issue about this (opened on 2016):
https://issues.jenkins-ci.org/browse/JENKINS-35093
I had to restart Jenkins after doing it to a job with some history.
So maybe re-create/copy and delete is a better solution (but no history is saved).

Go to your job's configuration page and from 'Advanced Project Options' check 'Use custom workspace'. Enter the path of the directory where you want the files to be created.

Related

Set group of Jenkins system user when creating a job

I'm using the Authorize User plugin in Jenkins, and I'm trying to setup a multi-tenant jenkins with genuine access control. I want to have a folder with a set of jobs which group A can see, and another folder with another set of jobs which group B can see.
At the master/controller, the $JENKINS_HOME/jobs/ folder creates a new job folder when a build is triggered. However this folder is created as the SYSTEM user, not the build user. The issue is although I could just put the build user into the SYSTEM user's group, this would ALSO give them access to any job on the filesystem, not just the folder they should have.
Is there a way to configure what user:group is set when a job folder is created?
Perhaps this helps:
https://support.cloudbees.com/hc/en-us/articles/204173600-How-do-I-limit-users-access-to-the-folders-to-which-they-belong-to-?page=94
It should also work with vanilla Jenkins.
Warning: untried ;-)

Is it possible to create or edit a Jenkins Project on the fly?

My question was too long so I've shortened it:
Is it possible to create or edit a Jenkins Project on the fly with a template/environment variables/coding/etc, and would this be possible via a trigger from Gitlab/hub/etc.? If someone could point me in the right direction that would be great! Thanks!
Yes.
Your options are to use the rest API (and there's more detailed information in your own Jenkins, check the link in the bottom right corner of every page), or to create the job directory structure and XML files manually and have Jenkins re-scan its workspace directories.
I strongly recommend the rest API. It's designed for this sort of thing.

Sharing files in Jenkins

my post-commit build process in Jenkins prepares several files that are very useful in everyday development. Currently we zip necessary files, copy to a director that is simply shared resource.
I'm looking for some kind of a plugin that would allow me to point a directory for publishing and present its content (something like workspace view in defined job).
Any suggestions ??
OK, I solve this problem with jenkins default direcotry JENKINS_HOME\userContetn (files available from jenkins web page) and mentioned here side-bar-plugin. I created needed symbolic links in userContents and then added applicable links to mail window. Works great. Thx for hints!

How to remove a user from Jenkins

I have many users in Jenkins that have automatically come from SVN. One of our developers left the project and I removed him from the SVN. However, his contacts are not removed from Jenkins and I cannot find a place in Jenkins where I could remove users from. Any ideas on how to remove users from Jenkins?
I couldn't find the delete option. I went here and found a relevant but unhelpful answer. So I just tried:
http://<jenkins.url>/user/<username>/delete
I got redirected to an existing page \o/ There was a button asking to confirm the deletion. I clicked and the user was removed.
Hope this helps
PS: I just found how to do it right: Go to "Manage Jenkins" > "Manage Users" and click the delete button on the same row (far right) of the user you want to delete
I believe you need to remove or replace the user from, all the times they exist, in the build.xml file(s) which are under the jobs directory then the name of the job and the builds directory.
If you go to the People view, you can click a user and then choose Delete in the left-hand menu (if you have Administer access).
You could also delete the folder [jenkins-root]/Users/[username] and re-start Jenkins.

Rename a job in jenkins

How to go about renaming a job in jenkins?
Is there another way than to create a new job and destroying the old one?
In Jenkins v2, in your dashboard or job overview, click right button on the job and select rename:
In the version we're running (1.480) it is simply a matter of changing the Project name in the Configure menu and hitting Save afterwards.
Cheers,
In New Jenkins, Click Rename link present in the left navigation pane, Update the job name and click save.
Simply change the name in the Pipeline/Project name and hit save.
Note that if your browser window isn't wide enough the "popup" below will be offscreen so make sure you scroll down or your jobs may mysteriously not rename.
"Are you sure about renaming old-job to new-job?"
Use the "Configure" option to the left:
Example showing Configure option
(Sorry, first few posts so I'm not able to post images in directly yet!)
If you can't see this then make sure you have access rights - in other words, you may need to be logged in, and you will need privileges that allow you to administer that job/pipeline.

Resources