我可以通过maven-dependency插件解压zip文件,但目前我有问题,在zip文件里面包含其他zip文件,我也需要解压缩它们.我怎样才能做到这一点?
def getPassword = { username ->
def creds = com.cloudbees.plugins.credentials.CredentialsProvider.lookupCredentials(
com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials.class,
jenkins.model.Jenkins.instance
)
def c = creds.findResult { it.username == username ? it : null }
if ( c ) {
println "found credential ${c.id} for username ${c.username}"
def credentials_store = jenkins.model.Jenkins.instance.getExtensionList(
'com.cloudbees.plugins.credentials.SystemCredentialsProvider'
)[0].getStore()
println "result: " + credentials_store
} else {
println "could not find credential for ${username}"
}
}
getPassword("XYZ")
Run Code Online (Sandbox Code Playgroud)
但现在我想获得相应用户的密码,我无法做到...
如果我尝试访问passord等,我总是会得到未知的方法等.
这样做的原因是使用此用户/密码来调用git并从存储库中提取信息.
我总是得到这样的东西:
result: com.cloudbees.plugins.credentials.SystemCredentialsProvider$StoreImpl@1639eab2
Run Code Online (Sandbox Code Playgroud)
在用它进行了更多的实验(以及Jeanne Boyarsky的暗示)后,我发现我正在考虑编译.以下内容已经为我提供了用户的密码:
def getUserPassword = { …Run Code Online (Sandbox Code Playgroud) 我用plagins更新了我的pom.xml并得到了错误:
cvc-complex-type.2.4.a: Invalid content was found starting with element 'plugin'. One of '{"http://maven.apache.org/POM/
4.0.0":parent, "http://maven.apache.org/POM/4.0.0":description, "http://maven.apache.org/POM/4.0.0":prerequisites,
"http://maven.apache.org/POM/4.0.0":issueManagement, "http://maven.apache.org/POM/4.0.0":ciManagement, "http://
maven.apache.org/POM/4.0.0":inceptionYear, "http://maven.apache.org/POM/4.0.0":mailingLists, "http://
maven.apache.org/POM/4.0.0":developers, "http://maven.apache.org/POM/4.0.0":contributors, "http://maven.apache.org/
POM/4.0.0":licenses, "http://maven.apache.org/POM/4.0.0":scm, "http://maven.apache.org/POM/4.0.0":organization,
"http://maven.apache.org/POM/4.0.0":build, "http://maven.apache.org/POM/4.0.0":profiles, "http://maven.apache.org/
POM/4.0.0":modules, "http://maven.apache.org/POM/4.0.0":repositories, "http://maven.apache.org/POM/
4.0.0":pluginRepositories, "http://maven.apache.org/POM/4.0.0":reports, "http://maven.apache.org/POM/4.0.0":reporting,
"http://maven.apache.org/POM/4.0.0":dependencyManagement, "http://maven.apache.org/POM/
4.0.0":distributionManagement}' is expected.
Run Code Online (Sandbox Code Playgroud)
这是pom.xml文件:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com</groupId>
<artifactId>test</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>test</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
<type>jar</type>
</dependency>
<dependency>
<groupId>oracle</groupId>
<artifactId>ojdbc16</artifactId>
<version>11.2.0.1.0</version>
<type>jar</type>
</dependency>
</dependencies>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-java2ws-plugin</artifactId>
<version>2.5.1</version>
<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId> …Run Code Online (Sandbox Code Playgroud) 目前我有一个管道作业,它有不同的参数,其中一个参数是Choice参数.以下是该作业参数的config.xml输出:
<hudson.model.ChoiceParameterDefinition>
<choices class="java.util.Arrays$ArrayList">
<a class="string-array">
<string>f1</string>
<string>f2</string>
<string>f3</string>
<string>f4</string>
</a>
</choices>
<name>WHERE</name>
<description>Something</description>
</hudson.model.ChoiceParameterDefinition>
Run Code Online (Sandbox Code Playgroud)
现在我可以通过传递字符串参数从管道调用此作业:
build job: "NameOfTheJob"", parameters:
[
[$class: 'StringParameterValue', name: 'BRANCH', value: "${BRANCH}"],
]
Run Code Online (Sandbox Code Playgroud)
但我无法找到一种方法来定义选择参数的参数:
我尝试过以下方法:
build job: "NameOfTheJob"", parameters:
[
[$class: 'StringParameterValue', name: 'BRANCH', value: "${BRANCH}"],
[$class: 'ChoiceParameterValue', name: 'WHERE', value: 'F3'],
]
Run Code Online (Sandbox Code Playgroud)
但是由于以下错误而失败:
java.lang.UnsupportedOperationException: no known implementation of class hudson.model.ParameterValue is named ChoiceParameterValue
Run Code Online (Sandbox Code Playgroud)
所以问题是:如何在调用其他管道作业时定义选择参数:
build job: "NameOfTheJob"", parameters:
[
[$class: 'StringParameterValue', name: 'BRANCH', value: "${BRANCH}"],
[$class: '??????', ????],
]
Run Code Online (Sandbox Code Playgroud)
有人有这样的例子吗?
目前我正在寻找一种工作方法来在Hudson的以下配置中上传文件+字段.目前的问题是Hudson总是抱怨应该提交的表格..(见本文稍后的例外).但基于我阅读的文档,它应该像下面的Java代码片段一样工作...
HttpPost httppost = new HttpPost(triggerJobUrl);
FileBody fileBody = new FileBody(releaseProperties);
StringBody stringBody = new StringBody(svnURL.toString());
MultipartEntity mentity = new MultipartEntity();
mentity.addPart("trunk/release.properties", fileBody);
mentity.addPart("SVNURL", stringBody);
httppost.setEntity(mentity);
HttpResponse response = null;
try {
response = httpClient.execute(httppost);
} catch (ClientProtocolException e) {
throw new HudsonException("http protocol error.", e);
} catch (IOException e) {
throw new HudsonException("connection aborted.", e);
}
if (response.getStatusLine().getStatusCode() != 200) {
throw new HudsonException("Unexpected status code received " + response.getStatusLine().getStatusCode());
}
HttpEntity resEntity = response.getEntity();
if (resEntity …Run Code Online (Sandbox Code Playgroud) 我想获得我的詹金斯的结果建立工作要么失败(红色),不稳定(黄色)或全成(绿色)...
如果我从我的shell脚本返回非零,我只会失败.有没有产生不稳定的返回码?
我有一个数据库表,其中包含一个简单的自我父/子关系(类别),如下所示:
+------------+----------+--------------------+
| categoryid | parentid | category_name |
+------------+----------+--------------------+
| 1 | 0 | Java |
| 2 | 0 | SKM |
| 3 | 0 | Neuigkeiten |
| 4 | 0 | Neue Versionen |
| 5 | 0 | PlugIn |
..
| 9 | 2 | Subversion |
| 10 | 2 | DVCS |
| 11 | 2 | SVK |
| 12 | 2 | Bazaar |
| 13 | 2 | …Run Code Online (Sandbox Code Playgroud) 我有两份工作。第一个是使用一些参数手动触发的(例如需要的数字)。我有第二份工作,它使用参数来选择上一份工作的特定构建(运行参数)。
现在,我需要从第一份工作中获取参数(在本例中为数字),第二份工作也需要这些参数。我想防止让用户第二次给出 number 参数。
与此同时,我找到了一种通过以下方式从第一个作业中提取参数的方法:
@NonCPS
def getParameters(def item) {
def result = ""
def p = item?.actions.find{ it -> it instanceof ParametersAction }?.parameters
p.each { it ->
echo "parameter ${it.name}: ${it.value}"
if (it.name.equals("NUMBER")) {
result = it.value.toString()
}
}
return result
}
...
node (..) {
def item = hudson.model.Hudson.instance.getItem("${SELECTED_JOBNAME}")
def number = Integer.parseInt("${SELECTED_NUMBER}")
def x = item.getBuildByNumber(number)
def newNumber = getParameters(x)
Run Code Online (Sandbox Code Playgroud)
出现的问题是得到以下内容:
parameter NUMBER: 16
[Pipeline] echo
org.jenkinsci.plugins.workflow.job.WorkflowJob@1776388d[XX-YY]
[Pipeline] echo
XX-YY #48
[Pipeline] echo
newNumber: 16
[Pipeline] stage …Run Code Online (Sandbox Code Playgroud) 我们有一个更大的 Spring boot 应用程序,它会导致以下异常:
java.lang.ClassCastException: class jpa.XVersion cannot be cast to class jpa.XVersion (jpa.XVersion is in unnamed module of loader 'app'; jpa.XVersion is in unnamed module of loader org.springframework.boot.devtools.restart.classloader.RestartClassLoader @671ef14f)
at y.package.abc(XService.java:70)
at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:75)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
Run Code Online (Sandbox Code Playgroud)
同时从 IDEA IntelliJ 内部与 JPA 类的关系开始。
从普通命令行启动时,该应用程序运行良好。
当我们删除依赖之后
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
Run Code Online (Sandbox Code Playgroud)
IDE 中的执行工作正常,没有任何问题。
我们正在使用:
有人已经观察到这类问题了吗?是否存在不同的解决方案然后删除依赖项?
我正在尝试从远程计算机访问当前不包含任何git安装的服务器计算机.问题是:服务器机器是否需要任何类型的git安装(我认为它需要)只能通过带有git的ssh从客户端工作?