Initial commit

This commit is contained in:
DanyLE 2022-09-20 11:41:59 +02:00
parent b61794f68b
commit 39edc1f2a0
4 changed files with 229 additions and 0 deletions

89
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,89 @@
def build_appimage()
{
sh '''
set -e
set -x
cd $WORKSPACE
[ -d build ] && rm -rf build
mkdir build
for tag in /var/jenkins_home/workspace/nightly-antosaio/build/frontend/*; do
echo "Building for $arch version $tag"
./mkimage.sh $arch $tag
done
'''
}
pipeline{
agent { node{ label'master' }}
options {
// Limit build history with buildDiscarder option:
// daysToKeepStr: history is only kept up to this many days.
// numToKeepStr: only this many build logs are kept.
// artifactDaysToKeepStr: artifacts are only kept up to this many days.
// artifactNumToKeepStr: only this many builds have their artifacts kept.
buildDiscarder(logRotator(numToKeepStr: "1"))
// Enable timestamps in build log console
timestamps()
// Maximum time to run the whole pipeline before canceling it
timeout(time: 3, unit: 'HOURS')
// Use Jenkins ANSI Color Plugin for log console
ansiColor('xterm')
// Limit build concurrency to 1 per branch
disableConcurrentBuilds()
}
stages
{
stage('Build AMD64') {
agent {
docker {
image 'xsangle/ci-tools:latest-amd64'
args '-v /var/jenkins_home/workspace/nightly-antosaio:/var/jenkins_home/workspace/nightly-antosaio'
reuseNode true
}
}
steps {
script{
env.arch = "amd64"
}
build_appimage()
}
}
stage('Build ARM64') {
agent {
docker {
image 'xsangle/ci-tools:latest-arm64'
args '-v /var/jenkins_home/workspace/nightly-antosaio:/var/jenkins_home/workspace/nightly-antosaio'
reuseNode true
}
}
steps {
script{
env.arch = "arm64"
}
build_appimage()
}
}
stage('Build ARM') {
agent {
docker {
image 'xsangle/ci-tools:latest-arm'
args '-v /var/jenkins_home/workspace/nightly-antosaio:/var/jenkins_home/workspace/nightly-antosaio'
reuseNode true
}
}
steps {
script{
env.arch = "arm"
}
build_appimage()
}
}
stage('Archive') {
steps {
script {
archiveArtifacts artifacts: 'build/', fingerprint: true
}
}
}
}
}

51
antd-config.ini Normal file
View File

@ -0,0 +1,51 @@
[SERVER]
plugins=./opt/www/lib/
plugins_ext=.so
database=/opt/www/database
tmpdir=/tmp/
maxcon=500
backlog=5000
workers = 4
max_upload_size = 20000000
gzip_enable = 1
gzip_types = text\/.*,.*\/css.*,.*\/json.*,.*\/javascript.*
[PORT:8888]
htdocs=./opt/www/htdocs
ssl.enable=0
^/os/(.*)$ = /os/router.lua?r=<1>&<query>
[MIMES]
image/bmp=bmp
image/jpeg=jpg,jpeg
text/css=css
text/markdown=md
text/csv=csv
application/pdf=pdf
image/gif=gif
text/html=html,htm,chtml
application/json=json
application/javascript=js
image/png=png
image/x-portable-pixmap=ppm
application/x-rar-compressed=rar
image/tiff=tiff
application/x-tar=tar
text/plain=txt
application/x-font-ttf=ttf
application/xhtml+xml=xhtml
application/xml=xml
application/zip=zip
image/svg+xml=svg
application/vnd.ms-fontobject=eot
application/x-font-woff=woff,woff2
application/x-font-otf=otf
audio/mpeg=mp3,mpeg
[FILEHANDLER]
lua = lua
[AUTOSTART]
plugin = tunnel
plugin = lua

85
mkimg.sh Executable file
View File

@ -0,0 +1,85 @@
#! /bin/bash
set -e
set -x
arch=$1
# download the appimagetools
echo "Downloading the appimage tools"
archname=x86_64
case $arch in
amd64|x86_64)
archname=x86_64
;;
aarch64|arm64)
archname=aarch64
;;
armv7l|arm)
archname=armhf
;;
*)
echo "Unkown architecture"
exit 1
;;
esac
wget -O appimagetool.AppImage https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-$archname.AppImage
chmod +x appimagetool.AppImage
W="/var/jenkins_home/workspace/nightly-antosaio/build/"
[ -d antos.AppDir ] && rm -rf antos.AppDir
[ -z $arch ] && arch=amd64
tag=$2
[ -z $tag ] && tag=latest
echo "Building app image for $arch"
mkdir antos.AppDir
# AppRun
cat << "EOF" >> antos.AppDir/AppRun
#!/bin/sh
set -e
echo "Runing AntOS"
W=$(realpath $1)
B=$(dirname $0)
cd $B
[ ! -d "$W" ] && echo "$W is not a directory" && exit 1
# start antd-tunnel service
[ ! -f "$W/antd-config.ini" ] && cp ./opt/www/antd-config.ini $W/antd-config.ini
[ ! -f "$W/runner.ini" ] && cp ./opt/www/runner.ini $W/runner.ini
export LD_LIBRARY_PATH="$B/usr/lib/"
echo "Runing Antd in $B"
touch /tmp/.antos_pkgcache
./usr/bin/antd $W/antd-config.ini >/dev/null 2>&1 | ( sleep 2 && ./opt/www/bin/runner $W/runner.ini >/dev/null 2>&1 &)
EOF
chmod +x antos.AppDir/AppRun
# desktop file
cat << "EOF" >> antos.AppDir/antos.desktop
[Desktop Entry]
Name=AntOS
Exec=antd
Icon=antos
Type=Application
Categories=Utility;
Terminal=true
EOF
# copy all neccessary file
cp antos.png antos.AppDir
cp -rf $W/backend/$arch/* antos.AppDir/
cp -rf $W/frontend/$tag/* antos.AppDir/
cp antd-config.ini antos.AppDir/opt/www/
cp runner.ini antos.AppDir/opt/www/
ln -sf /tmp/.antos_pkgcache antos.AppDir/opt/www/htdocs/os/packages/packages.json
tree antos.AppDir
./appimagetool.AppImage antos.AppDir build/AntOS_$archname-$tag.AppImage

4
runner.ini Normal file
View File

@ -0,0 +1,4 @@
[vterm]
exec = ./opt/www/bin/vterm
param = /tmp/channels/antd_hotline.sock
debug = 0