ci: docker-nightly fails on rerun because the cloned influxdata-docker directory persists
Relevant telegraf.conf
# Not applicable. This is a CI issue in the repository, not a runtime issue.Logs from Telegraf
Not applicable. The failure is in the docker-nightly CircleCI job.System info
Telegraf master, CircleCI self-hosted runner (runner-ns/clustered-linux-vm)
Docker
Not applicable.
Steps to reproduce
- Let a scheduled
nightlypipeline rundocker-nightlyfar enough to cloneinfluxdata/influxdata-dockerinto the job's working directory. - Have the job fail after that point, for example on the
docker pushto quay.io. - Rerun the workflow from failed.
Expected behavior
The rerun either starts from a clean working directory or tolerates the leftover one, so it fails on the original problem or succeeds.
Actual behavior
The rerun fails at the clone instead, with fatal: destination path 'influxdata-docker' already exists and is not an empty directory, which hides the failure that was actually being retried.
docker-nightly runs on the self-hosted-amd executor added in #19748, whose working_directory is /home/circleci/workspace-<< pipeline.id >>. Those runners are long-lived rather than ephemeral, so the directory and its contents survive after the job ends. Rerunning a workflow from failed creates a new workflow inside the same pipeline, so pipeline.id is unchanged and the new run lands in the directory the previous attempt left behind. The job's first real step is:
- run:
name: clone influxdata/influxdata-docker
command: git clone https://github.com/influxdata/influxdata-dockerThere is no checkout and no cleanup before it, so the clone is the thing that breaks.
Additional info
Cheapest fix is to make the clone idempotent, either rm -rf influxdata-docker before it or a fetch-and-reset when the directory is already there.
Worth checking at the same time whether anything reaps these pipeline-keyed workspaces. Each pipeline leaves one behind on a long-lived host, so if cleanup is not handled in the runner fleet configuration, disk use grows without bound. That part is not visible from this repository.
Source: influxdata/telegraf