是否有选项可以监控Jenkins中的git存储库,但是在提交时不执行pull/clone/fetch?
我希望基于对存储库中指定分支的提交来触发构建作业,但我不希望Jenkins构建作业执行自动pull/clone/fetch.
我的目录结构是src/ps/proto.我的build.gradle文件位于src目录中.我已将sourceSets设置为
sourceSets {
ps {
proto {
srcDir 'ps/proto'
}
}
}
Run Code Online (Sandbox Code Playgroud)
然而,一个gradlew generatePsProto给了我一大堆错误,其中一个是我的源目录是src/src/ps/proto.
Execution failed for task ':generatePsProto'.
> protoc: stdout: . stderr: /home/build/tree/src/src/ps/proto: warning: directory does not exist.
[libprotobuf WARNING google/protobuf/compiler/parser.cc:546] No syntax specified for the proto file: cldb.proto. Please use 'syntax = "proto2";' or 'syntax = "proto3";' to specify a syntax version. (Defaulted to proto2 syntax.)
ps/proto/security.proto: File not found.
ps/proto/common.proto: File not found.
ps/proto/cli.proto: File not found.
ps/proto/volumemirrorcommon.proto: File not found.
ps/proto/metrics.proto: …Run Code Online (Sandbox Code Playgroud) 在运行maven 3.0.3的Redhat系统上,正在使用时间戳而不是-SNAPSHOT.jar结尾下载某些工件.
a-2.3.0-20140206.210030-51.jar
b-2.3.0-20140206.205829-51.jar
Run Code Online (Sandbox Code Playgroud)
等等
但是,在运行maven 3.0.3的Ubuntu系统上,相同的下载工件有-SNAPSHOT.jar结尾.
a-2.3.0-SNAPSHOT.jar
b-2.3.0-SNAPSHOT.jar
Run Code Online (Sandbox Code Playgroud)
settings.xml文件是相同的.在~/.m2/repository已经吹散.回购是完全相同的.
我错过了什么?
A 使所有克隆成为git repo.我想知道提交哈希是什么,并将git commit hash分配给一个变量,该变量稍后可以在Makefile中使用
例如
all: download
echo '$(GIT_COMMIT)'
download:
cd buildarea && git clone git@github.com:proj/project.git
$(eval GIT_COMMIT = $(shell cd buildarea/project && git log -l --pretty=format:"%H"))
echo '$(GIT_COMMIT)'
Run Code Online (Sandbox Code Playgroud) 当尝试创建一个 fat jar 时,shadowJar 遗漏了很多依赖项。我从工作 pom.xml 创建了一个 build.gradle 文件。Maven 构建一个 fat jar 没有问题。阅读 Gradle 关于构建 fat jar 的信息,shadowJar 插件似乎是推荐的方法。然而,我的 Gradle fat jar 给出了以下运行时错误:
Jul 19, 2018 2:35:10 PM restclients.RestStatus2Streams writeToStream
SEVERE: Error occurred while instantiating com.me.streams.impl.producer.MarlinProducerV10.
==> java.lang.NoClassDefFoundError: org/apache/hadoop/fs/PathId.
Run Code Online (Sandbox Code Playgroud)
显然,我远处的罐子缺少了一些东西。果然,org/apache/hadoop/fs/PathId 和整个依赖目录都丢失了。尽管 pom.xml 没有显式包含“org.apache.hadoop:hadoop-common”依赖项,但我显式将该工件作为依赖项添加到我的 build.gradle 文件中,但仍然不高兴。
回答几个问题:
由于 Maven fat jar 工作完美,并且解压 Maven fat jar 会显示 PathId 类(以及 Gradle fat jar 中缺少的其他类),那么我的 build.gradle 文件和/或 ShadowJar 插件和/或 Gradle 就会出现问题。
构建.gradle文件:
apply plugin: 'java'
apply …Run Code Online (Sandbox Code Playgroud) 从 Gradle 4.0 升级到 6.1,com.moowork.glup 插件似乎已经消失了。然而,https://plugins.gradle.org/plugin/com.moowork.gulp页面显示该插件确实存在。示例代码适用于注释掉的 com.moowork.gulp 行。
plugins {
id 'java'
id 'maven'
id "com.moowork.gulp" version "1.3.0"
id "nebula.ospackage" version "8.0.3"
}
task testAgain {
println 'Configuration stage'
doLast {
println 'Execution stage'
}
}
Run Code Online (Sandbox Code Playgroud)
一旦有问题的行被取消注释,Gradle 示例就会失败。
$ ./gradlew -q testAgain
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'example'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not find com.moowork.gradle:gradle-node-plugin:1.3.0.
Searched in the following locations: …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 Gradle 创建一个 Fat/Uber jar。不幸的是,我不断遇到以下错误:
> Task :fatJar FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':fatJar'.
> Could not expand ZIP '/home/me/.gradle/caches/modules-2/files-2.1/org.apache.drill/drill-client/1.13.0/c90c87887c292a3712eccc7cebdc48b0b9d93ec9/drill-client-1.13.0.pom'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use …Run Code Online (Sandbox Code Playgroud) 据推测,pssh的-x选项传递额外的SSH命令行参数.SSH的"-t"选项应该处理"伪终端"错误.是否应该使用另一个pssh/ssh选项?
# pssh -i -H ec2-user@xxx.xxx.xxx.xx1 -H ec2-user@xxx.xxx.xxx.xx2 -x "-t -i /tmp/key.pem" 'sudo hostname'
[1] 13:46:54 [FAILURE] ec2-user@xxx.xxx.xxx.xx1 Exited with error code 1
Stderr: Pseudo-terminal will not be allocated because stdin is not a terminal.
sudo: sorry, you must have a tty to run sudo
[2] 13:46:54 [FAILURE] ec2-user@xxx.xxx.xxx.xx1 Exited with error code 1
Stderr: Pseudo-terminal will not be allocated because stdin is not a terminal.
sudo: sorry, you must have a tty to run sudo
Run Code Online (Sandbox Code Playgroud)
没有"-t"和"sudo",命令工作正常,但我需要运行一些命令作为sudo.
# pssh -i …Run Code Online (Sandbox Code Playgroud) 我是 Bazel 的新手(版本 0.28.1)。\n如何在另一个目录中包含头文件?下面的目录结构代表了我的问题。
\n\n.\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 WORKSPACE\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 src\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Makefile\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 hellomake.c\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 hellofunc.c\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 BUILD\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 include\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 hellomake.h\nRun Code Online (Sandbox Code Playgroud)\n\n使用 src 中的 Makefile 可以很好地构建树。但是,使用 Make 我可以使用“-I ../include”引用包含文件。当我尝试使用 Bazel 构建同一棵树时,我无法成功包含头文件 hellomake.h。显然,上层引用“..”不起作用。
\n\n我的构建文件:
\n\ncc_library (\n name = "hellomake",\n srcs = ["hellomake.c"],\n hdrs = ["//include/hellomake.h"],\n copts = ["-I include"],\n)\n\ncc_library (\n name = "hellofunc",\n srcs = ["hellofunc.c"],\n hdrs = ["//include/hellomake.h"],\n copts = ["-I include"],\n)\n\ncc_binary(\n name = "hello",\n deps = [ ":hellomake", ":hellofunc", ],\n)\nRun Code Online (Sandbox Code Playgroud)\n\n从\'.\'我的命令是:
\n\nbazel build //src/hello\nRun Code Online (Sandbox Code Playgroud)\n