This commit is contained in:
parent
7a1d25f3b6
commit
4a5a24e402
10
Makefile
10
Makefile
@ -46,7 +46,7 @@ $(DIRS):
|
||||
@echo "Environment retrieved for $@"
|
||||
|
||||
# Check if on master branch
|
||||
@if [ "$(GIT_BRANCH)" = "master" ]; then \
|
||||
if [ "$(GIT_BRANCH)" = "master" ]; then \
|
||||
echo "Current branch is $(GIT_BRANCH), checking latest timestamp in consul."; \
|
||||
LAST_BUILD_TIMESTAMP=$$(consul kv get infra/packer/$@/timestamp || echo "0"); \
|
||||
CURRENT_TIME=$$(date +%s); \
|
||||
@ -60,15 +60,15 @@ $(DIRS):
|
||||
fi
|
||||
|
||||
# Link .hcl files
|
||||
@find $(LIBRARY_PATH) -name '*.hcl' -exec sh -c 'ln -sf $$PWD/{} $(IMAGES_PATH)/$@/$(SYMLINK_PREFIX)$$(basename {})' \;
|
||||
find $(LIBRARY_PATH) -name '*.hcl' -exec sh -c 'ln -sf $$PWD/{} $(IMAGES_PATH)/$@/$(SYMLINK_PREFIX)$$(basename {})' \;
|
||||
|
||||
# Link builds
|
||||
@for build in $$(cat $(IMAGES_PATH)/$@/builds); do \
|
||||
for build in $$(cat $(IMAGES_PATH)/$@/builds); do \
|
||||
ln -sf ../../../../builds/$${build}.pkr.hcl $(IMAGES_PATH)/$@/library_$${build}.build.pkr.hcl; \
|
||||
done
|
||||
|
||||
# Build the image
|
||||
@(cd $(IMAGES_PATH)/$@ && \
|
||||
(cd $(IMAGES_PATH)/$@ && \
|
||||
export DATE=$(DATE_TAG) && \
|
||||
export OS_NAME=$$(echo $@ | cut -d'/' -f1) && \
|
||||
export OS_VERSION_FULL=$$(echo $@ | cut -d'/' -f2) && \
|
||||
@ -84,7 +84,7 @@ $(DIRS):
|
||||
packer build . )
|
||||
|
||||
# Update build timestamp and date in Consul if on master branch
|
||||
@if [ "$(GIT_BRANCH)" = "master" ]; then \
|
||||
if [ "$(GIT_BRANCH)" = "master" ]; then \
|
||||
echo "Current branch is $(GIT_BRANCH), updating consul."; \
|
||||
CURRENT_TIMESTAMP=$$(date +%s); \
|
||||
READABLE_DATE=$$(date '+%Y-%m-%d %H:%M:%S %Z'); \
|
||||
|
||||
Loading…
Reference in New Issue
Block a user