File headlamp.spec of Package headlamp

#
# spec file for package headlamp
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


Name:           headlamp
Version:        0.23.1
Release:        0
Summary:        Kubernetes web UI that is fully-featured, user-friendly and extensible
License:        Apache-2.0
URL:            https://github.com/headlamp-k8s/headlamp
Source0:        %{name}-%{version}.tar.gz
Source1:        vendor.tar.gz
Source2:        https://raw.githubusercontent.com/headlamp-k8s/headlamp/v%{version}/frontend/package-lock.json#/frontend_package-lock.json
Source3:        https://raw.githubusercontent.com/headlamp-k8s/headlamp/v%{version}/app/package-lock.json#/app_package-lock.json
# node modules
%include  %{_sourcedir}/frontend_node_modules.spec.inc
%include  %{_sourcedir}/app_node_modules.spec.inc
BuildRequires:  local-npm-registry

#
BuildRequires:  go1.22
BuildRequires:  npm
BuildRequires:  yarn
BuildRequires:  make
BuildRequires:  git-core

%description
Headlamp is an easy-to-use and extensible Kubernetes web UI.

Headlamp was created to be a Kubernetes web UI that has the traditional
functionality of other web UIs/dashboards available (i.e. to list and view
resources) as well as other features.

Features
* Vendor independent / generic Kubernetes UI
* Works in-cluster, or locally as a desktop app
* Multi-cluster
* Extensible through plugins
* UI controls reflecting user roles (no deletion/update if not allowed)
* Clean & modern UI
* Cancellable creation/update/deletion operations
* Logs, exec, and resource editor with documentation
* Read-write / interactive (actions based on permissions)

%prep
%autosetup -p 1
tar xf %{SOURCE1} -C ./backend/

rm -rf node_modules
# rm -f package-lock.json
cd frontend
rm -rf node_modules
rm -f package-lock.json
local-npm-registry %_sourcedir install --legacy-peer-deps
cd ..
cd app
rm -rf node_modules
rm -f package-lock.json
local-npm-registry %_sourcedir install --legacy-peer-deps
cd ..

%build

# backend
cd backend
go build \
    -mod=vendor \
    -buildmode=pie \
    -o ./headlamp-server ./cmd
cd ../

export PREFIX=%{_prefix}
# frontend
cd frontend
sed -i '/build/ s/max_old_space_size=768.*$/max_old_space_size=768",/' package.json
npm run build
cd ..

cd app
npm run package -- --linux
cd ..

%install
%make_install

%check
%make_build check

%files
%license COPYING
%doc ChangeLog README

%changelog

openSUSE Build Service is sponsored by