Skip to content

Commit

Permalink
Merge pull request #131 from Native-Planet/dev
Browse files Browse the repository at this point in the history
v1.0.8
  • Loading branch information
nallux-dozryl authored Feb 15, 2023
2 parents d733e43 + b5d08cd commit f11ce81
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 25 deletions.
88 changes: 68 additions & 20 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,41 +1,89 @@
pipeline {
agent any
environment {
environ = sh (
tag = sh (
script: '''
echo $BRANCH_NAME|sed 's@origin/@@g'
environ=`echo $BRANCH_NAME|sed 's@origin/@@g'`
if [ "${environ}" = "master" ]; then
echo "latest"
elif [ "${environ}" = "dev" ]; then
echo "edge"
else
echo "nobuild"
fi
''',
returnStdout: true
).trim()
}
stages {
stage('Build') {
environment {
tag = sh (
script: '''
if [ "${environ}" = "main" ]; then
echo "latest"
elif [ "${environ}" = "edge" ]; then
echo "edge"
else
echo "nobuild"
fi
''',
returnStdout: true
).trim()
stage('amd64build') {
steps {
script {
if( "${tag}" != "nobuild" ) {
sh '''
echo "debug: building amd64"
mkdir -p /opt/groundseg/version/bin
cd ./build-scripts
docker build --tag nativeplanet/groundseg-builder:3.10.9 .
cd ..
rm -rf /var/jenkins_home/tmp
mkdir -p /var/jenkins_home/tmp
cp -r api /var/jenkins_home/tmp
docker run -v /home/np/np-cicd/jenkins_conf/tmp/binary:/binary -v /home/np/np-cicd/jenkins_conf/tmp/api:/api nativeplanet/groundseg-builder:3.10.9
chmod +x /var/jenkins_home/tmp/binary/groundseg
mv /var/jenkins_home/tmp/binary/groundseg /opt/groundseg/version/bin/groundseg_amd64_${tag}
'''
}
}
}
}
stage('arm64build') {
agent { node { label 'arm' } }
steps {
script {
if( "${tag}" != "nobuild" ) {
sh '''
echo "debug: building arm64"
cd build-scripts
docker build --tag nativeplanet/groundseg-builder:3.10.9 .
cd ..
docker run -v "$(pwd)/binary":/binary -v "$(pwd)/api":/api nativeplanet/groundseg-builder:3.10.9
cd ui
docker buildx build --push --tag nativeplanet/groundseg-webui:${tag} --platform linux/amd64,linux/arm64 .
'''
stash includes: 'binary/groundseg', name: 'groundseg_arm64'
}
}
}
}
stage('postbuild') {
steps {
script {
if( "${tag}" != "nobuild" ){
sh 'echo "debug: post-build actions"'
dir('/opt/groundseg/version/bin/'){
unstash 'groundseg_arm64'
}
sh 'mv /opt/groundseg/version/bin/binary/groundseg /opt/groundseg/version/bin/groundseg_arm64_${tag}'
sh 'rm -rf /opt/groundseg/version/bin/binary/'
}
if( "${tag}" == "latest" ) {
sh 'mv ./release/version.csv /opt/groundseg/version/'
sh 'mv ./release/standard_install.sh /opt/groundseg/get/install.sh'
sh 'mv ./release/groundseg_install.sh /opt/groundseg/get/only.sh'
sh '''
mv ./release/version.csv /opt/groundseg/version/
mv ./release/standard_install.sh /opt/groundseg/get/install.sh
mv ./release/groundseg_install.sh /opt/groundseg/get/only.sh
'''
}
if( "${tag}" == "edge" ) {
sh 'mv ./release/version_edge.csv /opt/groundseg/version/'
}
}
}
}
}
}
post {
always {
cleanWs deleteDirs: true, notFailBuild: true
}
}
}
10 changes: 8 additions & 2 deletions api/groundseg.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import requests
import urllib.request
import nmcli
import platform
import subprocess
import html_templates

Expand Down Expand Up @@ -54,6 +55,11 @@ def check_bin_updates():
Log.log_groundseg(f"Latest version: {new_name}")
Log.log_groundseg("Downloading new groundseg binary")

if platform.machine() == 'x86_64':
dl_url = f"{dl_url}_amd64"
else:
dl_url = f"{dl_url}_arm64"

r = requests.get(dl_url)
f = open(f"{orchestrator.config['CFG_DIR']}/groundseg_new", 'wb')
for chunk in r.iter_content(chunk_size=512 * 1024):
Expand Down Expand Up @@ -251,8 +257,8 @@ def wireguard_refresher():
copied = orchestrator._urbits
for p in list(copied):
if copied[p].running and copied[p].config['network'] != "none":
res = requests.get(f"https://{copied[p].config['wg_url']}")
if res.status_code != 200:
res = requests.get(f"https://{copied[p].config['wg_url']}/~_~/healthz")
if res.status_code == 502:
Log.log_groundseg("Anchor connection is broken. Restarting")
orchestrator.restart_anchor()
break
Expand Down
2 changes: 1 addition & 1 deletion api/orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Orchestrator:
_disk = None

# GroundSeg
gs_version = 'v1.0.7'
gs_version = 'v1.0.8'
_vm = False
_npbox = False
_c2c_mode = False
Expand Down
8 changes: 7 additions & 1 deletion release/groundseg_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ sudo firewall-cmd --reload
ACC=Native-Planet
REPO=GroundSeg
BRANCH=main
TAG=v1.0.7
TAG=v1.0.8
DEVICE_ARCH=$(uname -m)

# Directory to save the scrips
SAVE_DIR=/opt/nativeplanet/groundseg
Expand All @@ -18,8 +19,13 @@ sudo mkdir -p $SAVE_DIR
sudo systemctl stop groundseg

# Download GroundSeg binary
if [[ $DEVICE_ARCH == "aarch64" ]]; then
sudo wget -O $SAVE_DIR/groundseg \
https://github.com/$ACC/$REPO/releases/download/$TAG/groundseg_arm64
elif [[ $DEVICE_ARCH == "x86_64" ]]; then
sudo wget -O $SAVE_DIR/groundseg \
https://github.com/$ACC/$REPO/releases/download/$TAG/groundseg
fi

sudo chmod +x $SAVE_DIR/groundseg

Expand Down
1 change: 1 addition & 0 deletions release/version.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
v1.0.8,24c09a8b94207c5530657960f67d151d311f00d934f21d4748bd3c6256699fb9,https://github.com/Native-Planet/GroundSeg/releases/download/v1.0.7/groundseg
v1.0.7,ca6537e03928107b3cf5f8277e9d3d9427bd30750e0f4378a8b50b725848ccce,https://github.com/Native-Planet/GroundSeg/releases/download/v1.0.7/groundseg
v1.0.6,c690950cc5e0aabd2b62f3f2106c8934b3ce726d961903871af656a301ddeb97,https://github.com/Native-Planet/GroundSeg/releases/download/v1.0.6/groundseg
v1.0.5,53a693f855b3a0d92120bc5f6244e7a2c91b89f9511f9224b99afdb2b7b56fad,https://github.com/Native-Planet/GroundSeg/releases/download/v1.0.5/groundseg
Expand Down
1 change: 1 addition & 0 deletions release/version_edge.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
v1.0.8,24c09a8b94207c5530657960f67d151d311f00d934f21d4748bd3c6256699fb9,https://github.com/Native-Planet/GroundSeg/releases/download/v1.0.7/groundseg
v1.0.7,ca6537e03928107b3cf5f8277e9d3d9427bd30750e0f4378a8b50b725848ccce,https://github.com/Native-Planet/GroundSeg/releases/download/v1.0.7/groundseg
v1.0.6,c690950cc5e0aabd2b62f3f2106c8934b3ce726d961903871af656a301ddeb97,https://github.com/Native-Planet/GroundSeg/releases/download/v1.0.6/groundseg
v1.0.5,53a693f855b3a0d92120bc5f6244e7a2c91b89f9511f9224b99afdb2b7b56fad,https://github.com/Native-Planet/GroundSeg/releases/download/v1.0.5/groundseg
Expand Down
2 changes: 1 addition & 1 deletion ui/src/lib/api.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { writable } from 'svelte/store'

export const webuiVersion = 'v1.0.7'
export const webuiVersion = 'v1.0.8'

//
// fade transition params
Expand Down

0 comments on commit f11ce81

Please sign in to comment.