title: Run a Concourse build step only when an output of a prior task changes
body: <p>Given an input, I have a cheap function and an expensive function; each of these is modeled as a Concourse task.</p>
  <p>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.</p>
  <p>How can I set up a pipeline that only runs the expensive function when the result of the cheap function changes?</p>
  <hr />
  <p>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.</p>
  <p>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?</p>
  <hr />
  <p>This is similar to <a href="https://stackoverflow.com/questions/40640042/have-concourse-only-build-new-docker-containers-on-file-diff-not-on-commit">Have Concourse only build new docker containers on file diff not on commit</a>, but I'm trying to test whether <em>the result of running a function against a file</em> 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).</p>