本文整理匯總了Java中hudson.tasks.Builder類的典型用法代碼示例。如果您正苦於以下問題:Java Builder類的具體用法?Java Builder怎麽用?Java Builder使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Builder類屬於hudson.tasks包,在下文中一共展示了Builder類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createRunSelector
import hudson.tasks.Builder; //導入依賴的package包/類
public static Builder createRunSelector(String projectName, String parameters, RunSelector selector, String filter, String excludes, String target,
boolean flatten, boolean optional, boolean fingerprintArtifacts, String resultVariableSuffix) {
// RunSelector copyArtifact = new RunSelector(projectName);
// copyArtifact.setSelector(selectors);
// copyArtifact.setOptional(optional);
// copyArtifact.setResultVariableSuffix(resultVariableSuffix);
// copyArtifact.setVerbose(true);
//
// copyArtifact.setParameters(parameters);
//
// copyArtifact.setOperation(null);
// copyArtifact.setFilter(filters);
// copyArtifact.setExcludes(excludes);
// copyArtifact.setTarget(target);
// copyArtifact.setFlatten(flatten);
// copyArtifact.setFingerprintArtifacts(fingerprintArtifacts);
// return copyArtifact;
return null;
}
示例2: isGradlew
import hudson.tasks.Builder; //導入依賴的package包/類
private boolean isGradlew (List<Builder> builders) {
boolean status = false;
if (builders != null && builders.size() > 0 ) {
for (Builder builder : builders) {
if (builder.getClass().getName().endsWith("Gradle")) {
try {
Object isUseWrapper = builder.getClass().getMethod("isUseWrapper", null).invoke(builder);
if (isUseWrapper instanceof Boolean) {
status = ! ((Boolean) isUseWrapper).booleanValue();
LOG.log(Level.FINE, "isGradlew " + !status);
}
} catch (Exception e) {
LOG.log(Level.WARNING, "Exception " + e.getMessage(), e.getCause());
status = false;
}
}
}
}
return status;
}
示例3: getDockerImagesUsedByJob
import hudson.tasks.Builder; //導入依賴的package包/類
@Nonnull
@Override
public Collection<String> getDockerImagesUsedByJob(@Nonnull Job<?,?> job) {
if (job instanceof Project) {
Project<? extends Project, ? extends Build> project = (Project<?,? extends Build>)job;
Set<String> images = new HashSet<String>();
// check DockerHub build step for matching image ID
for (Builder b : project.getBuilders()) {
if (b instanceof DockerPullImageBuilder) {
images.add(((DockerPullImageBuilder)b).getImage());
}
}
return images;
} else {
return Collections.emptySet();
}
}
示例4: createDockerClient
import hudson.tasks.Builder; //導入依賴的package包/類
private static DockerClient createDockerClient(String dockerUrl, String dockerVersion, String dockerCertPath,
AuthConfig authConfig) {
// TODO JENKINS-26512
SSLConfig dummySSLConf = (new SSLConfig() {
public SSLContext getSSLContext() throws KeyManagementException, UnrecoverableKeyException,
NoSuchAlgorithmException, KeyStoreException {
return null;
}
});
if (dockerCertPath != null) {
dummySSLConf = new LocalDirectorySSLConfig(dockerCertPath);
}
DefaultDockerClientConfig.Builder configBuilder = new DefaultDockerClientConfig.Builder().withDockerHost(dockerUrl)
.withApiVersion(dockerVersion).withCustomSslConfig(dummySSLConf);
if (authConfig != null) {
configBuilder.withRegistryUsername(authConfig.getUsername())
.withRegistryEmail(authConfig.getEmail())
.withRegistryPassword(authConfig.getPassword())
.withRegistryUrl(authConfig.getRegistryAddress());
}
// using jaxrs/jersey implementation here (netty impl is also available)
DockerCmdExecFactory dockerCmdExecFactory = new DockerCmdExecFactoryImpl()
.withConnectTimeout(1000)
.withMaxTotalConnections(1)
.withMaxPerRouteConnections(1);
return DockerClientBuilder.getInstance(configBuilder).withDockerCmdExecFactory(dockerCmdExecFactory).build();
}
示例5: TclDriver
import hudson.tasks.Builder; //導入依賴的package包/類
/**
* Construct and initialize Tcl environment.
* <p>
* Function overwrites Thread.ClassLoader by Class.ClassLoader due to jenkins dependency loader specific
* ( more info - http://jenkins.361315.n4.nabble.com/ClassLoader-in-plugins-td1470791.html )
* </p>
*
* @param build Related build
* @param launcher Build launcher
* @param listener Build listener
* @throws TclException Error occurred in jtcl or its wrapper
*/
public TclDriver(AbstractBuild build, Launcher launcher, BuildListener listener, Builder buildInstance)
throws TclException {
this.build = build;
this.buildLauncher = launcher;
this.listener = listener;
this.builderInstance = buildInstance;
// Start init
super.Initialize(build.getWorkspace(), getClass().getClassLoader());
super.setIOChannel(new jTclChannel("jTCL_STDERR", jTclChannelType.STDERR, new StdErr()));
super.setIOChannel(new jTclChannel("jTCL_STDOUT", jTclChannelType.STDOUT, new StdOut()));
// Add resolver
commandResolver = new jTclCommandResolver(super.getInterpreter(), JENKINS_NAMESPACE);
super.getInterpreter().addInterpResolver("JenkinsResolver", commandResolver);
super.getInterpreter().addInterpResolver("Env resolver", new jTclEnvResolver(this, build, listener));
// Add jenkins namespace and resolver
Namespace nm = Namespace.createNamespace(super.getInterpreter(), JENKINS_NAMESPACE, null);
Namespace.setNamespaceResolver(nm, commandResolver);
//TODO: add built-in command handlers
}
示例6: getBuildersList
import hudson.tasks.Builder; //導入依賴的package包/類
public DescribableList<Builder, Descriptor<Builder>> getBuildersList(
IMode mode) {
InheritanceGovernor<DescribableList<Builder, Descriptor<Builder>>> gov =
new InheritanceGovernor<DescribableList<Builder, Descriptor<Builder>>>(
"buildersList", SELECTOR.BUILDER, this) {
@Override
protected DescribableList<Builder, Descriptor<Builder>> castToDestinationType(Object o) {
return castToDescribableList(o);
}
@Override
public DescribableList<Builder, Descriptor<Builder>> getRawField(
InheritanceProject ip) {
return ip.getRawBuildersList();
}
@Override
protected DescribableList<Builder, Descriptor<Builder>> reduceFromFullInheritance(
Deque<DescribableList<Builder, Descriptor<Builder>>> list) {
return InheritanceGovernor.reduceDescribableByMerge(list);
}
};
return gov.retrieveFullyDerivedField(this, mode);
}
示例7: doDownload
import hudson.tasks.Builder; //導入依賴的package包/類
/**
* Creates an {@link HttpResponse} that will send a TGZ containing build
* scripts.
*
* @return null, if the file could not be generated, otherwise a valid {@link HttpResponse}.
*/
public ReadOnlyConfigurationArchive doDownload() {
Map<String, Long> versions =
(build != null) ? build.getProjectVersions() : null;
if (versions != null) {
VersionHandler.initVersions(versions);
}
try {
List<Builder> builders =
this.getProject().getBuildersList(IMode.INHERIT_FORCED).toList();
try {
File archive = this.generateExecutableCompoundScript(
builders,
this.getProject().getFullName(),
this.getBuild().getBuildVariables()
);
return new ReadOnlyConfigurationArchive(archive);
} catch (IOException ex) {
//TODO: Log this error
return null;
}
} finally {
VersionHandler.clearVersions();
}
}
示例8: getPluginOptions
import hudson.tasks.Builder; //導入依賴的package包/類
/**
* Get the configured instance for the plugin.
*
* @param project
* @return
*/
public static NeoLoadPluginOptions getPluginOptions(final AbstractProject<?, ?> project) {
final Project<?, ?> proj;
NeoBuildAction nba = null;
if (!(project instanceof Project)) {
return null;
}
proj = (Project<?, ?>) project;
final List<Builder> builders = proj.getBuilders();
for (final Builder b : builders) {
if (b instanceof NeoBuildAction) {
nba = (NeoBuildAction) b;
break;
}
}
return (NeoLoadPluginOptions) nba;
}
示例9: newInstance
import hudson.tasks.Builder; //導入依賴的package包/類
@Override
public Builder newInstance(final StaplerRequest req, final JSONObject data) throws FormException {
final ScriptSource source = getScriptSource(req, data);
final String scalaName = data.getString("scalaName");
final String params = data.getString("parameters");
final String classpath = data.getString("classPath").trim();
final String scriptParameters = data.getString("scriptParameters");
final boolean debug = data.has("debug");
final boolean suspend;
final String port;
if(debug) {
final JSONObject joDebug = data.getJSONObject("debug");
suspend = joDebug.getBoolean("suspend");
port = joDebug.getString("port");
} else {
suspend = false;
port = DEFAULT_PORT;
}
return new ForkedScalaBuilder(scalaName, source, params, classpath, scriptParameters, debug, suspend, port);
}
示例10: getApplicableDescriptors
import hudson.tasks.Builder; //導入依賴的package包/類
public Collection<? extends Descriptor<?>> getApplicableDescriptors() {
// Jenkins.instance.getDescriptorList(SimpleBuildStep) is empty, presumably because that itself is not a Describable.
List<Descriptor<?>> r = new ArrayList<>();
populate(r, Builder.class);
populate(r, Publisher.class);
return r;
}
示例11: echoBuilder
import hudson.tasks.Builder; //導入依賴的package包/類
private Builder echoBuilder(final String fileName, final String content) {
return new TestBuilder() {
@Override
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
build.getWorkspace().child(fileName).write(content, "UTF-8");
return true;
}
};
}
示例12: isBuilderHarcoded
import hudson.tasks.Builder; //導入依賴的package包/類
private boolean isBuilderHarcoded (List<Builder> builders) {
boolean found = false;
if (builders != null && builders.size() > 0 ) {
for (Builder builder : builders) {
if (builder instanceof hudson.tasks.Shell || builder instanceof hudson.tasks.BatchFile) {
if (isHarcoded (((CommandInterpreter)builder).getCommand(), THRESHOLD)) {
found = true;
}
}
}
} else {
found = false;
}
return found;
}
示例13: newInstance
import hudson.tasks.Builder; //導入依賴的package包/類
@Override
public Builder newInstance(StaplerRequest req, JSONObject formData)
throws FormException {
// Since the config form lists the optional parameter pathPrefix as
// inline, it will be passed through even if stripPathPrefix is false.
// This might cause problems if the user, for example, fills in the field
// and then unchecks the checkbox. So, explicitly remove pathPrefix
// whenever stripPathPrefix is false.
if (Boolean.FALSE.equals(formData.remove("stripPathPrefix"))) {
formData.remove("pathPrefix");
}
return super.newInstance(req, formData);
}
示例14: newInstance
import hudson.tasks.Builder; //導入依賴的package包/類
@Override
public Builder newInstance(StaplerRequest req, JSONObject formData)
throws FormException {
if (Boolean.FALSE.equals(formData.remove("stripPathPrefix"))) {
formData.remove("pathPrefix");
}
return super.newInstance(req, formData);
}
示例15: getSVGDetail
import hudson.tasks.Builder; //導入依賴的package包/類
public String getSVGDetail() {
List<ParameterDefinition> pLst = this.getParameters(IMode.LOCAL_ONLY);
if (pLst == null) {
return "";
}
StringBuilder b = new StringBuilder();
for (ParameterDefinition pd : pLst) {
if (pd == null) { continue; }
b.append(pd.getName());
ParameterValue pv = pd.getDefaultParameterValue();
if (pv != null && pv instanceof StringParameterValue) {
b.append(": ");
b.append(((StringParameterValue)pv).value);
}
b.append('\n');
}
if (b.length() > 0) {
b.append("\r\n");
}
List<Builder> builders = this.getBuilders();
String str = (builders == null || builders.size() != 1) ? "steps" : "step";
int num = (builders == null) ? 0 : builders.size();
b.append(String.format(
"%d build %s\n", num, str
));
DescribableList<Publisher, Descriptor<Publisher>> pubs = this.getPublishersList();
str = (pubs == null || pubs.size() != 1) ? "publishers" : "publisher";
num = (pubs == null) ? 0 : pubs.size();
b.append(String.format(
"%d %s", num, str
));
return b.toString();
}