Skip to content

Commit

Permalink
Merge pull request #82 from yast/fixes_in_modify
Browse files Browse the repository at this point in the history
Fixes in modify
  • Loading branch information
jreidinger committed Mar 26, 2015
2 parents b75e23c + d5cec27 commit 66bd0de
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 5 deletions.
29 changes: 25 additions & 4 deletions jenkins-tools/yast-jenkins-modify.rb
Expand Up @@ -17,17 +17,38 @@
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"
]

# All jobs on Jenkins have the name "yast-$MODULE-$BRANCH", but ARGV gets just a list of $MODULE
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
10 changes: 10 additions & 0 deletions package/yast2-devtools.changes
@@ -1,3 +1,13 @@
-------------------------------------------------------------------
Thu Mar 26 15:12:57 UTC 2015 - jreidinger@suse.com

- yast-jenkins-modify:
- handle correctly modules that do not have github repo in
yast-{mod} format
- fix used sed to handle correctly oneliner xml
- improve error reporting for quicker detection of problems
- 3.1.30

-------------------------------------------------------------------
Wed Jan 21 13:05:25 UTC 2015 - jreidinger@suse.com

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-devtools.spec
Expand Up @@ -17,7 +17,7 @@


Name: yast2-devtools
Version: 3.1.29
Version: 3.1.30
Release: 0
Url: http://github.com/yast/yast-devtools

Expand Down

0 comments on commit 66bd0de

Please sign in to comment.