Difference between Jenkins Job and Project - jenkins

When I am on the main Jenkins screen, I get a link to Create a New Job.
When I create a new job and call it 'New Job' and run it I get results. When I review the results, I get a link to Back to Project. When I click this I see Project New Job on the top of the page.
So is a job and a project the same thing in Jenkins? Or are the names used interchangeably?

This puzzled me quite a bit, too, and although this is an old question I thought I'd expand #Jan's comment with some content from the discussion he linked, as it might help other users.
From the Jenkins CI forum:
A project is a special case of a job, i.e. all projects are jobs, but
not all jobs are projects.
Perhaps it helps to extend mentally the names to "general purpose
jobs" and "software building projects" (although the latter don't need
to build software, they are tailored to this use case).
In the case of "new job", Jenkins can't know yet if the new job
will be of the project subtype. On the other hand, once you have chosen
to create a project, this is reflected as specific as possible in the UI
("Project Foo"). If you look at the precise wording on the "New Job"
page, you'll realize the subtle differences (e.g. "Build a free-style
software project" as opposed to "Monitor an external job").
An example of a job that is not a project is the lesser known
"external job" that receives notifications from events that happen
outside Jenkins, but should be tracked inside Jenkins (e.g. system
restarts, etc.). See
https://wiki.jenkins-ci.org/display/JENKINS/Monitoring+external+jobs for
more about this job type.
For the records, this is the actual class model used by Jenkins internally
(extending sub-classes are indented below their super-class):
Job
AbstractProject
MatrixProject (a.k.a. "multi-configuration project")
Project
FreeStyleProject
MatrixConfiguration (a single configuration of a matrix project)
StubJob
ViewJob
ExternalJob
Only FreeStyleProject, MatrixProject, and ExternalJob are visible on the
"New Job" page.

Yes, they mean totally the same thing! Below is from the Jenkins guide:
Setting up the project
Go to Jenkins top page, select "New Job", then choose "Build a
free-style software project". This job type consists of the following
elements:
It seems the project is the job. Actually when you "create a new job", you will see four types of jobs, and three of them are described as "project".

Job is a deprecated term that is synonymous with Project. They both mean:
A user-configured description of work which Jenkins should perform, such as building a piece of software, etc.

Related

Group Jenkins "built jobs list" by parameter used to build each one

