Skip to content

Commit

Permalink
Merge pull request #28 from rtorrero/rpm-package
Browse files Browse the repository at this point in the history
Rpm package
  • Loading branch information
rtorrero authored Feb 8, 2024
2 parents 4054fd1 + 0c8311f commit 03a60dc
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 19 deletions.
24 changes: 11 additions & 13 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,34 +108,32 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install assets
run: cd assets && npm install
- name: Get mix deps
run: mix local.hex --force && mix deps.clean --all && mix deps.get
- name: configure OSC
- name: Configure OSC
run: |
mkdir -p $HOME/.config/osc
cp /home/osc/.config/osc/oscrc $HOME/.config/osc
/scripts/init_osc_creds.sh
- name: prepare _service file
- name: Prepare _service file
run: |
git config --global --add safe.directory /__w/web/web
VERSION=$(./hack/get_version_from_git.sh)
sed -i 's~%%REVISION%%~'"${REVISION}"'~' $FOLDER/_service && \
sed -i 's~%%REPOSITORY%%~'"${REPOSITORY}"'~' $FOLDER/_service && \
sed -i 's~%%VERSION%%~'"${VERSION}"'~' $FOLDER/_service
- name: checkout and prepare OBS package
- name: Get mix deps & prepare tarball
run: |
mix local.hex --force && mix deps.clean --all && mix deps.get
tar --sort=name --owner=root:0 --group=root:0 --mtime='UTC 1970-01-01' -c deps | gzip -n > deps.tar.gz
- name: Checkout and prepare OBS package
run: |
osc checkout $OBS_PROJECT trento-web -o $OSC_CHECKOUT_DIR
cp $FOLDER/_service $OSC_CHECKOUT_DIR
cp $FOLDER/trento-web.spec $OSC_CHECKOUT_DIR
rm -v $OSC_CHECKOUT_DIR/*.tar.gz
pushd $OSC_CHECKOUT_DIR
osc service manualrun
- name: prepare trento-web.changes file
cp /__w/web/web/deps.tar.gz .
- name: Prepare trento-web.changes file
# The .changes file is updated only in release creation. This current task should be improved
# in order to add the current rolling release notes
if: github.event_name == 'release'
Expand All @@ -144,7 +142,7 @@ jobs:
VERSION=$(./hack/get_version_from_git.sh)
TAG=$(echo $VERSION | cut -f1 -d+)
hack/gh_release_to_obs_changeset.py $REPOSITORY -a shap-staff@suse.de -t $TAG -f $OSC_CHECKOUT_DIR/trento-web.changes
- name: commit changes into OBS
- name: Commit changes into OBS
run: |
pushd $OSC_CHECKOUT_DIR
osc ar
Expand Down
7 changes: 7 additions & 0 deletions packaging/suse/rpm/_service
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
<param name="revision">%%REVISION%%</param>
<param name="exclude">.git</param>
<param name="exclude">.github</param>
<param name="exclude">assets/package-lock.json</param>
<param name="extract">assets/package-lock.json</param>
<param name="versionformat">%%VERSION%%</param>
<param name="filename">trento-web</param>
</service>
Expand All @@ -15,4 +17,9 @@
<param name="file">*.tar</param>
<param name="compression">gz</param>
</service>
<service name="node_modules" mode="manual">
<param name="cpio">node_modules.obscpio</param>
<param name="output">node_modules.spec.inc</param>
<param name="source-offset">10000</param>
</service>
</services>
21 changes: 15 additions & 6 deletions packaging/suse/rpm/trento-web.spec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ Summary: Trento server component
# FIXME: Select a correct license from https://github.com/openSUSE/spec-cleaner#spdx-licenses
License: Apache-2.0
URL: https://github.com/trento-project/web
Source: web.tar.gz
Source: %{name}-%{version}.tar.gz
Source1: deps.tar.gz
Source2: package-lock.json
Source3: node_modules.spec.inc
%include %{_sourcedir}/node_modules.spec.inc
Group: System/Monitoring
BuildRequires: elixir, elixir-hex, npm16, erlang-rebar3, git-core

Expand All @@ -32,11 +36,16 @@ Trento is an open cloud-native web application for SAP Applications administrato
Trento server collects all the data from the agents and exposes a Web UI to monitor, view and expose potential issues it found.

%prep
%autosetup -n web
%autosetup -a1
pushd assets
local-npm-registry %{_sourcedir} install --include=dev --ignore-scripts
popd

%build
npm run tailwind:build --prefix ./assets
npm run build --prefix ./assets
pushd assets
npm run tailwind:build
npm run build
popd
export LANG=en_US.UTF-8
export LANGUAGE=en_US:en
export LC_ALL=en_US.UTF-8
Expand All @@ -51,7 +60,7 @@ mix release
mkdir -p %{buildroot}/usr/lib/trento
cp -a _build/prod/rel/trento %{buildroot}/usr/lib
install -D -m 0644 packaging/suse/rpm/systemd/trento-web.service %{buildroot}%{_unitdir}/trento-web.service
install -D -m 0600 packaging/suse/rpm/systemd/env_trento_web %{buildroot}/etc/trento/env_trento_web
install -D -m 0600 packaging/suse/rpm/systemd/trento-web.example %{buildroot}/etc/trento/trento-web.example

%pre
%service_add_pre trento-web.service
Expand All @@ -69,7 +78,7 @@ install -D -m 0600 packaging/suse/rpm/systemd/env_trento_web %{buildroot}/etc/tr
/usr/lib/trento
%{_unitdir}/trento-web.service
/etc/trento
/etc/trento/env_trento_web
/etc/trento/trento-web.example

%license LICENSE
%doc README.md guides
Expand Down

0 comments on commit 03a60dc

Please sign in to comment.