parent
e130c96cb2
commit
f2cf4d01a9
9 changed files with 225 additions and 30 deletions
7
.gitignore
vendored
7
.gitignore
vendored
|
@ -7,4 +7,9 @@
|
||||||
/config.yml
|
/config.yml
|
||||||
/transcripts
|
/transcripts
|
||||||
/Linux-x64
|
/Linux-x64
|
||||||
/Windows-x64
|
/Windows-x64
|
||||||
|
|
||||||
|
Folder.DotSettings.user
|
||||||
|
|
||||||
|
packaging/rpmbuild-nightly/
|
||||||
|
packaging/rpmbuild/
|
110
Jenkinsfile
vendored
110
Jenkinsfile
vendored
|
@ -1,41 +1,95 @@
|
||||||
pipeline {
|
pipeline
|
||||||
|
{
|
||||||
agent any
|
agent any
|
||||||
stages {
|
stages
|
||||||
stage('Setup Dependencies') {
|
{
|
||||||
steps {
|
stage('Setup Dependencies')
|
||||||
|
{
|
||||||
|
steps
|
||||||
|
{
|
||||||
sh 'dotnet restore'
|
sh 'dotnet restore'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Build') {
|
stage('Build')
|
||||||
parallel {
|
{
|
||||||
stage('Linux') {
|
parallel
|
||||||
steps {
|
{
|
||||||
sh 'dotnet publish -r linux-x64 -c Release -p:PublishTrimmed=true --self-contained true --no-restore --output Linux-x64/'
|
stage('Linux')
|
||||||
sh 'mv Linux-x64/SupportChild Linux-x64/SupportChild-SC'
|
{
|
||||||
sh 'dotnet publish -r linux-x64 -c Release --self-contained false --no-restore --output Linux-x64/'
|
steps
|
||||||
|
{
|
||||||
|
sh 'dotnet publish -r linux-x64 -c Release -p:PublishTrimmed=true --self-contained true --no-restore --output linux-x64/'
|
||||||
|
sh 'mv linux-x64/supportchild linux-x64/supportchild-sc'
|
||||||
|
sh 'dotnet publish -r linux-x64 -c Release --self-contained false --no-restore --output linux-x64/'
|
||||||
|
archiveArtifacts(artifacts: 'linux-x64/supportchild', caseSensitive: true)
|
||||||
|
archiveArtifacts(artifacts: 'linux-x64/supportchild-sc', caseSensitive: true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Windows') {
|
stage('Windows')
|
||||||
steps {
|
{
|
||||||
sh 'dotnet publish -r win-x64 -c Release -p:PublishTrimmed=true --self-contained true --no-restore --output Windows-x64/'
|
steps
|
||||||
sh 'mv Windows-x64/SupportChild.exe Windows-x64/SupportChild-SC.exe'
|
{
|
||||||
sh 'dotnet publish -r win-x64 -c Release --self-contained false --no-restore --output Windows-x64/'
|
sh 'dotnet publish -r win-x64 -c Release -p:PublishTrimmed=true --self-contained true --no-restore --output windows-x64/'
|
||||||
|
sh 'mv windows-x64/supportchild.exe windows-x64/supportchild-sc.exe'
|
||||||
|
sh 'dotnet publish -r win-x64 -c Release --self-contained false --no-restore --output windows-x64/'
|
||||||
|
archiveArtifacts(artifacts: 'windows-x64/supportchild.exe', caseSensitive: true)
|
||||||
|
archiveArtifacts(artifacts: 'windows-x64/supportchild-sc.exe', caseSensitive: true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
stage('RHEL9')
|
||||||
}
|
{
|
||||||
stage('Archive') {
|
agent
|
||||||
parallel {
|
{
|
||||||
stage('Linux') {
|
dockerfile
|
||||||
steps {
|
{
|
||||||
archiveArtifacts(artifacts: 'Linux-x64/SupportChild', caseSensitive: true)
|
filename 'packaging/RHEL9.Dockerfile'
|
||||||
archiveArtifacts(artifacts: 'Linux-x64/SupportChild-SC', caseSensitive: true)
|
}
|
||||||
|
}
|
||||||
|
environment
|
||||||
|
{
|
||||||
|
DOTNET_CLI_HOME = "/tmp/.dotnet"
|
||||||
|
}
|
||||||
|
when
|
||||||
|
{
|
||||||
|
expression
|
||||||
|
{
|
||||||
|
return env.BRANCH_NAME == 'main' || env.BRANCH_NAME == 'beta' || env.BRANCH_NAME == 'jenkins-testing';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
steps
|
||||||
|
{
|
||||||
|
sh 'rpmbuild -bb packaging/supportchild-nightly.spec --define "_topdir $PWD/.rpmbuild-el9"'
|
||||||
|
sh 'mkdir linux-x64'
|
||||||
|
sh 'cp .rpmbuild-el9/RPMS/x86_64/supportchild-nightly-*.el9.x86_64.rpm linux-x64/'
|
||||||
|
archiveArtifacts(artifacts: 'linux-x64/supportchild-nightly-*.el9.x86_64.rpm', caseSensitive: true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Windows') {
|
stage('RHEL8')
|
||||||
steps {
|
{
|
||||||
archiveArtifacts(artifacts: 'Windows-x64/SupportChild.exe', caseSensitive: true)
|
agent
|
||||||
archiveArtifacts(artifacts: 'Windows-x64/SupportChild-SC.exe', caseSensitive: true)
|
{
|
||||||
|
dockerfile
|
||||||
|
{
|
||||||
|
filename 'packaging/RHEL8.Dockerfile'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
environment
|
||||||
|
{
|
||||||
|
DOTNET_CLI_HOME = "/tmp/.dotnet"
|
||||||
|
}
|
||||||
|
when
|
||||||
|
{
|
||||||
|
expression
|
||||||
|
{
|
||||||
|
return env.BRANCH_NAME == 'main' || env.BRANCH_NAME == 'beta' || env.BRANCH_NAME == 'jenkins-testing';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
steps
|
||||||
|
{
|
||||||
|
sh 'rpmbuild -bb packaging/supportchild-nightly.spec --define "_topdir $PWD/.rpmbuild-el8"'
|
||||||
|
sh 'mkdir linux-x64'
|
||||||
|
sh 'cp .rpmbuild-el8/RPMS/x86_64/supportchild-nightly-*.el8.x86_64.rpm linux-x64/'
|
||||||
|
archiveArtifacts(artifacts: 'linux-x64/supportchild-nightly-*.el8.x86_64.rpm', caseSensitive: true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
<Version>4.0.1</Version>
|
<Version>4.0.1</Version>
|
||||||
<ApplicationIcon>ellie_icon.ico</ApplicationIcon>
|
<ApplicationIcon>ellie_icon.ico</ApplicationIcon>
|
||||||
<TargetFramework>net9.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
|
<AssemblyName>supportchild</AssemblyName>
|
||||||
<StartupObject>SupportChild.SupportChild</StartupObject>
|
<StartupObject>SupportChild.SupportChild</StartupObject>
|
||||||
<RuntimeIdentifiers>win-x64;linux-x64</RuntimeIdentifiers>
|
<RuntimeIdentifiers>win-x64;linux-x64</RuntimeIdentifiers>
|
||||||
<PublishSingleFile>true</PublishSingleFile>
|
<PublishSingleFile>true</PublishSingleFile>
|
||||||
|
|
|
@ -4,6 +4,7 @@ using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using DSharpPlus.Entities;
|
using DSharpPlus.Entities;
|
||||||
|
|
||||||
|
@ -102,7 +103,7 @@ public static class Utilities
|
||||||
throw new InvalidOperationException("Could not load manifest resource stream.");
|
throw new InvalidOperationException("Could not load manifest resource stream.");
|
||||||
}
|
}
|
||||||
|
|
||||||
using StreamReader reader = new StreamReader(stream);
|
using StreamReader reader = new StreamReader(stream, Encoding.Unicode);
|
||||||
return reader.ReadToEnd();
|
return reader.ReadToEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
packaging/RHEL8.Dockerfile
Normal file
2
packaging/RHEL8.Dockerfile
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
FROM redhat/ubi8:latest
|
||||||
|
RUN dnf install dotnet-sdk-9.0 rpm-build git -y
|
2
packaging/RHEL9.Dockerfile
Normal file
2
packaging/RHEL9.Dockerfile
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
FROM redhat/ubi9:latest
|
||||||
|
RUN dnf install dotnet-sdk-9.0 rpm-build git -y
|
58
packaging/supportchild-nightly.spec
Normal file
58
packaging/supportchild-nightly.spec
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
%global debug_package %{nil}
|
||||||
|
%global repo_root %{_topdir}/..
|
||||||
|
|
||||||
|
Summary: A support ticket Discord bot
|
||||||
|
Name: supportchild-nightly
|
||||||
|
Version: %(sed -ne '/Version/{s/.*<Version>\(.*\)<\/Version>.*/\1/p;q;}' < SupportChild.csproj)
|
||||||
|
Release: %(date "+%%Y%%m%%d%%H%%M%%S")%{?dist}
|
||||||
|
License: GPLv3
|
||||||
|
URL: https://toastielab.dev/toastie-stuff/SupportChild
|
||||||
|
Source: https://toastielab.dev/toastie-stuff/SupportChild/archive/main.zip
|
||||||
|
Packager: Toastie_t0ast
|
||||||
|
|
||||||
|
BuildRequires: systemd-rpm-macros
|
||||||
|
Requires: dotnet-runtime-9.0
|
||||||
|
%{?systemd_requires}
|
||||||
|
|
||||||
|
%description
|
||||||
|
A support ticket Discord bot. Uses a MySQL database for storage of ticket
|
||||||
|
information. Creates formatted HTML ticket transcripts when tickets are closed.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%setup -T -c
|
||||||
|
|
||||||
|
%build
|
||||||
|
dotnet publish %{repo_root}/SupportChild.csproj -p:PublishSingleFile=true -r linux-x64 -c Release --self-contained false --output %{_builddir}/out
|
||||||
|
|
||||||
|
%install
|
||||||
|
%{__install} -d %{buildroot}/usr/bin
|
||||||
|
%{__install} %{_builddir}/out/supportchild %{buildroot}/usr/bin/supportchild
|
||||||
|
# rpmbuild post-processing using the strip command breaks dotnet binaries, remove the executable bit to avoid it
|
||||||
|
chmod 644 %{buildroot}/usr/bin/supportchild
|
||||||
|
|
||||||
|
%{__install} -d %{buildroot}/usr/lib/systemd/system
|
||||||
|
%{__install} %{repo_root}/packaging/supportchild.service %{buildroot}/usr/lib/systemd/system/
|
||||||
|
|
||||||
|
%{__install} -d %{buildroot}/etc/supportchild/
|
||||||
|
%{__install} %{repo_root}/default_config.yml %{buildroot}/etc/supportchild/config.yml
|
||||||
|
|
||||||
|
%pre
|
||||||
|
getent group supportchild > /dev/null || groupadd supportchild
|
||||||
|
getent passwd supportchild > /dev/null || useradd -r -s /sbin/nologin -g supportchild supportchild
|
||||||
|
|
||||||
|
%post
|
||||||
|
%systemd_post supportchild.service
|
||||||
|
|
||||||
|
%preun
|
||||||
|
%systemd_preun supportchild.service
|
||||||
|
|
||||||
|
%postun
|
||||||
|
%systemd_postun_with_restart supportchild.service
|
||||||
|
if [[ "$1" == "0" ]]; then
|
||||||
|
getent passwd supportchild > /dev/null && userdel supportchild
|
||||||
|
fi
|
||||||
|
|
||||||
|
%files
|
||||||
|
%attr(0755,root,root) /usr/bin/supportchild
|
||||||
|
%attr(0644,root,root) /usr/lib/systemd/system/supportchild.service
|
||||||
|
%config %attr(0600, supportchild, supportchild) /etc/supportchild/config.yml
|
14
packaging/supportchild.service
Normal file
14
packaging/supportchild.service
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
[Unit]
|
||||||
|
Description=SupportChild Ticket Discord Bot
|
||||||
|
Documentation=https://toastielab.dev/toastie-stuff/SupportChild
|
||||||
|
After=network.target
|
||||||
|
Wants=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
User=supportchild
|
||||||
|
ExecStart=/usr/bin/supportchild --config /etc/supportchild/config.yml
|
||||||
|
Restart=no
|
||||||
|
Type=exec
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
58
packaging/supportchild.spec
Normal file
58
packaging/supportchild.spec
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
%global debug_package %{nil}
|
||||||
|
%global repo_root %{_topdir}/..
|
||||||
|
|
||||||
|
Summary: A support ticket Discord bot
|
||||||
|
Name: supportchild
|
||||||
|
Version: %(sed -ne '/Version/{s/.*<Version>\(.*\)<\/Version>.*/\1/p;q;}' < SupportChild.csproj)
|
||||||
|
Release: 1%{?dist}
|
||||||
|
License: GPLv3
|
||||||
|
URL: https://toastielab.dev/toastie-stuff/SupportChild
|
||||||
|
Source: https://toastielab.dev/toastie-stuff/SupportChild/archive/main.zip
|
||||||
|
Packager: Toastie_t0ast
|
||||||
|
|
||||||
|
BuildRequires: systemd-rpm-macros
|
||||||
|
Requires: dotnet-runtime-9.0
|
||||||
|
%{?systemd_requires}
|
||||||
|
|
||||||
|
%description
|
||||||
|
A support ticket Discord bot. Uses a MySQL database for storage of ticket
|
||||||
|
information. Creates formatted HTML ticket transcripts when tickets are closed.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%setup -T -c
|
||||||
|
|
||||||
|
%build
|
||||||
|
dotnet publish %{repo_root}/SupportChild.csproj -p:PublishSingleFile=true -r linux-x64 -c Release --self-contained false --output %{_builddir}/out
|
||||||
|
|
||||||
|
%install
|
||||||
|
%{__install} -d %{buildroot}/usr/bin
|
||||||
|
%{__install} %{_builddir}/out/supportchild %{buildroot}/usr/bin/supportchild
|
||||||
|
# rpmbuild post-processing using the strip command breaks dotnet binaries, remove the executable bit to avoid it
|
||||||
|
chmod 644 %{buildroot}/usr/bin/supportchild
|
||||||
|
|
||||||
|
%{__install} -d %{buildroot}/usr/lib/systemd/system
|
||||||
|
%{__install} %{repo_root}/packaging/supportchild.service %{buildroot}/usr/lib/systemd/system/
|
||||||
|
|
||||||
|
%{__install} -d %{buildroot}/etc/supportchild/
|
||||||
|
%{__install} %{repo_root}/default_config.yml %{buildroot}/etc/supportchild/config.yml
|
||||||
|
|
||||||
|
%pre
|
||||||
|
getent group supportchild > /dev/null || groupadd supportchild
|
||||||
|
getent passwd supportchild > /dev/null || useradd -r -s /sbin/nologin -g supportchild supportchild
|
||||||
|
|
||||||
|
%post
|
||||||
|
%systemd_post supportchild.service
|
||||||
|
|
||||||
|
%preun
|
||||||
|
%systemd_preun supportchild.service
|
||||||
|
|
||||||
|
%postun
|
||||||
|
%systemd_postun_with_restart supportchild.service
|
||||||
|
if [[ "$1" == "0" ]]; then
|
||||||
|
getent passwd supportchild > /dev/null && userdel supportchild
|
||||||
|
fi
|
||||||
|
|
||||||
|
%files
|
||||||
|
%attr(0755,root,root) /usr/bin/supportchild
|
||||||
|
%attr(0644,root,root) /usr/lib/systemd/system/supportchild.service
|
||||||
|
%config %attr(0600, supportchild, supportchild) /etc/supportchild/config.yml
|
Loading…
Add table
Reference in a new issue