Skip to content

Commit

Permalink
[api] log release actions in target project history
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianschroeter committed Jan 24, 2012
1 parent e18f7cf commit 591268a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/api/app/controllers/request_controller.rb
Expand Up @@ -1348,6 +1348,7 @@ def command_changestate
acceptTimeStamp = Time.now.utc.strftime "%Y-%m-%d %H:%M:%S"
# all maintenance_incident actions go into the same incident project
incident_project = nil
projectCommit = {}

# use the request description as comments for history
params[:comment] = req.value(:description)
Expand Down Expand Up @@ -1541,6 +1542,7 @@ def command_changestate
pkg = DbPackage.get_by_project_and_name(action.source.project, action.source.package)
#FIXME2.5: support limiters to specified repositories
release_package(pkg, action.target.project, action.target.package, action.source.rev, nil, nil, acceptTimeStamp, req)
projectCommit[action.target.project] = action.source.project
end

# general source cleanup, used in submit and maintenance_incident actions
Expand Down Expand Up @@ -1573,6 +1575,21 @@ def command_changestate
update_product_autopackages action.target.project
end
end

# log release events once in target project
projectCommit.each do |tprj, sprj|
commit_params = {
:cmd => "commit",
:user => @http_user.login,
:requestid => params[:id],
:rev => "latest",
:comment => "Release from project: " + sprj
}
commit_path = "/source/#{URI.escape(tprj)}/_project"
commit_path << build_query_from_hash(commit_params, [:cmd, :user, :comment, :requestid, :rev])
Suse::Backend.post commit_path, nil
end

pass_to_backend path
end
end
3 changes: 3 additions & 0 deletions src/api/test/functional/maintenance_test.rb
Expand Up @@ -849,6 +849,9 @@ def test_create_maintenance_project_and_release_packages
get "/build/BaseDistro2.0:LinkedUpdateProject/BaseDistro2LinkedUpdateProject_repo/i586/_repository"
assert_response :success
assert_tag :parent => { :tag => "binarylist" }, :tag => 'binary', :attributes => { :filename => "package.rpm" }
get "/source/BaseDistro2.0:LinkedUpdateProject/_project/_history"
assert_response :success
assert_tag :parent => { :tag => "revision" }, :tag => 'comment', :content => "Release from project: My:Maintenance:#{incidentID}"

# no maintenance trigger exists anymore
get "/source/#{maintenanceProject}/_meta"
Expand Down

0 comments on commit 591268a

Please sign in to comment.