-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaws-sagemaker.mk
47 lines (38 loc) · 2.25 KB
/
aws-sagemaker.mk
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
ifndef _MK_AWS_SAGEMAKER_MK_
_MK_AWS_SAGEMAKER_MK_ := 1
#$(info ---> .make/aws-sagemaker.mk)
ifndef GIT_ROOT
GIT_ROOT := $(shell git rev-parse --show-toplevel 2>/dev/null)
endif
ifndef MK_DIR
MK_DIR := $(GIT_ROOT)/.make
endif
include $(MK_DIR)/aws.mk
include $(MK_DIR)/jq.mk
include $(MK_DIR)/sops.mk
.INTERMEDIATE: ./aws-sagemaker-list-notebook-instance-lifecycle-configs.sh
./aws-sagemaker-list-notebook-instance-lifecycle-configs.sh: aws-cli-check jq-check
@echo "#!/bin/bash" > $@
@printf "echo \"aws sagemaker list-notebook-instance-lifecycle-configs:\"\n" >> $@
@#printf "set -x\n" >> $@
@echo "$(AWS_BIN) sagemaker list-notebook-instance-lifecycle-configs --no-paginate | $(JQ_BIN) -r '.NotebookInstanceLifecycleConfigs[]?.NotebookInstanceLifecycleConfigName' | sort -u" >> $@
@chmod +x $@
.PHONY: sagemaker-list-notebook-instance-lifecycle-configs
sagemaker-list-notebook-instance-lifecycle-configs: ./aws-sagemaker-list-notebook-instance-lifecycle-configs.sh $(SOPS_EXEC)
$(SOPS_EXEC) ./aws-sagemaker-list-notebook-instance-lifecycle-configs.sh
.INTERMEDIATE: ./aws-sagemaker-delete-notebook-instance-lifecycle-configs.sh
./aws-sagemaker-delete-notebook-instance-lifecycle-configs.sh: aws-cli-check jq-check
@echo "#!/bin/bash" > $@
@printf "echo \"aws sagemaker delete notebook-instance-lifecycle-configs: start\"\n" >> $@
@#printf "set -x\n" >> $@
@echo "for config_name in \$$($(AWS_BIN) sagemaker list-notebook-instance-lifecycle-configs --no-paginate | $(JQ_BIN) -r '.NotebookInstanceLifecycleConfigs[]?.NotebookInstanceLifecycleConfigName'); do" >> $@
@echo " echo \"aws sagemaker delete notebook-instance-lifecycle-config \$$config_name\"" >> $@
@echo " $(AWS_BIN) sagemaker delete-notebook-instance-lifecycle-config --notebook-instance-lifecycle-config-name \$$config_name --no-cli-auto-prompt" >> $@
@echo "done" >> $@
@printf "echo \"aws sagemaker delete notebook-instance-lifecycle-configs: done\"\n" >> $@
@chmod +x $@
.PHONY: sagemaker-delete-notebook-instance-lifecycle-configs
sagemaker-delete-notebook-instance-lifecycle-configs: ./aws-sagemaker-delete-notebook-instance-lifecycle-configs.sh $(SOPS_EXEC)
$(SOPS_EXEC) ./aws-sagemaker-delete-notebook-instance-lifecycle-configs.sh
#$(info <--- .make/aws-sagemaker.mk)
endif # _MK_AWS_SAGEMAKER_MK_