Class BuildWithEiffelLinksAction<JobT extends Job<JobT,RunT> & ParameterizedJobMixIn.ParameterizedJob<JobT,RunT>,RunT extends Run<JobT,RunT> & Queue.Executable>
- java.lang.Object
-
- com.axis.jenkins.plugins.eiffel.eiffelbroadcaster.BuildWithEiffelLinksAction<JobT,RunT>
-
- All Implemented Interfaces:
Action
,ModelObject
public class BuildWithEiffelLinksAction<JobT extends Job<JobT,RunT> & ParameterizedJobMixIn.ParameterizedJob<JobT,RunT>,RunT extends Run<JobT,RunT> & Queue.Executable> extends Object implements Action
AnAction
that attaches an additional API endpoint to jobs for starting a build with one or more Eiffel links. The endpoint is $JOB_URL/eiffel/build and should behave as the regular $JOB_URL/build endpoint, i.e. you can supply parameters by posting a form with a JSON string. Additionally, it requires a (possibly empty) list of Eiffel links. Example (payload lacking URL encoding to improve readability):POST $JOB_URL/eiffel/build Content-Type: application/x-www-form-urlencoded json={"eiffellinks": [{"target": "662b3813-bef4-4588-bf75-ffaead24a6d5", "type": "CAUSE"}], "parameter": [{"name": "PARAM_NAME", "value": "param value"}]}
The Eiffel links, if any, will be passed to the build as anEiffelCause
cause. That cause will be used when piecing together theEiffelActivityTriggeredEvent
which gets captured in theRun
'sEiffelActivityAction
.
-
-
Field Summary
Fields Modifier and Type Field Description static String
FORM_PARAM_EIFFELLINKS
The form parameter that holds the Eiffel links.static String
FORM_PARAM_PARAMETERS
The form parameter that holds the build parameters.static String
URL_SUFFIX
The immediate suffix to the URL of theJob
, i.e.
-
Constructor Summary
Constructors Constructor Description BuildWithEiffelLinksAction(JobT job)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
doBuild(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, TimeDuration delay)
Responds to a /build request by parsing the posted form and transforming the Eiffel links and (optionally) build parameters into actions that'll get passed to the new build.Cause
getCallerCause(org.kohsuke.stapler.StaplerRequest req)
Returns aCause
that indicates the caller that requested the build (either aCause.RemoteCause
or aCause.UserIdCause
).String
getDisplayName()
String
getIconFileName()
String
getUrlName()
-
-
-
Field Detail
-
FORM_PARAM_EIFFELLINKS
public static final String FORM_PARAM_EIFFELLINKS
The form parameter that holds the Eiffel links.- See Also:
- Constant Field Values
-
FORM_PARAM_PARAMETERS
public static final String FORM_PARAM_PARAMETERS
The form parameter that holds the build parameters.- See Also:
- Constant Field Values
-
URL_SUFFIX
public static final String URL_SUFFIX
The immediate suffix to the URL of theJob
, i.e. the URLs served by this action will have the form $JOB_URL/$URL_SUFFIX.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BuildWithEiffelLinksAction
public BuildWithEiffelLinksAction(JobT job)
-
-
Method Detail
-
doBuild
public void doBuild(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, @QueryParameter TimeDuration delay) throws IOException
Responds to a /build request by parsing the posted form and transforming the Eiffel links and (optionally) build parameters into actions that'll get passed to the new build.- Throws:
IOException
-
getCallerCause
public Cause getCallerCause(org.kohsuke.stapler.StaplerRequest req)
Returns aCause
that indicates the caller that requested the build (either aCause.RemoteCause
or aCause.UserIdCause
).The implementation was copied from
ParameterizedJobMixIn.getBuildCause(ParameterizedJobMixIn.ParameterizedJob, StaplerRequest)
and only slightly modified.
-
getIconFileName
@CheckForNull public String getIconFileName()
- Specified by:
getIconFileName
in interfaceAction
-
getDisplayName
@CheckForNull public String getDisplayName()
- Specified by:
getDisplayName
in interfaceAction
- Specified by:
getDisplayName
in interfaceModelObject
-
getUrlName
@CheckForNull public String getUrlName()
- Specified by:
getUrlName
in interfaceAction
-
-