ci: 'atomically' update .circleci/config.yml (#7449)

- Updates .circleci/Makefile to match
7cd733a000
This commit is contained in:
Sam Salisbury 2019-09-09 15:11:37 +01:00 committed by GitHub
parent e498f0b906
commit cf134e88f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,10 +60,14 @@ define GENERATED_FILE_HEADER
endef
export GENERATED_FILE_HEADER
# GEN_CONFIG writes the config to a temporary file. If the whole process succeeds,
# it then moves that file to $@. This makes is an atomic operation, so if it fails
# make doesn't consider a half-baked file up to date.
define GEN_CONFIG
@$(CIRCLECI) config pack $(SOURCE_DIR) > $(CONFIG_PACKED)
@echo "$$GENERATED_FILE_HEADER" > $@
@$(CIRCLECI) config process $(CONFIG_PACKED) >> $@
@echo "$$GENERATED_FILE_HEADER" > $@.tmp || { rm -f $@; exit 1; }
@$(CIRCLECI) config process $(CONFIG_PACKED) >> $@.tmp || { rm -f $@.tmp; exit 1; }
@mv -f $@.tmp $@
endef
$(OUT): $(CONFIG_SOURCE)