Display 2 Jenkins jobs build number in a single drop down - jenkins

I have 3 Jenkins plan .
Plan A , B, C
I need to display the build numbers of Plan A and B in Plan C's Drop down.
I have displayed Plan A's build number in Plan C's Drop down. with the below code:
def jobname="A"
def list=[]
hudson.model.AbstractProject<?, ?> otherJob = jenkins.model.Jenkins.getInstance().getItemByFullName(jobname, hudson.model.AbstractProject.class)
hudson.util.RunList<?> builds = otherJob.getBuilds().overThresholdOnly(hudson.model.Result.SUCCESS)
builds.each{run -> list.add(run.displayName) }
list
How to display 2 jobs( Plan A and B) build number in a single(Plan C) drop down

Related

Jenkins plugin for sequential check

I have a below scenario
Parent Job triggers Job B and Job B triggers Job C and Job C triggers D in sequence irrespective of whether the child jobs (B,C,D) are failure or success.
What I want to achive is only after the Job B,Job C,Job D is success and JOB E should be triggered .If by chance any of the child jobs (B,C,D) failes then the final Job E should not be triggered.
How shall I go about this ?Any plugin is there?
Select Trigger only if build is stable.
You may also be interested in using the Workflow plugin (as in your jenkins-workflow tag, perhaps accidental) to orchestrate the whole system programmatically:
build 'B'
build 'C'
build 'D'
build 'E'

Jenkins build trigger ways

I have added job A,B and C in jenkins. Job B dependent on Job A , Job C is dedepdent on Job A and Job B.
If I trigger build on Job A, Job B and Job C will start building also as they are dependent on A.
But Job C will get build 2 times, because dependency A -> B -> C and A -> C.
So how can I restrict Job C to build only once ?
You can block a build of job C when upstream project is building. Hit the checkbox under Advanced Project Options:
Having this, build of job C won't start before finishing a build of job B. As it's not possible to have two or more builds of the same job in the build queue, job C will be triggered once.
Note: this is a tricky way. Please be sure that you can't use only A -> B -> C relationship.
Use post build action - > Trigger parametrized build on other project
Install this plugin to get this option.

How can I get three lines of data to show on a single line?

as you can see from the image I am returning the top example of data, what i would like to do is stretch it across a single line. So instead of showing each Job on a separate line I would like to show all three jobs across the same line(see the example in the pic) so starting with staff number, location, name and then Job1 number, Job1 name, Job1 hours - followed by Job2 number, Job2 name, Job2 hours - followed by Job3 number, Job3 name, Job 3 hours.
the top example in the pic is what i am getting and the bottom example is what i would like to do.
Is this possible? your help will be very much appreciated, Thank you in advance.
the code i am using is:
select
viewCarerContractFull.CarerCode
, viewTeam.description as Location
, viewCarerContractFull.surname
, isnull (tblCarerContract.PayrollNumber, 0) as JobNumber
, viewCarerContractFull.ContractName as JobName
, ISNULL(DateDiff (hour,'1899-12-30 00:00:00.000',tblCarerContract.Contracthours),0) ContractHours
from viewCarerContractFull
join tblCarerContract on tblCarerContract.CarerContractCode = viewCarerContractFull.CarerContractCode
join viewTeam as viewTeam on viewTeam.TeamCode = tblCarerContract.TeamCode
where
viewCarerContractFull.LeaveDate IS NULL
Group by
viewCarerContractFull.CarerCode
, viewTeam.description
, viewCarerContractFull.surname
, tblCarerContract.PayrollNumber
, viewCarerContractFull.ContractName
, tblCarerContract.Contracthours

Hudson + Running parallel jobs

I would like to configure a project in Hudson as shown below.
The starting Job is Job-A. When this job is finished it has to trigger three other jobs, B, C and D together. These three jobs may take different times to complete. Once the jobs B, C and D are finished it has to trigger another job E.
I have seen options like, Pipe line plugin, parameterized plugin etc.These are working fine for the first stage. ie, it will trigger build B, C and D together when job A is completed. But I am stuck at configuring the JOB E in such a way that, it has to start only when all the jobs, B, C & D are finished.
Please assist. Thanks in advance.
Use the Join Plugin, that will allow you to start B, C, and D after A is finished, then trigger E when they are successfully done.
Use simple DSL Scripts
Example:
parallel
(
{build("job1")}
{build("job2")}
{build("job3")}
)
build("job4")
here 3 jobs running in parallel phase.
4th job get excuted only after the completion of parallel jobs.

rallydev - query for custom grid - how to show tasks where work product is tagged

I am trying to create a query for a custom grid. I want to show all tasks where the work product (user story the tasks belong to) is tagged with a specific tag.
For example:
US101 - Build a house (tags = architecture, external)
Task1 - _______
Task2 - ________
US102 - Build a school (tags = architecture)
Task3 - ________
How do I create a query that will show task1, task2, and task3 based on the fact that their work products have the tag = architecture ? (I know I can go through and manually tag every task under it and then do a query on task tags, but this is a huge pain, especially if tasks are added)
Create a custom grid of tasks and use this as the query:
(WorkProduct.Tags.Name contains "architecture")

Resources