Skip to content

Commit

Permalink
fix(bq,sf,rs,pg): drop schemas when dedicateds gets released (#485)
Browse files Browse the repository at this point in the history
  • Loading branch information
vdelacruzb authored Mar 6, 2024
1 parent 1ceefd5 commit 59b52b6
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 9 deletions.
15 changes: 14 additions & 1 deletion .github/workflows/redshift-ded.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,19 @@ jobs:
uses: actions/checkout@v2
- name: Check diff
uses: technote-space/get-diff-action@v4
- name: Set RS_PREFIX for releases
if: startsWith(github.event.pull_request.head.ref, 'release/')
run: |
echo "RS_PREFIX=dedicated_release_${{ github.event.pull_request.number }}_" >> $GITHUB_ENV
- name: Set RS_PREFIX for hotfixes
if: startsWith(github.event.pull_request.head.ref, 'hotfix/')
run: |
echo "RS_PREFIX=dedicated_hotfix_${{ github.event.pull_request.number }}_" >> $GITHUB_ENV
- name: Set RS_PREFIX for the rest
if: |
!(startsWith(github.event.pull_request.head.ref, 'hotfix/')) &&
!(startsWith(github.event.pull_request.head.ref, 'release/'))
run: echo "RS_PREFIX=dedicated_${{ github.event.pull_request.number }}_" >> $GITHUB_ENV
- name: Setup node
uses: actions/setup-node@v1
with:
Expand Down Expand Up @@ -63,7 +76,7 @@ jobs:
if: github.event.action == 'synchronize' || github.event.action == 'labeled'
run: |
cd clouds/redshift
make deploy
make deploy dropfirst=1
- name: Run remove
id: remove
if: github.event.action == 'unlabeled' || github.event.action == 'closed'
Expand Down
8 changes: 6 additions & 2 deletions clouds/bigquery/modules/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ include $(COMMON_DIR)/Makefile

.SILENT:

.PHONY: help lint build build-share deploy deploy-share test remove remove-share clean
.PHONY: help lint build build-share deploy deploy-share test remove remove-functions remove-share clean

help:
echo "Available targets: lint build deploy test remove clean"
echo "Available targets: lint build deploy test remove remove-functions clean"

lint: venv3 $(NODE_MODULES_DEV)
echo "Linting modules..."
Expand Down Expand Up @@ -97,6 +97,10 @@ test: check $(NODE_MODULES_DEV)

remove: check
echo "Removing modules..."
$(BQ) rm -r -f -d $(BQ_DEPLOY_DATASET)

remove-functions: check
echo "Removing functions..."
REPLACEMENTS=$(REPLACEMENTS)" "$(REPLACEMENTS_EXTRA) \
GOOGLE_APPLICATION_CREDENTIALS=$(GOOGLE_APPLICATION_CREDENTIALS) \
$(COMMON_DIR)/run-script.js $(COMMON_DIR)/DROP_FUNCTIONS.sql
Expand Down
8 changes: 6 additions & 2 deletions clouds/postgres/modules/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ include $(COMMON_DIR)/Makefile

.SILENT:

.PHONY: help lint build deploy test remove clean
.PHONY: help lint build deploy test remove remove-functions clean

help:
echo "Available targets: lint build deploy test remove clean"
echo "Available targets: lint build deploy test remove remove-functions clean"

lint: venv3 $(NODE_MODULES_DEV)
echo "Linting modules..."
Expand Down Expand Up @@ -61,6 +61,10 @@ test: check venv3 $(NODE_MODULES_DEV)

remove: venv3
echo "Removing modules..."
$(VENV3_BIN)/python $(COMMON_DIR)/run_query.py "DROP SCHEMA IF EXISTS $(PG_SCHEMA) CASCADE;"

remove-functions: venv3
echo "Removing functions..."
REPLACEMENTS=$(REPLACEMENTS)" "$(REPLACEMENTS_EXTRA) \
$(VENV3_BIN)/python $(COMMON_DIR)/run_script.py $(COMMON_DIR)/DROP_FUNCTIONS.sql

Expand Down
8 changes: 6 additions & 2 deletions clouds/redshift/modules/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ include $(COMMON_DIR)/Makefile

.SILENT:

.PHONY: help lint build deploy test remove clean
.PHONY: help lint build deploy test remove remove-functions clean

help:
echo "Available targets: lint build deploy test remove clean"
echo "Available targets: lint build deploy test remove remove-functions clean"

lint: venv3 $(NODE_MODULES_DEV)
echo "Linting modules..."
Expand Down Expand Up @@ -61,6 +61,10 @@ test: check venv3 $(NODE_MODULES_DEV)

remove: venv3
echo "Removing modules..."
$(VENV3_BIN)/python $(COMMON_DIR)/run_query.py "DROP SCHEMA IF EXISTS $(RS_SCHEMA) CASCADE;"

remove-functions: venv3
echo "Removing functions..."
REPLACEMENTS=$(REPLACEMENTS)" "$(REPLACEMENTS_EXTRA) \
$(VENV3_BIN)/python $(COMMON_DIR)/run_script.py $(COMMON_DIR)/DROP_FUNCTIONS.sql

Expand Down
8 changes: 6 additions & 2 deletions clouds/snowflake/modules/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ include $(COMMON_DIR)/Makefile

.SILENT:

.PHONY: help lint build build-share build-native-app-setup-script deploy deploy-share test remove remove-share clean
.PHONY: help lint build build-share build-native-app-setup-script deploy deploy-share test remove remove-functions remove-share clean

help:
echo "Available targets: lint build deploy test remove clean"
echo "Available targets: lint build deploy test remove remove-functions clean"

lint: $(NODE_MODULES_DEV) venv3
echo "Linting modules..."
Expand Down Expand Up @@ -107,6 +107,10 @@ test: check $(NODE_MODULES_DEV)

remove: $(NODE_MODULES_DEV)
echo "Removing modules..."
$(COMMON_DIR)/run-query.js "DROP SCHEMA IF EXISTS $(SF_SCHEMA) CASCADE;"

remove-functions: $(NODE_MODULES_DEV)
echo "Removing functions..."
REPLACEMENTS=$(REPLACEMENTS)" "$(REPLACEMENTS_EXTRA) \
$(COMMON_DIR)/run-script.js $(COMMON_DIR)/DROP_FUNCTIONS.sql

Expand Down

0 comments on commit 59b52b6

Please sign in to comment.