@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class)
public class HttpRetriever
extends org.jenkinsci.plugins.workflow.libs.LibraryRetriever
The current official plugin (workflow-cps-global-lib) does provide only a way to retrieve shared libraries through a SCM, such as Git, Subversion, etc.
| Modifier and Type | Class and Description |
|---|---|
static class |
HttpRetriever.DescriptorImpl |
| Constructor and Description |
|---|
HttpRetriever(String httpURL,
String credentialsId,
boolean preemptiveAuth)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
String |
getCredentialsId()
Accessor for credentials ID that can be used to do an authenticated download
|
org.jenkinsci.plugins.workflow.libs.LibraryRetrieverDescriptor |
getDescriptor() |
String |
getHttpURL()
Accessor for URL template where the library can be downloaded
|
boolean |
isPreemptiveAuth()
Accessor for know if the plugin should send the basic authentication response
before the server gives an unauthorized response
|
void |
retrieve(String name,
String version,
boolean changelog,
hudson.FilePath target,
hudson.model.Run<?,?> run,
hudson.model.TaskListener listener)
Checks first if the library is accessible via a HEAD call.
|
void |
retrieve(String name,
String version,
hudson.FilePath target,
hudson.model.Run<?,?> run,
hudson.model.TaskListener listener)
Retrieves the shared library code.
|
hudson.util.FormValidation |
validateVersion(String name,
String version)
Validates version.
|
@DataBoundConstructor public HttpRetriever(@Nonnull String httpURL, @Nonnull String credentialsId, boolean preemptiveAuth)
httpURL - URL template where the library can be downloadedcredentialsId - The credentials ID that can be used to do an authenticated downloadpreemptiveAuth - Send the basic authentication response before the server gives an unauthorized responsepublic boolean isPreemptiveAuth()
public String getHttpURL()
public String getCredentialsId()
public void retrieve(@Nonnull String name, @Nonnull String version, @Nonnull hudson.FilePath target, @Nonnull hudson.model.Run<?,?> run, @Nonnull hudson.model.TaskListener listener) throws Exception
Checks first if the library is accessible via a HEAD call. Then retrieves the shared library through HTTP protocol.
retrieve in class org.jenkinsci.plugins.workflow.libs.LibraryRetrievername - Name of the library (as specified in the Jenkinsfile @Library)version - Version of the library (as specified in the Jenkinsfile @Library)target - Where the code should be retrievedrun - Jenkins contextlistener - Only used to get the loggerException - if the file cannot be downloaded, archive can't be extracted, workspace is not writablepublic void retrieve(@Nonnull String name, @Nonnull String version, @Nonnull boolean changelog, @Nonnull hudson.FilePath target, @Nonnull hudson.model.Run<?,?> run, @Nonnull hudson.model.TaskListener listener) throws Exception
retrieve in class org.jenkinsci.plugins.workflow.libs.LibraryRetrievername - Name of the library (as specified in the Jenkinsfile @Library)version - Version of the library (as specified in the Jenkinsfile @Library)changelog - Not usedtarget - Where the code should be retrievedrun - Jenkins contextlistener - Only used to get the loggerException - if the file cannot be downloaded, archive can't be extracted, workspace is not writablepublic hudson.util.FormValidation validateVersion(@Nonnull String name, @Nonnull String version)
Replaces the pattern ${library.NAME.version} in the URL (if found in the shared library URL) either by the default version specified in the admin configuration page or by the user in the Jenkinsfile @Library call.
validateVersion in class org.jenkinsci.plugins.workflow.libs.LibraryRetrievername - Name of the libraryversion - Version of the librarypublic org.jenkinsci.plugins.workflow.libs.LibraryRetrieverDescriptor getDescriptor()
getDescriptor in interface hudson.model.Describable<org.jenkinsci.plugins.workflow.libs.LibraryRetriever>getDescriptor in class org.jenkinsci.plugins.workflow.libs.LibraryRetrieverCopyright © 2016–2019. All rights reserved.