我想将管道常用的函数收集在一个单独的文件中。我创建了目录结构:
vars/
...commonFunctions.groovy
pipeline.jenkinsfile
anotherPipeline.jenkinsfile
Run Code Online (Sandbox Code Playgroud)
commonFunctions.groovy:
def buildDocker(def par, def par2) {
println("build docker...")
}
return this;
Run Code Online (Sandbox Code Playgroud)
在 pipeline.jenkinsfile 中我想调用 buildDocker 函数。我怎样才能做到这一点?我简单地commonFunctions.buildDocker(par1, par2)在管道中尝试过,但收到 MethodNotFound 错误。
更新:
pipeline.jenkins文件的相关部分:
stage('Checkout') {
steps {
checkout([$class : 'GitSCM',
branches : [[name: gitCommit]],
userRemoteConfigs: [[credentialsId: gitCredId, url: gitUrl]]
])
}
}
stage("Build Docker") {
steps {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
script {
// here want to call function from another file
commonFunctions.buildDocker(par1, par2)
}
}
}
}
Run Code Online (Sandbox Code Playgroud) 我有数据库连接设置和 pgAdmin (这是我所拥有的全部)。我可以通过 pgAdmin 连接到数据库以使用这些设置对数据库进行必要的更改吗?如果是这样,怎么办?
我还没有找到如何做到这一点。这里的其他答案(以及谷歌中的答案)建议编写Java代码 - 这不是我需要的。我想使用 pgAdmin 界面。我可以在不使用 Java 代码的情况下进行更改吗?
这是我的设置示例:
jdbc.driverClassName - org.postgresql.Driver
jdbc.url - jdbc:postgresql://localhost:4444/
jdbc.username - username
jdbc.password - password
Run Code Online (Sandbox Code Playgroud) 这是 VirtualService 的示例,同时使用超时和重试。
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: sa-logic
spec:
hosts:
- sa-logic
http:
- route:
- destination:
host: sa-logic
subset: v1
weight: 50
- destination:
host: sa-logic
subset: v2
weight: 50
timeout: 8s
retries:
attempts: 3
perTryTimeout: 3s # perTryTimeout (3s) is different from timeout above (8s)
Run Code Online (Sandbox Code Playgroud)
怎么运行的?该文档没有为这个问题提供明确的答案。我有三个猜测: