Skip to content

Commit

Permalink
changes from review
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Oct 1, 2014
1 parent faaa59d commit a1df06a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
8 changes: 4 additions & 4 deletions jenkins-tools/yast-jenkins-create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@
conf = YAML.load(File.read("jenkins.yml"))
USER = conf["user"]
PWD = conf["pwd"]
URL = "https://#{USER}:#{PWD}@ci.opensuse.org"
#URL = "http://river.suse.de"
URL_BASE = "https://#{USER}:#{PWD}@ci.opensuse.org"
#URL_BASE = "http://river.suse.de"

# %s is replaced by arguments passed to program
JOB_NAME_PATTERN = "yast-%s-master"

ARGV.each do |mod|
#test if module already exist
response_code = `curl -sL -w "%{http_code}" #{URL}/job/#{JOB_NAME_PATTERN % mod}/ -o /dev/null`
response_code = `curl -sL -w "%{http_code}" #{URL_BASE}/job/#{JOB_NAME_PATTERN % mod}/ -o /dev/null`
next if response_code == "200"

FileUtils.rm_f "config.xml.tmp"
# now modify config.xml to fit given module
`sed 's/yast-.*\.git/yast-#{mod}.git/' config.xml > config.xml.tmp`

# adress found from https://ci.opensuse.org/api
res = `curl -X POST #{URL}/createItem?name=#{JOB_NAME_PATTERN % mod} --header "Content-Type:application/xml" -d @config.xml.tmp`
res = `curl -X POST #{URL_BASE}/createItem?name=#{JOB_NAME_PATTERN % mod} --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/
end
6 changes: 3 additions & 3 deletions jenkins-tools/yast-jenkins-delete.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
conf = YAML.load(File.read("jenkins.yml"))
USER = conf["user"]
PWD = conf["pwd"]
URL = "https://#{USER}:#{PWD}@ci.opensuse.org"
#URL = "http://river.suse.de"
URL_BASE = "https://#{USER}:#{PWD}@ci.opensuse.org"
#URL_BASE = "http://river.suse.de"
# %s is replaced by arguments passed to program
JOB_NAME_PATTERN = "yast-%s-test"

ARGV.each do |mod|
# address to delete from http://jenkins-ci.361315.n4.nabble.com/Deleting-a-job-through-the-Remote-API-td3622851.html
`curl -X POST #{URL}/job/#{JOB_NAME_PATTERN % mod}/doDelete`
`curl -X POST #{URL_BASE}/job/#{JOB_NAME_PATTERN % mod}/doDelete`
end
9 changes: 4 additions & 5 deletions jenkins-tools/yast-jenkins-modify.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,20 @@
# %s is replaced by arguments passed to program
JOB_NAME_PATTERN = "yast-%s-master"

URL = "https://#{USER}:#{PWD}@ci.opensuse.org"
#URL = "http://river.suse.de"
URL_BASE = "https://#{USER}:#{PWD}@ci.opensuse.org"
#URL_BASE = "http://river.suse.de"

ARGV.each do |mod|
#test if module already exist
#response_code = `curl -sL -w "%{http_code}" https://#{USER}:#{PWD}@ci.opensuse.org/job/yast-#{mod}-master/ -o /dev/null`
response_code = `curl -sL -w "%{http_code}" #{URL}/job/yast-#{mod}-master/ -o /dev/null`
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"
# now modify config.xml to fit given module
`sed 's/yast-.*\.git/yast-#{mod}.git/' config.xml > config.xml.tmp`

# adress found from https://ci.opensuse.org/api
res = `curl -X POST #{URL}/job/#{JOB_NAME_PATTERN % mod}/config.xml --header "Content-Type:application/xml" -d @config.xml.tmp`
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/
end

0 comments on commit a1df06a

Please sign in to comment.