I have a job that takes the github repository name as a parameter to the build (we'll call this parameter "project" from here on). This is neat because the unit tests for all my companies projects are run the same way, so I can specify the project that I want to test as a parameter. This saves me having to create many very similar jobs and replace them all with one "parameterized" job that runs the unit tests which accepts the "project" as a parameter.
The problem is that the "list of builds" of this job now has a mix of all the different projects. Finding a build which only fails in one project means that I have to go through each of the build jobs until I find the one which has the parameter of the "project" that I'm interested in. In short, debugging is a bit of a pain.
Is there a way to group the list of builds by a certain parameter? This would allow me to quickly see all the builds in each project (the builds would be grouped by the "project" parameter), which would be great.

Promoted Build Plugin , can not see Promotions

When I am running the Jenkins Job with promotion setup like below ,
I cant see my promotions after the build is completed in the UI .
Please suggest if I am missing something.
Builds that had finished before the promotion was originally created are not "promotable"
Run a new build, and it will show.
Note: this restriction is only on the creation of a new promotion. You can modify the promotion process as much as you need, and it will be executable on older builds without problem (as long as those builds had finished after the original promotion was created)
Edit:
I think I misunderstood your question. It appears you are on the "Promotions History" page, the one at http://$JENKINS_SERVER/$JOB_URL/promotion/. You won't see builds here until they have been triggered for promotion.
To actually trigger a promotion on a build, you have to select the specific build number/job run. Promotions are per job-run, not per job. Each job run has associated promotions with it.
You need to be at http://$JENKINS_SERVER/$JOB_URL/123/promotion/ where 123 is the build number that you want to promote. You can use permalinks instead of 123, such as lastBuild or lastSuccessfulBuild, etc.
To reference to 123 from within the build (in order to use this in email notification links, etc), you can use $BUILD_NUMBER variable.
Through the UI, you need to select a build from the build history, click
"Promotion Status" there, and then approve/trigger a promotion (I know it's confusing since both "history page" and "trigger/execution" pages have the same name for the link.)
First you have to promote the build then you can see that particular build in promotion status.
First click on build number that you want to promote then click click on promotion status from late panel. Here you will see the user who can promote the build.
Then you have to approve it for the promotion.

Copying and Editing Jenkins Jobs

I have been using Jenkins for a couple of months now, and have been able to set up a simple CI system.
I currently have a build tab - that will build and deploy 25 different components successfully, based on building from an SVN trunk.
I'm now taking my first branch - some people will develop on the trunk and some will develop fixes on the branch.
I would now like to have CI up and running for both branch and trunk - so would create a second tab - with a repeat of the jobs from the first tab, but this time changing the SVN path to check out from the branch.
As I have rather a lot of jobs and the task is quite repetitive, is there an easy way to do this ? I'm hoping that each job tab might be a single xml that I can edit / rename to give me a second tab ?
Yes, each job is as single xml file, located under $JENKINS_HOME/jobs/$JOB_NAME/config.xml. However there are a number of places in the config.xml that reference it's location, so simply copy-pasting the actual file isn't the best option.
Jenkins UI itself has "copy job" function.
Click "New Item" where you want it
Select "Copy existing Item"
Specify the name of existing item to copy
Specify the name for the new job
Then go to configure the new job and change what you need.
Another tip: may not apply to your setup, but more often than not, there is a "unifying difference" between multiple similar jobs, most often a branch name, or project name, or similar. The value would be that only one that needs to change between otherwise identical jobs, however that changed value may appear several times within the job configuration.
I usually make a "choice" parameter, with a single choice, and put that different value there. The rest of the job references the choice param as a variable. So when I copy identical jobs, I just need to change that 1 value at the top of job configuration page. Everything else falls into place.

Same workspace for multiple jobs

I have a job called "development" and another project called "code analysis". At the moment we have two different jobs and different workspaces, but same code; is there any way we could use the same workspace for multiple jobs?I checked the plugins available in Jenkins but I haven't found any suitable one.
Suppose your "development" Jenkins job workspace is /var/workspace/job1. In the "code analysis" job configuration page, under the tab General click on Advanced... and select the option Use custom workspace and give the same workspace /var/workspace/job1 as of your "development" job.
if you were not able to find Use custom workspace you can located it under your project configure>General>Advanced>Use custom workspace
There is a Jenkins Plugins which enables you to create a shared workplace a setup them on every job which need the files from that given repository.
Use Case:
Similar to what you need, first create two jobs from the same Git Repository, then go to "Manage Jenkins" and you create a Shared Workspace. And point to it, on every job you need to read from that files.
Jenkins Plugin
https://wiki.jenkins-ci.org/display/JENKINS/Shared+workspace+plugin#
PS: You should look into "Known Issues" could be a deal breaker for your needs.
sometimes, on fresh copied job, shared-space url parameter not saving to config on first "save", you should save job twice to be sure.
^^ This one it's still unresolved, I tried and still happens. After some several saves (just to be sure) the job runs perfectly.
I tried the inheritance plugin and whoa! that thing is a sledgehammer when all I have is a tiny nail.
I ended up adding a Post-build Action of "Trigger parameterized build on other projects" with "Build on the same node" and a "Predefined parameter". The downstream job needs to have a parameter of the same name defined (WORKSPACE_PARENT) but you can leave it blank. You then define the downstream job with a custom workspace (under General > Advanced)
I chose a post-build action because the actual success of the build job is independent on the results of the downstream build (for now). If you want to bump the results of the downstream job up to the parent job, you need to add it as a build task, not a post-build action.
It works great for what I need.
Parent's post-build task:
Child's custom workspace:

Jenkins manual Trigger for successful build

I need help with Jenkins.
I want trigger over an button in the already successful builded 'build' page (where the testresults, artefacts etc. are listed) one target in an ant script.
Is that possible over an plugin or do I have there to do more?
This is the closest I can see you can get at the moment.
A combination of the Jenkins Batch Task Plugin:
This plugin adds batch tasks that are not regularly executed to
projects, such as releases, integration, archiving, etc. In this way,
anyone in the project team can execute them in a way that leaves a
record.
and Sidebar-Link Plugin:
This simple plugin adds an Additional Sidebar Links section in the
main Jenkins configuration page, with settings for link URLs, texts
and icons. These links will be shown in the top-level Jenkins pages
(main page, user list, build history, My Projects and other project
view tabs). Sidebar links for particular jobs may also be added in the
job configuration pages.
You can use the Sidebar-Link Plugin to add these to the project page, but it doesn't appear to support adding it to the build page as of yet - might be worth raising a JIRA ticket and requesting this as it was part of the original ticket.
In the Batch Task Plugin you can define a task - that might well be an Ant invocation - this example is called 'release'.
Then you can run the task from the web interface:
And records of these post-build tasks are kept and accessible:

Resources