在Jenkins中,我有一个系统groovy脚本构建步骤.有没有办法取消长时间运行的脚本,或者在系统groovy脚本中有一些代码可以判断它的构建是否已被取消?
我想使用 git 树对象中使用的哈希值来唯一标识 git 下子目录的状态,特别是作为工件存储库的索引,以避免构建。像这样的东西:
# Get hash for source tree in <path-do-dir>/<dir-name>
git cat-file -p HEAD^{tree}:<path-to-dir> | awk '$4 == "<dir-name>" { print $3 }'
Run Code Online (Sandbox Code Playgroud)
我的问题是这些哈希值是否真正持久。天真的实验表明它是有效的,但我想知道是否有人真正这样做。
Windows的一个非常令人沮丧的"功能"是进程锁定文件并阻止删除目录.
我正在寻找一种方法来查找在该目录中打开文件的所有进程,例如unix上的"lsof".我正在寻找一些powershell魔法,而我宁愿不必购买一些自定义维护工具.
有没有人有正确的代码示例
configure { ... }
Run Code Online (Sandbox Code Playgroud)
在Jenkins DSL插件中需要阻止设置git稀疏结账吗?
似乎config.xml部分看起来像这样:
<extensions>
<hudson.plugins.git.extensions.impl.CloneOption>
<shallow>false</shallow>
<reference>/build/jenkins/codebase.git</reference>
</hudson.plugins.git.extensions.impl.CloneOption>
<hudson.plugins.git.extensions.impl.SparseCheckoutPaths>
<sparseCheckoutPaths>
<hudson.plugins.git.extensions.impl.SparseCheckoutPath>
<path>BillOfMaterials.yml</path>
</hudson.plugins.git.extensions.impl.SparseCheckoutPath>
<hudson.plugins.git.extensions.impl.SparseCheckoutPath>
<path>jenkins/job/</path>
</hudson.plugins.git.extensions.impl.SparseCheckoutPath>
</sparseCheckoutPaths>
</hudson.plugins.git.extensions.impl.SparseCheckoutPaths>
</extensions>
Run Code Online (Sandbox Code Playgroud) 我想编写一个系统groovy脚本来检查Jenkins中的排队作业,并提取作为计划作业时提供的构建参数(以及构建原因作为奖励).想法?
特别:
def q = Jenkins.instance.queue
q.items.each { println it.task.name }
Run Code Online (Sandbox Code Playgroud)
检索排队的项目.我不能为我的生活找出构建参数所在的位置.
我最接近的是:
def q = Jenkins.instance.queue
q.items.each {
println("${it.task.name}:")
it.task.properties.each { key, val ->
println(" ${key}=${val}")
}
}
Run Code Online (Sandbox Code Playgroud)
这让我知道了:
4.1.next-build-launcher:
com.sonyericsson.jenkins.plugins.bfa.model.ScannerJobProperty$ScannerJobPropertyDescriptor@b299407=com.sonyericsson.jenkins.plugins.bfa.model.ScannerJobProperty@5e04bfd7
com.chikli.hudson.plugin.naginator.NaginatorOptOutProperty$DescriptorImpl@40d04eaa=com.chikli.hudson.plugin.naginator.NaginatorOptOutProperty@16b308db
hudson.model.ParametersDefinitionProperty$DescriptorImpl@b744c43=hudson.mod el.ParametersDefinitionProperty@440a6d81
...
Run Code Online (Sandbox Code Playgroud) 我随着时间的推移归档了一堆构建标签refs/builds/archived/*,我现在想要删除它们以恢复一些空间并减少总对象数(超过50k注释的git标签存储在那里).
似乎这样做的唯一方法是:
git show-ref\
| awk '/refs\/builds\/archived\/[^\/]*$/ { print "git update-ref -d "$2}'\
| sh
Run Code Online (Sandbox Code Playgroud)
这非常慢.此外,这样做似乎会减慢从repo完成的任何git提取,直到我开始运行git gc它.
我有一个 ansible playbook,它在 Linux 上运行良好,但在 macOS 上失败并出现一个奇怪的错误。
- name: Create the watcher user member of the watchers group
user:
comment: "Read-only user for folks to inspect builds"
name: "{{ watch_user }}"
group: watchers
state: present
shell: /bin/bash
createhome: yes
home: "{{ watch_user_home }}"
become: yes
when: watch_user_enabled
Run Code Online (Sandbox Code Playgroud)
当它在 Mac 上运行时,我得到:
Traceback (most recent call last):
File "/tmp/ansible_jfT4nc/ansible_module_user.py", line 2278, in <module>
main()
File "/tmp/ansible_jfT4nc/ansible_module_user.py", line 2235, in main
info = user.user_info()
File "/tmp/ansible_jfT4nc/ansible_module_user.py", line 618, in user_info
info = self.get_pwd_info() …Run Code Online (Sandbox Code Playgroud) 似乎“ git rebase”具有其他后备逻辑来处理合并失败:
Falling back to patching base and 3-way merge...
Run Code Online (Sandbox Code Playgroud)
它在那里正在做什么,我将如何调用我的樱桃小贴士来获得相同的行为?
可能正确的解决方案是不尝试将重新基准表示为一系列的小问题,但如果可能的话,那将是很好的,因为我可以使用相同的流程处理重新基准和任意更改集合。