-
Notifications
You must be signed in to change notification settings - Fork 438
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consider multibuild suffix when retriggering package build through webui
We need to pass the full package name to the backend when retriggering a package build through the webui. Currently we pass the package name of the package object to the backend, which will cause a rebuild of all multibuild flavors. Fixes #11598
- Loading branch information
1 parent
2acf054
commit 428f930
Showing
3 changed files
with
10 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 7 additions & 6 deletions
13
src/api/app/services/package_controller_service/rebuild_trigger.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,32 @@ | ||
module PackageControllerService | ||
class RebuildTrigger | ||
def initialize(options = {}) | ||
@package = options[:package] | ||
@package_object = options[:package_object] | ||
@package_name_with_multibuild_suffix = options[:package_name_with_multibuild_suffix] | ||
@project = options[:project] | ||
@repository = options[:repository] | ||
@arch = options[:arch] | ||
end | ||
|
||
def rebuild? | ||
@package.rebuild(package: @package, project: @project, repository: @repository, arch: @arch) | ||
@package_object.rebuild(package: @package_name_with_multibuild_suffix, project: @project, repository: @repository, arch: @arch) | ||
end | ||
|
||
# When we're in a linked project, the package's project points to some other | ||
# project, not the one we're triggering the build from. | ||
# Here we detect that, and if so, we authorize against the linked project. | ||
def policy_object | ||
return @project if @project != @package.project | ||
return @project if @project != @package_object.project | ||
|
||
@package | ||
@package_object | ||
end | ||
|
||
def success_message | ||
"Triggered rebuild for #{@project.name}/#{@package.name} successfully." | ||
"Triggered rebuild for #{@project.name}/#{@package_name_with_multibuild_suffix} successfully." | ||
end | ||
|
||
def error_message | ||
"Error while triggering rebuild for #{@project.name}/#{@package.name}: #{@package.errors.full_messages.to_sentence}." | ||
"Error while triggering rebuild for #{@project.name}/#{@package_name_with_multibuild_suffix}: #{@package_object.errors.full_messages.to_sentence}." | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters