仅当先前任务的输出更改时,才运行大厅构建步骤
鉴于输入,我具有便宜的功能和昂贵的功能;这些中的每一个都是建模为一项大厅任务。
如果廉价功能的两个调用具有相同的输出,我知道昂贵功能的两个调用同样将具有相同的输出。
如何设置只有在廉价功能的结果变化时才能运行昂贵功能的管道?
为了示例,假设廉价功能将代码库的评论和空格剥离,然后计算出校验和校验和。而昂贵的功能实际运行了包含的代码。在这种情况下,我的目标是不必费心建立任何仅在评论或空格中与前面区别的修订。
我已经考虑过使用git资源,并且(在我们的示例中)将每个汇编目标存储在另一个文件中的预处理器输出哈希,因此执行实际编译(和适用的单位测试)的任务可以使用哈希触发文件的更改。构建该文件的输入。但是,拥有一个单独的GIT资源,可以无限期地维持历史哈希,这似乎是过分的。有更好的方法吗?
这类似于仅在文件diff上构建新的docker容器 ,但我正在尝试测试是否针对文件运行函数的结果 更改,以仅在可以修改的更改上触发建立结果,而不是所有可能的更改。 (上述提案,创建了一个带有廉价功能输出的中介存储库,实际上将使用该问题的答案作为其组件之一;但是我希望有一个可以使用更少的运动部件的选项)。
Given an input, I have a cheap function and an expensive function; each of these is modeled as a Concourse task.
If two invocations of the cheap function have the same output, I know that two invocations of the expensive function will likewise have the same output.
How can I set up a pipeline that only runs the expensive function when the result of the cheap function changes?
For the sake of an example, let's say that the cheap function strips comments and whitespace from a codebase and then calculates a checksum; whereas the expensive function actually runs the code contained. My goal, in this scenario, is to not bother building any revision that differs from the prior one only in comments or whitespace.
I've considered using a git resource and (in our example) storing a hash of preprocessor output for each compilation target in a different file, so the task doing actual compilation (and applicable unit tests) can trigger on changes to the file with hash of the inputs that went into building that file. Having a separate git resource that maintains historical hashes indefinitely seems like overkill, though. Is there a better approach?
This is similar to Have Concourse only build new docker containers on file diff not on commit, but I'm trying to test whether the result of running a function against a file changes, to trigger only on changes that could modify build results rather than all possible changes. (The proposal described above, creating an intermediary repo with outputs from the cheap function, would effectively be using the answers to that question as one of its components; but I'm hoping there's an option with fewer moving parts).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
考虑使用
put
嵌套在中尝试:
修改器:便宜
job abor在每项提交
code-repo
的每项提交的 并将其与计算结果进行比较(在下面的愚蠢示例中,hash.txt
的内容>code> code> code-repo
)。如果它确定来自传入提交的哈希值与先前记录的哈希值有所不同,则将填充
put
paramhash/hash.txt
带有新的哈希值,结果结果在新的资源中,这又将触发昂贵的
作业。如果未检测到更改,则PUT尝试将失败,因为
PUT
参数将不存在,但是总体便宜
作业将成功。注意:您必须在
s3
中填充初始状态文件,或者便宜
作业不会起飞。Consider using
put
nested in thetry:
modifier:The
cheap
job takes two inputs:On every commit to
code-repo
, thecheap
job reads thelast-hash
input, mapped fromhash
and compares it to the computation result (in the silly example below, the contents ofhash.txt
checked into the root ofcode-repo
).If it determines that the hash value from incoming commit differs from the previously recorded hash value, it populates the
put
paramhash/hash.txt
with the new hash value, which results in a new put to the resource which in turn will trigger theexpensive
job.If no change is detected, the put attempt will fail because the
put
param will not exist, but the overallcheap
job will succeed.Note: you must populate the initial state file in
s3
with some value, or thecheap
job won't take off.