diff --git a/jenkins-tools/yast-jenkins-modify.rb b/jenkins-tools/yast-jenkins-modify.rb index 332db4a6..895ce526 100755 --- a/jenkins-tools/yast-jenkins-modify.rb +++ b/jenkins-tools/yast-jenkins-modify.rb @@ -17,17 +17,37 @@ URL_BASE = "https://#{USER}:#{PWD}@ci.opensuse.org" #URL_BASE = "http://river.suse.de" +# modules that do not follow yast-{mod} convention +SPECIAL_MOD_NAMES = [ + "skelcd-control-SLES", + "skelcd-control-SLED", + "skelcd-control-openSUSE", + "skelcd-control-openSUSE-LangAddOn", + "skelcd-control-SLES-for-VMware", + "y2r" +] + ARGV.each do |mod| #test if module already exist response_code = `curl -sL -w "%{http_code}" #{URL_BASE}/job/#{JOB_NAME_PATTERN % mod}/ -o /dev/null` raise "module #{mod} do not exists" unless response_code == "200" FileUtils.rm_f "config.xml.tmp" + git_name = SPECIAL_MOD_NAMES.include?(mod) ? mod : "yast-#{mod}" # now modify config.xml to fit given module - `sed 's/yast-.*\.git/yast-#{mod}.git/' config.xml > config.xml.tmp` + `sed 's/yast-[a-z_-]*\.git/#{git_name}.git/' config.xml > config.xml.tmp` # adress found from https://ci.opensuse.org/api - res = `curl -X POST #{URL_BASE}/job/#{JOB_NAME_PATTERN % mod}/config.xml --header "Content-Type:application/xml" -d @config.xml.tmp` - puts "ERROR: #{res}" if $?.exitstatus != 0 - puts "ERROR: Wrong Credentials. \n #{res}" if res =~ /Authentication required/ + cmd = "curl -X POST #{URL_BASE}/job/#{JOB_NAME_PATTERN % mod}/config.xml --header \"Content-Type:application/xml\" -d @config.xml.tmp" + puts "Sending data for module #{git_name} with #{cmd}" + res = `#{cmd}` + puts "ERROR: curl exited with non-zero value" if $?.exitstatus != 0 + puts case res + when "" + "Succeed" + when /Authentication required/ + "ERROR: Wrong Credentials. \n #{res}" + else + "non-standard response: #{res}" + end end