Skip to content

CI build: throw away local changes

Marcel Huber requested to merge fix-ci-build into master

Throw away local changes when the CI checks out the commit to be built.

Motivation

Sometimes (e.g. at job 81377), the CI/CD pipeline failed at step

git checkout $CI_COMMIT_SHA

with

error: Your local changes to the following files would be overwritten by checkout:
	README.md
Please commit your changes or stash them before you switch branches.
Aborting

As local changes on the CI/CD job runners should not need to be retained, let's just --force the checkout, which will throw away such local changes, if any.

Error analysis

I guess the "local changes" on the job runners stem from a previous iteration of the respective job, namely from the sed manipulation the Create-Solutions-And-Cleanup-Markdown job does here and here.

I've only observed this on pipelines manually started with the Run Pipeline button on https://gitlab.dev.ifs.hsr.ch/ifs/AngProj/pipelines, and only on the Create-Solutions-And-Cleanup-Markdown job. Retrying the job made it run through, but I'm unsure that'd be always the case without the changes from this merge request.

Merge request reports