forked from pivotal-sprout/sprout-wrap
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
76 lines (57 loc) · 2.75 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
REPO_NAME := sprout-wrap
REPO := $(REPO_NAME)
#REV := $(shell TZ=UTC date +'%Y%m%dT%H%M%S')-$(shell git rev-parse --short HEAD)
# If in CI, use soloistrc from ./test/fixtures
ifeq ($(CI),true)
SOLOIST_PREFIX := ./test/fixtures/
else
SOLOIST_PREFIX := ./
endif
TEMP_PATH := $(SOLOIST_PREFIX)/tmp/
BREWFILE_PATH ?= $(TEMP_PATH)Brewfile
SOLOISTRC_PATH ?= $(SOLOIST_PREFIX)soloistrc
.PHONY: clean librarian-clean librarian-clean-install librarian-update bootstrap test sprout
include $(SELF_DIR)/main.mk
test: soloistrc* ## Run test to validate soloistrc files
for f in $? ; do bundle exec ruby -r yaml -e 'YAML.load_file ARGV[0];printf(".")' "$$f" ; done
$(SELF_DIR)/cookbooks Cheffile.lock: ## no-help
bundle exec librarian-chef install
librarian-clean: ## Cleans up all cookbooks & librarian cache files
bundle exec librarian-chef clean
rm -rf tmp/librarian/
rm -rf cookbooks/
librarian-install: $(SELF_DIR)/cookbooks Cheffile.lock ## Runs librarian-chef install, if needed
librarian-clean-install: librarian-clean librarian-install ## Runs librarian-clean then install
ifeq (librarian-update,$(firstword $(MAKECMDGOALS)))
# use the rest as arguments for "librarian-update"
RUN_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
# ...and turn them into do-nothing targets
$(eval $(RUN_ARGS):;@:)
endif
librarian-update: ## Update librarian managed cookbook(s)
bundle exec librarian-chef update $(RUN_ARGS)
bootstrap: ## Run bootstrap & soloist on this node
./bootstrap-scripts/bootstrap.sh
sprout: ## Run soloist on this node via sprout helper script
caffeinate ./sprout
# Testing in /tmp first...
.PHONY: brewfile
brewfile: $(BREWFILE_PATH) ## Convert soloistrc to Brewfile
$(BREWFILE_PATH): $(SOLOISTRC_PATH)
mkdir -p $(TEMP_PATH)
export SOLOISTRC_PATH=$(SOLOISTRC_PATH) BREWFILE_PATH=$(BREWFILE_PATH); \
bundle exec ruby ./bin/convert_soloistrc_to_brewfile.rb
.github/clear_github_actions_cache:
date +%s > .github/clear_github_actions_cache
.PHONY: clean-github-cache-file clear-github-cache
clear-github-cache: clean-github-cache-file .github/clear_github_actions_cache ## Force GitHub Actions Cache key to change for fresh CI run
git add .github/clear_github_actions_cache
git commit -m "Clear GitHub Actions Cache @ $$(cat .github/clear_github_actions_cache)"
clean-github-cache-file: ## Remove GitHub Actions Cache timestamp invalidator file.
[ -f '.github/clear_github_actions_cache' ] && rm -f '.github/clear_github_actions_cache' || true
clean:: ## Remove temporary/cache files.
[ -d '$(TEMP_PATH)' ] && rm -rf $(TEMP_PATH) || true
[ -d 'tmp/librarian/' ] && rm -rf tmp/librarian/ || true
[ -d '$(TEMP_PATH)' ] && rmdir $(TEMP_PATH) || true
[ -d 'nodes/' ] && sudo rm -rf nodes/ || true