Package hudson.plugins.collabnet.tracker
Class CNTracker
- java.lang.Object
-
- hudson.tasks.BuildStepCompatibilityLayer
-
- hudson.tasks.Publisher
-
- hudson.tasks.Notifier
-
- hudson.plugins.collabnet.AbstractTeamForgeNotifier
-
- hudson.plugins.collabnet.tracker.CNTracker
-
- All Implemented Interfaces:
ExtensionPoint
,Describable<Publisher>
,BuildStep
public class CNTracker extends AbstractTeamForgeNotifier
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CNTracker.DescriptorImpl
-
Nested classes/interfaces inherited from class hudson.tasks.Publisher
Publisher.DescriptorExtensionListImpl
-
Nested classes/interfaces inherited from interface hudson.tasks.BuildStep
BuildStep.PublisherList
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Field Summary
-
Fields inherited from interface hudson.tasks.BuildStep
BUILDERS, PUBLISHERS
-
-
Constructor Summary
Constructors Constructor Description CNTracker(ConnectionFactory connectionFactory, String project, String tracker, String title, String assignUser, Priority priority, boolean attachLog, boolean alwaysUpdate, boolean closeOnSuccess, String release)
Constructs a new CNTracker instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
closeSucceedingBuild(CTFArtifact issue, AbstractBuild<?,?> build)
Update the issue with a build that's successful, and close it.CTFArtifact
createNewTrackerArtifact(CTFTracker t, String status, String description, AbstractBuild<?,?> build)
Create a new tracker artifact with the given values.CTFArtifact
findTrackerArtifact(CTFTracker tracker, AbstractBuild<?,?> build)
Return a tracker artifact with the matching title.boolean
getAlwaysUpdate()
String
getAssignUser()
boolean
getAttachLog()
boolean
getCloseOnSuccess()
Priority
getPriority()
String
getRelease()
BuildStepMonitor
getRequiredMonitorService()
String
getTitle()
String
getTracker()
void
logoff()
Log out of the collabnet server.boolean
perform(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener)
Create/Update/Close the tracker issue, according to the Jenkins build status.void
updateFailingBuild(CTFArtifact issue, AbstractBuild<?,?> build)
Update the issue with failing build status.void
updateSucceedingBuild(CTFArtifact issue, AbstractBuild<?,?> build)
Update the issue with a build that's successful, but do not change its status.-
Methods inherited from class hudson.plugins.collabnet.AbstractTeamForgeNotifier
connect, getCollabNetUrl, getConnectionFactory, getPassword, getProject, getTeamForgeShareDescriptor, getUsername, overrideAuth
-
Methods inherited from class hudson.tasks.Notifier
getDescriptor
-
Methods inherited from class hudson.tasks.Publisher
all, getProjectAction, needsToRunAfterFinalized, prebuild
-
Methods inherited from class hudson.tasks.BuildStepCompatibilityLayer
getProjectAction, getProjectActions, perform, prebuild
-
-
-
-
Constructor Detail
-
CNTracker
@DataBoundConstructor public CNTracker(ConnectionFactory connectionFactory, String project, String tracker, String title, String assignUser, Priority priority, boolean attachLog, boolean alwaysUpdate, boolean closeOnSuccess, String release)
Constructs a new CNTracker instance.- Parameters:
tracker
- tracker name.title
- title to use when create new tracker artifacts OR to find existing tracker artifacts.assignUser
- user to assign new tracker artifacts to.priority
- of new tracker artifacts.attachLog
- if true, Jenkins build logs will be uploaded and attached when creating/updating tracker artifacts.alwaysUpdate
- if true, always update the tracker artifacts (or create one), even if build is successful and the tracker artifact is closed. If false, only update when the tracker artifact is failing or is open.closeOnSuccess
- if true, the tracker artifact will be closed if the Jenkins build is successful. Otherwise, open issues will be updated with a successful message, but remain open.release
- to report the tracker artifact in.
-
-
Method Detail
-
getTracker
public String getTracker()
- Returns:
- tracker name.
-
getTitle
public String getTitle()
- Returns:
- title for the Tracker Artifact.
-
getAssignUser
public String getAssignUser()
- Returns:
- the user to assign new Tracker Artifacts to.
-
getPriority
public Priority getPriority()
- Returns:
- the priority to set new Tracker Artifacts to.
-
getAttachLog
public boolean getAttachLog()
- Returns:
- true, if logs should be attached to Tracker Artifacts.
-
getAlwaysUpdate
public boolean getAlwaysUpdate()
- Returns:
- true, if artifact creation/update should happen, even if the Jenkins build is successful and the artifact is not open.
-
getCloseOnSuccess
public boolean getCloseOnSuccess()
- Returns:
- true, if artifacts should be closed when the Jenkins build succeeds.
-
getRelease
public String getRelease()
- Returns:
- the name of the release which new Tracker Artifacts will be reported in.
-
getRequiredMonitorService
public BuildStepMonitor getRequiredMonitorService()
-
perform
public boolean perform(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException
Create/Update/Close the tracker issue, according to the Jenkins build status.- Specified by:
perform
in interfaceBuildStep
- Overrides:
perform
in classBuildStepCompatibilityLayer
- Parameters:
build
- the current Jenkins build.launcher
- unused.listener
- receives events that occur during a build; used for logging.- Returns:
- false if a critical error occurred, true otherwise.
- Throws:
InterruptedException
IOException
-
logoff
public void logoff()
Log out of the collabnet server.
-
findTrackerArtifact
public CTFArtifact findTrackerArtifact(CTFTracker tracker, AbstractBuild<?,?> build) throws IOException, InterruptedException
Return a tracker artifact with the matching title.- Parameters:
build
- the current Jenkins build.- Returns:
- the artifact soap data object, if one exists which matches the title. Otherwise, null.
- Throws:
IOException
InterruptedException
-
createNewTrackerArtifact
public CTFArtifact createNewTrackerArtifact(CTFTracker t, String status, String description, AbstractBuild<?,?> build) throws IOException, InterruptedException
Create a new tracker artifact with the given values.- Parameters:
status
- status to set on the new artifact (Open, Closed, etc.).description
- description of the new artifact.- Returns:
- the newly created ArtifactSoapDO.
- Throws:
IOException
InterruptedException
-
updateFailingBuild
public void updateFailingBuild(CTFArtifact issue, AbstractBuild<?,?> build) throws IOException, InterruptedException
Update the issue with failing build status.- Parameters:
issue
- the existing issue.build
- the current Jenkins build.- Throws:
IOException
InterruptedException
-
updateSucceedingBuild
public void updateSucceedingBuild(CTFArtifact issue, AbstractBuild<?,?> build) throws IOException, InterruptedException
Update the issue with a build that's successful, but do not change its status.- Parameters:
issue
- the existing issue.build
- the current Jenkins build.- Throws:
IOException
InterruptedException
-
closeSucceedingBuild
public void closeSucceedingBuild(CTFArtifact issue, AbstractBuild<?,?> build) throws IOException, InterruptedException
Update the issue with a build that's successful, and close it.- Parameters:
issue
- the existing issue.build
- the current Jenkins build.- Throws:
IOException
InterruptedException
-
-