<commit_before>IMAGE_PREFIX="rtyler/codevalet"

check: generate plans validate
	$(MAKE) -C webapp check

all: plugins master

plugins: ./scripts/build-plugins plugins.txt builder
	./scripts/build-plugins

builder: Dockerfile.builder
	docker build -t ${IMAGE_PREFIX}-$@ -f Dockerfile.$@ .

master: Dockerfile.master build/git-refs.txt
	docker build -t ${IMAGE_PREFIX}-$@ -f Dockerfile.$@ .

build/git-refs.txt:
	./scripts/record-sha1sums

validate: plans/*.tf generate-tfs
	./scripts/terraform validate plans

plan: validate
	./scripts/terraform plan --var-file=.terraform.json plans

deploy: plan
	./scripts/terraform apply --var-file=.terraform.json plans

generate: generate-tfs generate-k8s

generate-tfs: monkeys.txt
	@for m in $(shell cat monkeys.txt); do \
		echo ">> Generating Terraform resources for $$m" ; \
		cat plans/master.tf.template | sed "s/@@USER@@/$$m/" > plans/generated.$$m.tf ; \
	done;

generate-k8s: monkeys.txt k8s/generated
	@for m in $(shell cat monkeys.txt); do \
		echo ">> Generating kubernetes resources for $$m" ; \
		cat k8s/jenkins.yaml.template | sed "s/@@USER@@/$$m/" > k8s/generated/$$m.yaml ; \
	done;

deploy-k8s: .kube/config generate-k8s
	@for f in k8s/*.yaml; do \
		echo ">> Provisioning resources from $$f"; \
		./scripts/kubectl create -f $$f  ; \
	done;
	@for f in k8s/generated/*.yaml; do \
		echo ">> Provisioning resources from $$f"; \
		./scripts/kubectl create -f $$f  ; \
	done;

.kube/config:
	./scripts/az acs kubernetes get-credentials \
		-f ./.kube/config \
		-n codevaletdev-controlplane \
		-n codevaletdev-controlplane \
		-g codevaletdev-controlplane

k8s/generated:
	mkdir -p k8s/generated

webapp:
	$(MAKE) -C webapp

clean:
	rm -f build/git-refs.txt k8/generated
	$(MAKE) -C webapp clean

.PHONY: clean all plugins master builder plan validate \
	deploy generate-k8s deploy-k8s webapp check generate-tfs generate<commit_msg>Allow kubectl to fail without failing the Make invocation<commit_after>IMAGE_PREFIX="rtyler/codevalet"

check: generate plans validate
	$(MAKE) -C webapp check

all: plugins master

plugins: ./scripts/build-plugins plugins.txt builder
	./scripts/build-plugins

builder: Dockerfile.builder
	docker build -t ${IMAGE_PREFIX}-$@ -f Dockerfile.$@ .

master: Dockerfile.master build/git-refs.txt
	docker build -t ${IMAGE_PREFIX}-$@ -f Dockerfile.$@ .

build/git-refs.txt:
	./scripts/record-sha1sums

validate: plans/*.tf generate-tfs
	./scripts/terraform validate plans

plan: validate
	./scripts/terraform plan --var-file=.terraform.json plans

deploy: plan
	./scripts/terraform apply --var-file=.terraform.json plans

generate: generate-tfs generate-k8s

generate-tfs: monkeys.txt
	@for m in $(shell cat monkeys.txt); do \
		echo ">> Generating Terraform resources for $$m" ; \
		cat plans/master.tf.template | sed "s/@@USER@@/$$m/" > plans/generated.$$m.tf ; \
	done;

generate-k8s: monkeys.txt k8s/generated
	@for m in $(shell cat monkeys.txt); do \
		echo ">> Generating kubernetes resources for $$m" ; \
		cat k8s/jenkins.yaml.template | sed "s/@@USER@@/$$m/" > k8s/generated/$$m.yaml ; \
	done;

deploy-k8s: .kube/config generate-k8s
	@for f in k8s/*.yaml; do \
		echo ">> Provisioning resources from $$f"; \
		./scripts/kubectl create -f $$f || true ; \
	done;
	@for f in k8s/generated/*.yaml; do \
		echo ">> Provisioning resources from $$f"; \
		./scripts/kubectl create -f $$f  ; \
	done;

.kube/config:
	./scripts/az acs kubernetes get-credentials \
		-f ./.kube/config \
		-n codevaletdev-controlplane \
		-n codevaletdev-controlplane \
		-g codevaletdev-controlplane

k8s/generated:
	mkdir -p k8s/generated

webapp:
	$(MAKE) -C webapp

clean:
	rm -f build/git-refs.txt k8/generated
	$(MAKE) -C webapp clean

.PHONY: clean all plugins master builder plan validate \
	deploy generate-k8s deploy-k8s webapp check generate-tfs generate
{'fraction_non_alphanumeric': 0.14528351188920827, 'fraction_numerical': 0.007839038411288215, 'mean_word_length': 3.47196261682243, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2024171', 'n_tokens_mistral': 1450, 'n_tokens_neox': 1388, 'n_words': 364}