Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion dist/obs-server.spec
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,15 @@ BuildRequires: perl-XML-Structured

BuildRequires: %{rubygem hana}
BuildRequires: %{rubygem json_refs}
# Native extensions in the bundled gems need Ruby headers
# Native extensions in the bundled gems need Ruby headers
BuildRequires: ruby3.4-devel

# Needed for native Ruby gems during build
BuildRequires: libyaml-devel
BuildRequires: gcc-c++
BuildRequires: libxml2-devel
BuildRequires: mariadb-devel
Comment on lines +177 to +185
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you are getting carried away... You don't need to tinker with the spec files or upgrading gems to keep the 'unresolvable' pop-up visible...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clarification — I understand now.
I’ll revert the spec/build dependency changes and keep the fix strictly focused on the frontend UI behavior of the unresolvable pop-up.

# /for the resolve_swagger_yaml.rb script
PreReq: /usr/sbin/useradd /usr/sbin/groupadd
BuildArch: noarch
Expand Down Expand Up @@ -476,7 +485,8 @@ OBS_RUBY_ABI_VERSION=%{__obs_ruby_abi_version}
EOF

pushd src/api
bundle config set path %_libdir/obs-api/
mkdir -p %{buildroot}%_libdir/obs-api/
bundle config set path %{buildroot}%_libdir/obs-api/

bundle install --local
rm -rf vendor/cache/* vendor/cache.next/*
Expand Down
2 changes: 1 addition & 1 deletion src/api/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ GEM
pundit (2.5.2)
activesupport (>= 3.0.0)
racc (1.8.1)
rack (2.2.20)
rack (2.2.21)
rack-protection (3.2.0)
base64 (>= 0.1.0)
rack (~> 2.2, >= 2.2.4)
Expand Down
7 changes: 5 additions & 2 deletions src/api/app/assets/javascripts/webui/project_monitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,14 @@ function setupProjectMonitor() {
$('#table-spinner').removeClass('d-none');
});

var popoverSelector = '#project-monitor-table [data-bs-toggle="popover"]';
var popoverOptions = { trigger: 'click' };

$('#project-monitor-table').on('draw.dt', function () {
initializePopovers('[data-bs-toggle="popover"]');
initializePopovers(popoverSelector, popoverOptions);
});

initializePopovers('[data-bs-toggle="popover"]');
initializePopovers(popoverSelector, popoverOptions);

$('.monitor-no-filter-link').on('click', { checked: false }, setAllLinks);

Expand Down
24 changes: 24 additions & 0 deletions src/api/app/controllers/webui/workers_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
class Webui::WorkersController < Webui::WebuiController
def show
@architecture = params.require(:arch)
@worker_id = params.require(:worker_id)
@worker_label = "#{@architecture}:#{@worker_id}"

capability_xml = Backend::Api::Worker.capability(@worker_label)
capability_hash = Hash.from_xml(capability_xml).fetch('worker', {})

@capability = capability_hash
@linux_info = capability_hash.fetch('linux', {}) || {}
hardware = capability_hash.fetch('hardware', {}) || {}
cpu_info = hardware.fetch('cpu', {}) || {}
@cpu_flags = Array(cpu_info['flag']).compact
@hardware_info = hardware.except('cpu')
rescue Backend::NotFoundError
flash[:error] = _('Worker not found')
redirect_to monitor_path
rescue Backend::Error => e
flash[:error] = e.message
redirect_to monitor_path
end
end

12 changes: 12 additions & 0 deletions src/api/app/lib/backend/api/worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ def self.status
http_get('/build/_workerstatus')
end

# Returns the capabilities of a given worker
# @return [String]
def self.capability(worker)
http_get(['/worker/:worker', worker])
end

# Helper to query capabilities by architecture and worker id (hostname:slot)
# @return [String]
def self.capability_for(architecture, worker_id)
capability("#{architecture}:#{worker_id}")
end

# Returns the workers which can build given constraints filters
# @return [String]
def self.check_constraints(params, constraints_filters)
Expand Down
3 changes: 3 additions & 0 deletions src/api/app/views/webui/monitor/_workers_table.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
- hash.each do |subid, id|
- if subid != '_arch'
.monitorpb.position-relative.mt-1{ id: "p#{id}" }
.d-flex.justify-content-between.align-items-center.mb-1
%span.text-muted.small Worker #{subid}
= link_to('Capabilities', monitor_worker_path(arch: hash['_arch'], worker_id: "#{name}:#{subid}"), class: 'small')
.progress
.progress-bar.progress-bar-striped{ 'aria-valuemax' => '100', 'aria-valuemin' => '0',
'role' => 'progressbar' }
Expand Down
59 changes: 59 additions & 0 deletions src/api/app/views/webui/workers/show.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
- @pagetitle = "Worker #{@worker_label}"

%h2.mb-3
Worker Capabilities
%small.text-muted.ms-2= @capability['workerid'] || @worker_label

.card.mb-3
.card-body
%dl.row.mb-0
%dt.col-sm-3 Worker ID
%dd.col-sm-9= @capability['workerid'] || @worker_label

%dt.col-sm-3 Architecture
%dd.col-sm-9= @capability['hostarch'] || @architecture

- if @capability['registerserver']
%dt.col-sm-3 Register Server
%dd.col-sm-9= @capability['registerserver']

- if @capability['hostlabel']
%dt.col-sm-3 Host Label
%dd.col-sm-9= @capability['hostlabel']

- if @capability['sandbox']
%dt.col-sm-3 Sandbox
%dd.col-sm-9= @capability['sandbox']

- if @linux_info.present?
.card.mb-3
.card-header
%h5.mb-0 Linux
.card-body
%dl.row.mb-0
- if @linux_info['version']
%dt.col-sm-3 Version
%dd.col-sm-9= @linux_info['version']
- if @linux_info['flavor']
%dt.col-sm-3 Flavor
%dd.col-sm-9= @linux_info['flavor']

- if @hardware_info.present? || @cpu_flags.present?
.card
.card-header
%h5.mb-0 Hardware
.card-body
%dl.row.mb-0
- if @hardware_info['processors']
%dt.col-sm-3 Processors
%dd.col-sm-9= @hardware_info['processors']
- if @hardware_info['jobs']
%dt.col-sm-3 Jobs
%dd.col-sm-9= @hardware_info['jobs']
- if @cpu_flags.present?
%hr
%h6 CPU Flags
%ul
- @cpu_flags.each do |flag|
%li= flag

4 changes: 4 additions & 0 deletions src/api/config/routes/webui.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@
get 'monitor/events' => :events, as: :monitor_events
end

controller 'webui/workers' do
get 'monitor/workers/:arch/:worker_id' => :show, as: :monitor_worker
end

resources :package, only: [:index], controller: 'webui/package', constraints: cons

controller 'webui/packages/build_log' do
Expand Down
6 changes: 6 additions & 0 deletions src/api/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added src/api/vendor/cache/rack-2.2.21.gem
Binary file not shown.