Skip to content

Commit

Permalink
Clean aws-nuke traces
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosrodlop committed Aug 22, 2024
1 parent 5dcf2c3 commit ebbd2cc
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 26 deletions.
10 changes: 0 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ BP_AGENT_USER := bp-agent
MKFILEDIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
CBCI_REPO ?= https://github.com/cloudbees/terraform-aws-cloudbees-ci-eks-addon.git
CBCI_BRANCH ?= main
NUKE_DRY_RUN ?= true
DESTROY_ONLY_APPS ?= false

define helpers
Expand Down Expand Up @@ -108,15 +107,6 @@ set-cbci-location: agentCheck guard-CBCI_REPO guard-CBCI_BRANCH
@$(call helpers,set-cbci-location $(CBCI_REPO) $(CBCI_BRANCH))
@$(call helpers,INFO "Setting new Casc location to $(CBCI_REPO) $(CBCI_BRANCH) finished succesfully.")

.PHONY: run-aws-nuke
run-aws-nuke: ## Run aws nuke by https://github.com/rebuy-de/aws-nuke. Example: NUKE_DRY_RUN=true make run-aws-nuke
run-aws-nuke: guard-NUKE_DRY_RUN
ifeq ($(NUKE_DRY_RUN),false)
@$(call helpers,ask-confirmation "Running AWS Nuke to destroy selected resources.")
endif
@$(call helpers,run-aws-nuke $(NUKE_DRY_RUN))
@$(call helpers,INFO "AWS nuke finished successfully with DRY_RUN=$(NUKE_DRY_RUN).")

##########################
# Global
##########################
Expand Down
16 changes: 0 additions & 16 deletions blueprints/helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -206,19 +206,3 @@ set-cbci-location () {
sed -i "s|bundle: \".*/none-ha\"|bundle: \"$branch/none-ha\"|g" "$SCRIPTDIR/02-at-scale/cbci/casc/oc/items/root.yaml"
sed -i "s|bundle: \".*/ha\"|bundle: \"$branch/ha\"|g" "$SCRIPTDIR/02-at-scale/cbci/casc/oc/items/root.yaml"
}

run-aws-nuke () {
local dry_run="$1"
local aws_nuke_file="$SCRIPTDIR/../.cloudbees/aws-nuke/bp-tf-ci-nuke.yaml"
local aws_nuke_file_log="$SCRIPTDIR/../.cloudbees/aws-nuke/aws-nuke.log"
if [ "$dry_run" == "true" ]; then
INFO "Running AWS Nuke in Dry Run Mode..."
rm "$aws_nuke_file_log" || INFO "No log file to remove."
aws-nuke -c "$aws_nuke_file" | tee "$aws_nuke_file_log"
INFO "Listing candidated resources to be deleted by using $aws_nuke_file"
grep "remove" "$aws_nuke_file_log" || INFO "No candidates to delete."
else
WARN "Running AWS Nuke in Not Dry Run Mode..."
aws-nuke -c "$aws_nuke_file" --no-dry-run
fi
}

0 comments on commit ebbd2cc

Please sign in to comment.