sct/lib/sct/commands/databasepull.rb in sct-1.0.9 vs sct/lib/sct/commands/databasepull.rb in sct-1.1.0

- old
+ new

@@ -21,17 +21,30 @@ private_token = ENV['CI_PRIVATE_TOKEN'] if not private_token error "Private token not set" end - if options.proactive_frame - UI.important("Requesting to pull database for proactive frame") - process_request = `curl -X POST -F token=#{private_token} -F ref=master -F variables[DB_PULL_FRAME]=true -F variables[REMOTE_BRANCH_NAME]=#{branch} #{pipeline_endpoint}` - end - - if options.proactive_config - UI.important("Requesting to pull database for proactive config") - process_request = `curl -X POST -F token=#{private_token} -F ref=master -F variables[DB_PULL_CONFIG]=true -F variables[REMOTE_BRANCH_NAME]=#{branch} #{pipeline_endpoint}` + if options.all + UI.important("Requesting to pull database changes for proactive frame and proactive config") + process_request = `curl -X POST -F token=#{private_token} -F ref=master -F variables[DB_PULL_FRAME]=true -F variables[DB_PULL_CONFIG]=true -F variables[REMOTE_BRANCH_NAME]=#{branch} #{pipeline_endpoint}` + else + db_pull_frame = "" + if options.proactive_frame + UI.important("Requesting to pull database for proactive frame") + db_pull_frame = "-F variables[DB_PULL_FRAME]=true" + end + + db_pull_config = "" + if options.proactive_config + UI.important("Requesting to pull database for proactive config") + db_pull_config = "-F variables[DB_PULL_CONFIG]=true" + end + + if db_pull_frame != "" or db_pull_config != "" + process_request = `curl -X POST -F token=#{private_token} -F ref=master #{db_pull_frame} #{db_pull_config} -F variables[REMOTE_BRANCH_NAME]=#{branch} #{pipeline_endpoint}` + else + error "Missing options. Use --help to see the available options" + end end end end end