From cfa920431bd31ac2e619e32b672f41cfd382ecf5 Mon Sep 17 00:00:00 2001 From: Carlos Konstanski Date: Fri, 8 Dec 2017 17:17:53 -0700 Subject: Add support to build the database only Issue: IS-37 --- jjb/yaml/pippiandcarlos.com/ob-ctl.yaml | 36 ++++++++++++++++++++++ jjb/yaml/pippiandcarlos.com/ob-deploy-branch.yaml | 4 +++ jjb/yaml/verizoncloudplatform.com/ob-ctl.yaml | 36 ++++++++++++++++++++++ .../verizoncloudplatform.com/ob-deploy-branch.yaml | 4 +++ pillar/openbook/ansible.sls | 32 ++++++++++++++++--- salt/openbook/ansible/files/inventory_json.rb | 2 +- salt/openbook/ci/files/openbookctl | 6 ++-- 7 files changed, 112 insertions(+), 8 deletions(-) diff --git a/jjb/yaml/pippiandcarlos.com/ob-ctl.yaml b/jjb/yaml/pippiandcarlos.com/ob-ctl.yaml index 47a73bb..50954b6 100644 --- a/jjb/yaml/pippiandcarlos.com/ob-ctl.yaml +++ b/jjb/yaml/pippiandcarlos.com/ob-ctl.yaml @@ -11,6 +11,15 @@ - "ob-ctl-{action}-{branch}": branch: "unstable" action: "restart" + - "ob-ctl-{action}-{branch}": + branch: "unstable_db" + action: "stop" + - "ob-ctl-{action}-{branch}": + branch: "unstable_db" + action: "start" + - "ob-ctl-{action}-{branch}": + branch: "unstable_db" + action: "restart" - "ob-ctl-{action}-{branch}": branch: "develop" action: "stop" @@ -20,6 +29,15 @@ - "ob-ctl-{action}-{branch}": branch: "develop" action: "restart" + - "ob-ctl-{action}-{branch}": + branch: "develop_db" + action: "stop" + - "ob-ctl-{action}-{branch}": + branch: "develop_db" + action: "start" + - "ob-ctl-{action}-{branch}": + branch: "develop_db" + action: "restart" - "ob-ctl-{action}-{branch}": branch: "stage" action: "stop" @@ -29,6 +47,15 @@ - "ob-ctl-{action}-{branch}": branch: "stage" action: "restart" + - "ob-ctl-{action}-{branch}": + branch: "stage_db" + action: "stop" + - "ob-ctl-{action}-{branch}": + branch: "stage_db" + action: "start" + - "ob-ctl-{action}-{branch}": + branch: "stage_db" + action: "restart" - "ob-ctl-{action}-{branch}": branch: "master" action: "stop" @@ -38,6 +65,15 @@ - "ob-ctl-{action}-{branch}": branch: "master" action: "restart" + - "ob-ctl-{action}-{branch}": + branch: "master_db" + action: "stop" + - "ob-ctl-{action}-{branch}": + branch: "master_db" + action: "start" + - "ob-ctl-{action}-{branch}": + branch: "master_db" + action: "restart" - job-template: name: "ob-ctl-{action}-{branch}" diff --git a/jjb/yaml/pippiandcarlos.com/ob-deploy-branch.yaml b/jjb/yaml/pippiandcarlos.com/ob-deploy-branch.yaml index f4ff495..3fa81ce 100644 --- a/jjb/yaml/pippiandcarlos.com/ob-deploy-branch.yaml +++ b/jjb/yaml/pippiandcarlos.com/ob-deploy-branch.yaml @@ -3,9 +3,13 @@ name: "ob-deploy-branch" branch: - "unstable" + - "unstable_db" - "develop" + - "develop_db" - "stage" + - "stage_db" - "master" + - "master_db" jobs: - "ob-deploy-branch-{branch}" diff --git a/jjb/yaml/verizoncloudplatform.com/ob-ctl.yaml b/jjb/yaml/verizoncloudplatform.com/ob-ctl.yaml index 0be8ad8..81a530a 100644 --- a/jjb/yaml/verizoncloudplatform.com/ob-ctl.yaml +++ b/jjb/yaml/verizoncloudplatform.com/ob-ctl.yaml @@ -11,6 +11,15 @@ - "ob-ctl-{action}-{branch}": branch: "unstable" action: "restart" + - "ob-ctl-{action}-{branch}": + branch: "unstable_db" + action: "stop" + - "ob-ctl-{action}-{branch}": + branch: "unstable_db" + action: "start" + - "ob-ctl-{action}-{branch}": + branch: "unstable_db" + action: "restart" - "ob-ctl-{action}-{branch}": branch: "develop" action: "stop" @@ -20,6 +29,15 @@ - "ob-ctl-{action}-{branch}": branch: "develop" action: "restart" + - "ob-ctl-{action}-{branch}": + branch: "develop_db" + action: "stop" + - "ob-ctl-{action}-{branch}": + branch: "develop_db" + action: "start" + - "ob-ctl-{action}-{branch}": + branch: "develop_db" + action: "restart" - "ob-ctl-{action}-{branch}": branch: "stage" action: "stop" @@ -29,6 +47,15 @@ - "ob-ctl-{action}-{branch}": branch: "stage" action: "restart" + - "ob-ctl-{action}-{branch}": + branch: "stage_db" + action: "stop" + - "ob-ctl-{action}-{branch}": + branch: "stage_db" + action: "start" + - "ob-ctl-{action}-{branch}": + branch: "stage_db" + action: "restart" - "ob-ctl-{action}-{branch}": branch: "master" action: "stop" @@ -38,6 +65,15 @@ - "ob-ctl-{action}-{branch}": branch: "master" action: "restart" + - "ob-ctl-{action}-{branch}": + branch: "master_db" + action: "stop" + - "ob-ctl-{action}-{branch}": + branch: "master_db" + action: "start" + - "ob-ctl-{action}-{branch}": + branch: "master_db" + action: "restart" - job-template: name: "ob-ctl-{action}-{branch}" diff --git a/jjb/yaml/verizoncloudplatform.com/ob-deploy-branch.yaml b/jjb/yaml/verizoncloudplatform.com/ob-deploy-branch.yaml index d2b41bc..baf74dc 100644 --- a/jjb/yaml/verizoncloudplatform.com/ob-deploy-branch.yaml +++ b/jjb/yaml/verizoncloudplatform.com/ob-deploy-branch.yaml @@ -3,9 +3,13 @@ name: "ob-deploy-branch" branch: - "unstable" + - "unstable_db" - "develop" + - "develop_db" - "stage" + - "stage_db" - "master" + - "master_db" jobs: - "ob-deploy-branch-{branch}" diff --git a/pillar/openbook/ansible.sls b/pillar/openbook/ansible.sls index 25d5ba4..aa98e8a 100644 --- a/pillar/openbook/ansible.sls +++ b/pillar/openbook/ansible.sls @@ -195,30 +195,54 @@ ansible: mode: "0644" relative_to_buildroot: True is_template: False - inventory_json__unstable_rb: + inventory_json_unstable_rb: name: inventory_json_unstable.rb source: inventory_json.rb mode: "0755" relative_to_buildroot: True is_template: False - inventory_json__develop_rb: + inventory_json_unstable_db_rb: + name: inventory_json_unstable_db.rb + source: inventory_json.rb + mode: "0755" + relative_to_buildroot: True + is_template: False + inventory_json_develop_rb: name: inventory_json_develop.rb source: inventory_json.rb mode: "0755" relative_to_buildroot: True is_template: False - inventory_json__stage_rb: + inventory_json_develop_db_rb: + name: inventory_json_develop_db.rb + source: inventory_json.rb + mode: "0755" + relative_to_buildroot: True + is_template: False + inventory_json_stage_rb: name: inventory_json_stage.rb source: inventory_json.rb mode: "0755" relative_to_buildroot: True is_template: False - inventory_json__master_rb: + inventory_json_stage_db_rb: + name: inventory_json_stage_db.rb + source: inventory_json.rb + mode: "0755" + relative_to_buildroot: True + is_template: False + inventory_json_master_rb: name: inventory_json_master.rb source: inventory_json.rb mode: "0755" relative_to_buildroot: True is_template: False + inventory_json_master_db_rb: + name: inventory_json_master_db.rb + source: inventory_json.rb + mode: "0755" + relative_to_buildroot: True + is_template: False ob_deploy_branch_sh: name: ob-deploy-branch.sh source: ob-deploy-branch.sh diff --git a/salt/openbook/ansible/files/inventory_json.rb b/salt/openbook/ansible/files/inventory_json.rb index e4a5938..4a41f97 100644 --- a/salt/openbook/ansible/files/inventory_json.rb +++ b/salt/openbook/ansible/files/inventory_json.rb @@ -10,7 +10,7 @@ def doit() exit(1) end environ = "" - ["unstable", "develop", "stage", "master"].each do |env| + ["unstable_db", "unstable", "develop_db", "develop", "stage_db", "stage", "master_db", "master"].each do |env| if File.basename($0).include?(env) environ = env break diff --git a/salt/openbook/ci/files/openbookctl b/salt/openbook/ci/files/openbookctl index 6a8aa5e..0296882 100644 --- a/salt/openbook/ci/files/openbookctl +++ b/salt/openbook/ci/files/openbookctl @@ -9,7 +9,7 @@ wait_for_database() { echo "Waiting for database to start..." started=1 for i in {120..0}; do - if echo 'SELECT 1' | mysql -h 127.0.0.1 -u root --password='{% raw %}{{ openbook_database_password }}{% endraw %}' &>/dev/null; then + if echo 'SELECT 1' | mysql -h {% raw %}{{ ansible_default_ipv4.address }}{% endraw %} -u root --password='{% raw %}{{ openbook_database_password }}{% endraw %}' &>/dev/null; then started=0 break fi @@ -22,9 +22,9 @@ wait_for_database() { } ensure_openbook_databases_created() { - if ! echo "SHOW DATABASES;" | mysql -h 127.0.0.1 -u root --password='{% raw %}{{ openbook_database_password }}{% endraw %}' 2>/dev/null | fgrep 'openbook'; then + if ! echo "SHOW DATABASES;" | mysql -h {% raw %}{{ ansible_default_ipv4.address }}{% endraw %} -u root --password='{% raw %}{{ openbook_database_password }}{% endraw %}' 2>/dev/null | fgrep 'openbook'; then echo "Creating Openbook schema..." - mysql -h 127.0.0.1 -u root --password='{% raw %}{{ openbook_database_password }}{% endraw %}' &>/dev/null < {{ pillar["database"]["files"]["create_openbook_schemas"]["path"] }}/{{ pillar["database"]["files"]["create_openbook_schemas"]["name"] }} + mysql -h {% raw %}{{ ansible_default_ipv4.address }}{% endraw %} -u root --password='{% raw %}{{ openbook_database_password }}{% endraw %}' &>/dev/null < {{ pillar["database"]["files"]["create_openbook_schemas"]["path"] }}/{{ pillar["database"]["files"]["create_openbook_schemas"]["name"] }} fi } {% raw %}{% endif %}{% endraw %} -- cgit v1.3