-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Move container building files to separate directory * Add RPM building capabilities * Add CI steps to build RPM on OBS * Conditionally add premium checks
- Loading branch information
Showing
8 changed files
with
197 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -401,7 +401,7 @@ jobs: | |
publish_dir: ./doc | ||
|
||
obs-commit: | ||
name: Commit the project on OBS | ||
name: Commit the container image on OBS | ||
runs-on: ubuntu-20.04 | ||
if: github.event_name == 'release' || (github.event_name == 'push' && github.ref_name == 'main') || github.event_name == 'workflow_dispatch' | ||
needs: [static-code-analysis, test] | ||
|
@@ -414,7 +414,7 @@ jobs: | |
OBS_USER: ${{ secrets.OBS_USER }} | ||
OBS_PASS: ${{ secrets.OBS_PASS }} | ||
OBS_PROJECT: ${{ secrets.OBS_PROJECT }} | ||
FOLDER: packaging/suse | ||
FOLDER: packaging/suse/container | ||
REPOSITORY: ${{ github.repository }} | ||
options: -u 0:0 | ||
steps: | ||
|
@@ -463,13 +463,85 @@ jobs: | |
VERSION=$(./hack/get_version_from_git.sh) | ||
# "+" character is not allowed in OBS dockerfile version strings | ||
VERSION=${VERSION//[+]/-} | ||
sed -i 's~%%VERSION%%~'"${VERSION}"'~' packaging/suse/Dockerfile | ||
sed -i 's~%%VERSION%%~'"${VERSION}"'~' $FOLDER/Dockerfile | ||
- name: Commit on OBS | ||
run: | | ||
OBS_PACKAGE=$OBS_PROJECT/$NAME | ||
osc checkout $OBS_PACKAGE -o $DEST_FOLDER | ||
cp -r packaging/suse/* $DEST_FOLDER | ||
cp -r $FOLDER/* $DEST_FOLDER | ||
tar --transform 's,^./,/wanda/,' -zcvf $DEST_FOLDER/wanda.tar.gz --exclude=./.git ./* | ||
cd $DEST_FOLDER | ||
osc ar | ||
osc commit -m "New development version of $NAME released" | ||
obs-commit-rpm: | ||
name: Commit the RPM package on OBS | ||
needs: [static-code-analysis, test] | ||
runs-on: ubuntu-20.04 | ||
if: github.event_name == 'release' || (github.event_name == 'push' && github.ref_name == 'main') || github.event_name == 'workflow_dispatch' | ||
container: | ||
image: ghcr.io/trento-project/continuous-delivery:main | ||
env: | ||
OBS_USER: ${{ secrets.OBS_USER }} | ||
OBS_PASS: ${{ secrets.OBS_PASS }} | ||
OBS_PROJECT: ${{ secrets.OBS_PROJECT }} | ||
OSC_CHECKOUT_DIR: /tmp/trento-wanda-package | ||
REPOSITORY: ${{ github.repository }} | ||
FOLDER: packaging/suse/rpm | ||
options: -u 0:0 | ||
steps: | ||
- name: Cancel Previous Runs | ||
uses: styfle/[email protected] | ||
with: | ||
access_token: ${{ github.token }} | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- 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 | ||
run: | | ||
git config --global --add safe.directory /__w/wanda/wanda | ||
VERSION=$(./hack/get_version_from_git.sh) | ||
sed -i 's~%%REVISION%%~${{ github.sha }}~' $FOLDER/_service && \ | ||
sed -i 's~%%REPOSITORY%%~'"${REPOSITORY}"'~' $FOLDER/_service && \ | ||
sed -i 's~%%VERSION%%~'"${VERSION}"'~' $FOLDER/_service | ||
- name: Setup rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: 1.66 | ||
- name: Get mix deps | ||
run: mix local.hex --force && mix deps.clean --all && mix deps.get | ||
- name: Cargo vendor | ||
run: | | ||
cd deps/rhai_rustler/native/rhai_rustler | ||
cargo vendor | ||
printf '\n\n[source.crates-io]\nreplace-with = "vendored-sources"\n\n[source.vendored-sources]\ndirectory = "vendor"\n' >> .cargo/config | ||
- name: Create deps tarball | ||
run: tar -c deps | gzip -n > deps.tar.gz | ||
- name: Checkout and prepare OBS package | ||
run: | | ||
osc checkout $OBS_PROJECT trento-wanda -o $OSC_CHECKOUT_DIR | ||
cp $FOLDER/_service $OSC_CHECKOUT_DIR | ||
cp $FOLDER/trento-wanda.spec $OSC_CHECKOUT_DIR | ||
rm -vf $OSC_CHECKOUT_DIR/*.tar.gz | ||
pushd $OSC_CHECKOUT_DIR | ||
osc service manualrun | ||
cp /__w/wanda/wanda/deps.tar.gz . | ||
- name: Prepare trento-wanda.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' | ||
run: | | ||
git config --global --add safe.directory /__w/wanda/wanda | ||
VERSION=$(./hack/get_version_from_git.sh) | ||
TAG=$(echo $VERSION | cut -f1 -d+) | ||
hack/gh_release_to_obs_changeset.py $REPOSITORY -a [email protected] -t $TAG -f $OSC_CHECKOUT_DIR/trento-wanda.changes | ||
- name: Commit changes into OBS | ||
run: | | ||
pushd $OSC_CHECKOUT_DIR | ||
osc ar | ||
osc commit -m "GitHub Actions automated update to reference ${{ github.sha }}" |
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<services> | ||
<service name="tar_scm" mode="manual"> | ||
<param name="url">https://github.com/%%REPOSITORY%%.git</param> | ||
<param name="scm">git</param> | ||
<param name="revision">%%REVISION%%</param> | ||
<param name="exclude">.git</param> | ||
<param name="exclude">.github</param> | ||
<param name="versionformat">%%VERSION%%</param> | ||
<param name="filename">trento-wanda</param> | ||
</service> | ||
<service name="set_version" mode="manual"> | ||
<param name="file">trento-wanda.spec</param> | ||
</service> | ||
<service name="recompress" mode="manual"> | ||
<param name="file">*.tar</param> | ||
<param name="compression">gz</param> | ||
</service> | ||
</services> |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
CORS_ORIGIN=localhost | ||
SECRET_KEY_BASE=<secret-key-base> | ||
ACCESS_TOKEN_ENC_SECRET=<access-token-enc-secret> | ||
AMQP_URL=amqp://trento_user:trento_user_password@rabbitmq-host/vhost | ||
DATABASE_URL=ecto://wanda_user:wanda_password@postgres-host/wanda |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[Unit] | ||
Description=Trento Wanda service | ||
|
||
[Service] | ||
ExecStart=/usr/lib/wanda/bin/wanda start | ||
ExecStartPre=/usr/lib/wanda/bin/wanda eval 'Wanda.Release.init()' | ||
EnvironmentFile=/etc/trento/trento-wanda | ||
Type=simple | ||
User=root | ||
Restart=on-failure | ||
RestartSec=5 | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
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 |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# | ||
# spec file for package trento-wanda | ||
# | ||
# 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: trento-wanda | ||
Version: 0 | ||
Release: 0 | ||
Summary: Trento wanda component | ||
License: Apache-2.0 | ||
URL: https://github.com/trento-project/wanda | ||
Source: %{name}-%{version}.tar.gz | ||
Source1: deps.tar.gz | ||
Source2: premium-checks.tar.gz | ||
Group: System/Monitoring | ||
BuildRequires: elixir, elixir-hex, erlang-rebar3, git-core, cargo-packaging | ||
|
||
%description | ||
Trento is an open cloud-native web application for SAP Applications administrators. | ||
|
||
Within Trento, Wanda is the service responsible to orchestrate Checks executions on the monitored nodes. | ||
|
||
%prep | ||
%autosetup -a1 | ||
|
||
# Check if premium-checks are present | ||
if [ -f %{SOURCE2} ]; then | ||
tar -xzf %{SOURCE2} | ||
else | ||
echo "Optional premium checks are not available." | ||
tar -cf %{SOURCE2} -T /dev/null | ||
fi | ||
|
||
%build | ||
export LANG=en_US.UTF-8 | ||
export LANGUAGE=en_US:en | ||
export LC_ALL=en_US.UTF-8 | ||
export MIX_ENV=prod | ||
export MIX_HOME=/usr/bin | ||
export MIX_REBAR3=/usr/bin/rebar3 | ||
export MIX_PATH=/usr/lib/elixir/lib/hex/ebin | ||
mix phx.digest | ||
mix release | ||
|
||
%install | ||
mkdir -p %{buildroot}/usr/lib/wanda | ||
cp -a _build/prod/rel/wanda %{buildroot}/usr/lib | ||
install -D -m 0644 packaging/suse/rpm/systemd/trento-wanda.service %{buildroot}%{_unitdir}/trento-wanda.service | ||
install -D -m 0600 packaging/suse/rpm/systemd/trento-wanda.example %{buildroot}/etc/trento/trento-wanda.example | ||
|
||
%pre | ||
%service_add_pre trento-wanda.service | ||
|
||
%post | ||
%service_add_post trento-wanda.service | ||
|
||
%preun | ||
%service_del_preun trento-wanda.service | ||
|
||
%postun | ||
%service_del_postun trento-wanda.service | ||
|
||
%files | ||
/usr/lib/wanda | ||
%{_unitdir}/trento-wanda.service | ||
/etc/trento | ||
/etc/trento/trento-wanda.example | ||
|
||
%license LICENSE | ||
%doc README.md guides | ||
|
||
%changelog |