Skip to content

Commit 46f5e81

Browse files
authored
Merge pull request #13 from carlosrodlop/feat-brach
[Make, CBCD] Include create, drop and connect to Database
2 parents 01f5245 + 9689221 commit 46f5e81

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

make/cbcd/Makefile

+13-1
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,23 @@ updateDb: check_kubeconfig check_envfile
2626
--namespace db --create-namespace && \
2727
kubectl rollout status sts mysql --namespace db && wait
2828

29+
.PHONY: connectDBRemotely
30+
connectDBRemotely: ## Open a connection to Database remotely for CloudBees CD
31+
connectDBRemotely: check_envfile
32+
source .env && \
33+
mysql -h $$EXTERNAL_ENDPOINT_DB -u admin --password --verbose
34+
2935
.PHONY: createDBRemotely
3036
createDBRemotely: ## Update Database remotely for CloudBees CD
3137
createDBRemotely: check_envfile
3238
source .env && \
33-
mysql -h $$EXTERNAL_ENDPOINT_DB -u admin --password --verbose < $(MKFILE)/init.db.sql
39+
mysql -h $$EXTERNAL_ENDPOINT_DB -u admin --password --verbose < $(MKFILE)/create.db.sql
40+
41+
.PHONY: dropDBRemotely
42+
dropDBRemotely: ## Delete Database remotely for CloudBees CD. Note: Database cannot be used between different deployment.
43+
dropDBRemotely: check_envfile
44+
source .env && \
45+
mysql -h $$EXTERNAL_ENDPOINT_DB -u admin --password --verbose < $(MKFILE)/drop.db.sql
3446

3547
.PHONY: updateServer
3648
updateServer: ## Update CD Server

make/cbcd/init.db.sql make/cbcd/create.db.sql

+3
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ GRANT ALL PRIVILEGES ON flow.* TO 'flow'@'%';
77
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, INDEX, DROP, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON flow_upgrade.* TO 'flow'@'%';
88
GRANT ALL PRIVILEGES ON flow_upgrade.* TO 'flow'@'%';
99
FLUSH PRIVILEGES;
10+
11+
SHOW DATABASES;
12+
Select user from mysql.user;

make/cbcd/drop.db.sql

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
DROP USER 'flow'@'%';
2+
3+
DROP DATABASE flow;
4+
DROP DATABASE flow_upgrade;
5+
6+
SHOW DATABASES;
7+
Select user from mysql.user;

0 commit comments

Comments
 (0)