Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update go version to 1.18 and refactor the build process #80

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,7 @@ jobs:
uses: actions/checkout@v2
with:
path: ./src/github.com/${{ github.repository }}
- name: Build
run: go build -v ./...
- name: Test
run: go test ./...
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
module github.com/uyuni-project/hub-xmlrpc-api

go 1.14
go 1.18

require (
github.com/gorilla/rpc v1.2.0
github.com/knadh/koanf v0.10.0
github.com/uyuni-project/xmlrpc-public-methods v0.0.0-20200805144514-2ca831c526d1
github.com/mitchellh/mapstructure v1.2.2
)
53 changes: 53 additions & 0 deletions hub-xmlrpc-api.changes
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
- update go build version to 1.18-openssl

-------------------------------------------------------------------
Thu Sep 29 08:47:14 UTC 2022 - Marina Latini <[email protected]>

- Use golang(API) = 1.18 for building on SUSE (bsc#1203599)
This source fails to build with the current go1.19 on SUSE and we
need to use go1.18 instead.

-------------------------------------------------------------------
Fri Jan 21 20:11:30 UTC 2022 - Stefan Bluhm <[email protected]>

- Updated to build on Enterprise Linux 8.

-------------------------------------------------------------------
Wed Sep 8 08:13:56 UTC 2021 - Ricardo Mateus <[email protected]>

- use rpm systemd macro to restart service in replace of systemctl

-------------------------------------------------------------------
Wed Aug 19 11:34:05 UTC 2020 - Silvio Moioli <[email protected]>

- version 0.7
- one configuration flag was renamed for clarity

-------------------------------------------------------------------
Wed Jul 15 21:13:22 UTC 2020 - Abid Mehmood <[email protected]>

- version 0.6
- Added USE_SSL flag to https insted of plain http
- Updated docs
- Bugfixes

-------------------------------------------------------------------
Thu Jun 18 14:05:19 UTC 2020 - Silvio Moioli <[email protected]>

- version 0.5
- Changed configuration to plain variables
- Bugfixes

-------------------------------------------------------------------
Thu Mar 30 2020 - Abid Mehmood <[email protected]>

- version 0.1.4
- Added systemd unit file for the api
- Refactoring to make code more rebust
- Better error handling in case of problems
- Unit and Integration tests have been added

-------------------------------------------------------------------
Thu Feb 07 2020 - Abid Mehmood <[email protected]>

- Initial commit 0.1.3
153 changes: 153 additions & 0 deletions hub-xmlrpc-api.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
#
# spec file for package hub-xmlrpc-api
#
# Copyright (c) 2020 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/
#

%if 0%{?rhel} == 8
%global debug_package %{nil}
%endif

%if 0%{?rhel}
# Fix ERROR: No build ID note found in
%undefine _missing_build_ids_terminate_build
%endif

%global provider github
%global provider_tld com
%global org uyuni-project
%global project hub-xmlrpc-api
%global provider_prefix %{provider}.%{provider_tld}/%{org}/%{project}

Name: %{project}
Version: 0.8
Release: 0
Summary: XMLRPC API for Hub environments
License: Apache-2.0
Group: Applications/Internet
URL: https://%{provider_prefix}
Source0: %{name}-%{version}.tar.gz
Source1: vendor.tar.gz

%if 0%{?suse_version}
%if 0%{?is_opensuse}
BuildRequires: golang(API) = 1.18
%else
BuildRequires: go1.18-openssl
%endif
%else
BuildRequires: go >= 1.17
%endif
BuildRequires: golang-packaging
BuildRequires: rsyslog
BuildRoot: %{_tmppath}/%{name}-%{version}-build

Requires: logrotate
Requires: rsyslog
Requires: systemd

%description
The Hub XMLRPC API provides an API which allows access to Uyuni functionality in a Server of Serves architecture (Hub)

%prep
%autosetup
tar -zxf %{SOURCE1}

%build
export GOFLAGS=-mod=vendor
%goprep %{provider_prefix}
%gobuild ...

%install
%goinstall


%define _release_dir %{_builddir}/%{project}-%{version}/release

# Service file for hub xmlrpc api
install -D -m 0644 %{_release_dir}/hub-xmlrpc-api.service %{buildroot}%{_unitdir}/hub-xmlrpc-api.service

# Add config files for hub
install -d -m 0750 %{buildroot}%{_sysconfdir}/hub
install -D -m 0644 %{_release_dir}/hub.conf %{buildroot}%{_sysconfdir}/hub
install -d -m 0750 %{buildroot}%{_var}/log/hub

# Add syslog config to redirect logs to /var/log/hub/hub-xmlrpc-api.log
install -D -m 0644 %{_release_dir}/hub-logs.conf %{buildroot}%{_sysconfdir}/rsyslog.d/hub-logs.conf

#logrotate config
install -D -m 0644 %{_release_dir}/logrotate.conf %{buildroot}%{_sysconfdir}/logrotate.d/hub-xmlrpc-api

%check
# Fix OBS debug_package execution.
rm -f %{buildroot}/usr/lib/debug/%{_bindir}/%{name}-%{version}-*.debug

%pre
%if 0%{?suse_version}
%service_add_pre %{name}.service
%endif

%post
%if 0%{?rhel}
%systemd_post %{name}.service
%else
%service_add_post %{name}.service
%endif
if [ $1 == 1 ];then
echo "-----------------------"
echo "### The Hub XMLRPC API does NOT start on installation. You can set it up to start automatically with systemd, by executing the following commands"
echo " sudo systemctl enable hub-xmlrpc-api.service"
echo ""
echo "### You can start Hub XMLRPC API by executing the following command"
echo " sudo systemctl start hub-xmlrpc-api.service"
echo ""
echo " Make sure that '/etc/hub/hub.conf' is pointing to the correct Hub host"
echo " Logs can be viewed at /var/log/hub/hub-xmlrpc-api.log"

%if 0%{?rhel}
%systemd_postun rsyslog.service
%else
%service_del_postun rsyslog.service
%endif
fi

%preun
%if 0%{?rhel}
%systemd_preun %{name}.service
%else
%service_del_preun %{name}.service
%endif

%postun
%if 0%{?rhel}
%systemd_postun %{name}.service
%else
%service_del_postun %{name}.service
%endif

%files

%defattr(-,root,root)
%doc README.md
%{_bindir}/hub-xmlrpc-api

%{_unitdir}/hub-xmlrpc-api.service
%dir %{_sysconfdir}/hub
%dir %{_var}/log/hub

%config(noreplace) %{_sysconfdir}/rsyslog.d/hub-logs.conf
%config(noreplace) %{_sysconfdir}/hub/hub.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/hub-xmlrpc-api

%changelog
1 change: 0 additions & 1 deletion vendor/github.com/gorilla/rpc/.gitignore

This file was deleted.

23 changes: 0 additions & 23 deletions vendor/github.com/gorilla/rpc/.travis.yml

This file was deleted.

27 changes: 0 additions & 27 deletions vendor/github.com/gorilla/rpc/LICENSE

This file was deleted.

7 changes: 0 additions & 7 deletions vendor/github.com/gorilla/rpc/README.md

This file was deleted.

81 changes: 0 additions & 81 deletions vendor/github.com/gorilla/rpc/doc.go

This file was deleted.

Loading