adikari/monorepo-diff-buildkite-plugin

'last_sucessful_build' - how is this seeded into a build-node working copy?

Closed this issue · 1 comments

My attempts to try this out fail because the build-node that BK allocates doesn't have a last_sucessful_build file in it. There's nowhere in the YAML config that details what to do if last_sucessful_build isn't found.

Do I have to SSH to multiple build agents to create that file?

Or do I check-in some bash fu that checks for the existence of that file, and it it's absence makes a default version?

Hi @paul-hammant , the last_successful_build is simply a placeholder. Currently files do not persist on BK agents. In the past, we've experimented with storing the last successful build SHA on s3 and retrieving from s3 to be able to do a diff.

So from a high level, you'll be creating a script along the lines of get-list-of-changes.sh
diff: ./get-list-of-changes

get-list-of-changes.sh would compose of

LAST_SUCCESS_BUILD=$(aws s3 cp s3://path/to/my/object - | head)
git diff --name-only $(head -n 1 last_successful_build)

and in the hooks section you would take the BUILDKITE_COMMIT and write it to s3.
S3 is simply an example but any remote location would work.

I hope this clears up some of the confusion.