Compare commits

...

13 Commits

Author SHA1 Message Date
f58c7cc6a7 feat: use emissary v2023.4.1-7d551a8
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-04-01 17:34:21 +00:00
95046def13 feat: use emissary v2023.4.1-d02eb91
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-04-01 12:36:55 +00:00
dc26c10bb3 feat: use emissary v2023.4.1-d2bcdd2
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-04-01 11:31:55 +00:00
7fbc1930df chore: display emissary version in release body
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-03-31 17:50:33 +02:00
d65ba3f252 feat: use emissary v2023.3.31-c638fe1
All checks were successful
arcad/emissary-firmware/pipeline/head This commit looks good
2023-03-31 15:35:20 +00:00
b56e563aa0 feat: use emissary v2023.3.31-5fc5f5f
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-03-31 15:20:01 +00:00
2c701ffc16 chore: add jenkins pipeline
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-03-31 17:19:44 +02:00
aa22f3c55b feat: update emissary to v2023.3.29-e5b6c5e 2023-03-29 21:43:31 +02:00
f6c3de68b2 feat: use emissary v2023.3.29-351f22e 2023-03-29 17:45:27 +02:00
1470bea902 chore: filter download emissary artefacts 2023-03-29 16:05:01 +02:00
aa314a939f feat: move all emissary 'data' files to /data 2023-03-29 12:23:28 +02:00
844c5d0e17 chore: allow override of used image in flash script 2023-03-29 12:23:01 +02:00
656081568e feat(turris,omnia): use armv7 arch for emissary binary 2023-03-29 12:22:27 +02:00
10 changed files with 146 additions and 17 deletions

102
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,102 @@
pipeline {
agent {
dockerfile {
filename 'Dockerfile'
dir 'misc/jenkins'
}
}
parameters {
persistentText(name: 'emissaryRelease', defaultValue: 'latest', description: 'Numéro de release Emissary', successfulOnly: false)
}
stages {
stage('Cancel older jobs') {
steps {
script {
def buildNumber = env.BUILD_NUMBER as int
if (buildNumber > 1) milestone(buildNumber - 1)
milestone(buildNumber)
}
}
}
stage('Update emissary release') {
when {
expression {
return params.emissaryRelease != 'latest'
}
}
steps {
script {
currentEmissaryRelease = readFile('emissary_release.txt').trim()
if (currentEmissaryRelease == params.emissaryRelease) {
currentBuild.result = 'SUCCESS'
return
}
withCredentials([
usernamePassword([
credentialsId: 'forge-jenkins',
usernameVariable: 'GIT_USERNAME',
passwordVariable: 'GIT_PASSWORD'
])
]) {
sh """
git config user.email "jenkins@cadoles.com"
git config user.name "Jenkins"
git config credential.https://forge.cadoles.com.username "\$GIT_USERNAME"
git config credential.https://forge.cadoles.com.helper '!f() { test "\$1" = get && echo "password=\$GIT_PASSWORD"; }; f'
echo '${params.emissaryRelease}' > emissary_release.txt
git add emissary_release.txt
git commit -m "feat: use emissary ${params.emissaryRelease}"
git pull --rebase
git push origin \$(git rev-parse HEAD):${env.GIT_BRANCH}
"""
}
}
}
}
stage('Build and release') {
steps {
script {
withCredentials([
usernamePassword([
credentialsId: 'forge-jenkins',
usernameVariable: 'GITEA_DOWNLOAD_USERNAME',
passwordVariable: 'GITEA_DOWNLOAD_PASSWORD'
])
]) {
sh '''
make download-emissary-release
make all
'''
}
}
}
}
stage('Release') {
steps {
withCredentials([
usernamePassword([
credentialsId: 'forge-jenkins',
usernameVariable: 'GITEA_RELEASE_USERNAME',
passwordVariable: 'GITEA_RELEASE_PASSWORD'
])
]) {
sh 'make gitea-release'
}
}
}
}
post {
always {
cleanWs()
}
}
}

View File

@ -22,7 +22,7 @@ IMAGEBUILDER_CUSTOM_FILES_DIR_PATH := $(IMAGEBUILDER_DIR_PATH)/files
BIN_DIR := "$(shell readlink -f bin)/$(OPENWRT_VERSION)/$(OPENWRT_TARGET)/$(OPENWRT_PROFILE)$(BIN_DIR_NAME_SUFFIX)"
GITEA_DOWNLOAD_RELEASE_NAME ?= latest
EMISSARY_RELEASE ?= $(shell cat emissary_release.txt)
EMISSARY_ARCH ?= armv6
EMISSARY_RECONCILIATION_INTERVAL ?=
@ -109,8 +109,8 @@ gitea-release: tools/gitea-release/bin/gitea-release.sh
GITEA_RELEASE_NAME="$(FULL_VERSION)" \
GITEA_RELEASE_COMMITISH_TARGET="$(GIT_VERSION)" \
GITEA_RELEASE_IS_DRAFT="false" \
GITEA_RELEASE_BODY="" \
GITEA_RELEASE_ATTACHMENTS="$(shell find .gitea-release/* -type f)" \
GITEA_RELEASE_BODY="With Emissary $(EMISSARY_RELEASE)" \
GITEA_RELEASE_ATTACHMENTS="$$(find .gitea-release/* -type f)" \
tools/gitea-release/bin/gitea-release.sh
.PHONY: download-emissary-release
@ -119,7 +119,8 @@ download-emissary-release: tools/gitea-download/bin/gitea-download.sh
GITEA_DOWNLOAD_PROJECT="emissary" \
GITEA_DOWNLOAD_ORG="arcad" \
GITEA_DOWNLOAD_BASE_URL="https://forge.cadoles.com" \
GITEA_DOWNLOAD_RELEASE_NAME="$(GITEA_DOWNLOAD_RELEASE_NAME)" \
GITEA_DOWNLOAD_RELEASE_NAME="$(EMISSARY_RELEASE)" \
GITEA_DOWNLOAD_ATTACHMENTS_FILTER="\.tar\.gz$$" \
tools/gitea-download/bin/gitea-download.sh
tools/gitea-release/bin/gitea-release.sh:
@ -142,5 +143,5 @@ UPX_VERSION := 4.0.2
tools/upx/bin/upx:
mkdir -p tools/upx/bin
curl -L --output tools/upx/upx-$(UPX_VERSION)-amd64_linux.tar.xz https://github.com/upx/upx/releases/download/v$(UPX_VERSION)/upx-$(UPX_VERSION)-amd64_linux.tar.xz
cd tools/upx && tar -xJf upx-$(UPX_VERSION)-amd64_linux.tar.xz
ln -s $(shell readlink -f tools/upx/upx-$(UPX_VERSION)-amd64_linux/upx) tools/upx/bin/upx
cd tools/upx && tar -xJf upx-$(UPX_VERSION)-amd64_linux.tar.xz && wait $$!
$(SHELL) -c 'ln -s $$(readlink -f tools/upx/upx-$(UPX_VERSION)-amd64_linux/upx) tools/upx/bin/upx'

1
emissary_release.txt Normal file
View File

@ -0,0 +1 @@
v2023.4.1-7d551a8

View File

@ -12,6 +12,10 @@ install-emissary-files: tools/yq/bin/yq tools/upx/bin/upx
mkdir -p files/lib/upgrade/keep.d
cp -r misc/emissary/keep.d/* files/lib/upgrade/keep.d/
# Copy profile.d files
mkdir -p files/etc/profile.d
cp -r misc/emissary/profile.d/* files/etc/profile.d/
mkdir -p gitea-dl/emissary-agent_linux_$(EMISSARY_ARCH)
cd gitea-dl && tar -xzf emissary-agent_*_linux_$(EMISSARY_ARCH).tar.gz -C emissary-agent_linux_$(EMISSARY_ARCH)
@ -22,9 +26,11 @@ install-emissary-files: tools/yq/bin/yq tools/upx/bin/upx
# Patch agent config
tools/yq/bin/yq -i '.agent.serverUrl = "$${EMISSARY_SERVER_URL}"' files/etc/emissary/agent.yml
tools/yq/bin/yq -i '.agent.reconciliationInterval = "$${EMISSARY_RECONCILIATION_INTERVAL}"' files/etc/emissary/agent.yml
tools/yq/bin/yq -i '.agent.privateKeyPath = "/etc/emissary/agent-key.json"' files/etc/emissary/agent.yml
tools/yq/bin/yq -i '.agent.controllers.persistence.stateFile = "/etc/emissary/agent-state.json"' files/etc/emissary/agent.yml
tools/yq/bin/yq -i '.agent.privateKeyPath = "/data/emissary/agent-key.json"' files/etc/emissary/agent.yml
tools/yq/bin/yq -i '.agent.controllers.persistence.stateFile = "/data/emissary/agent-state.json"' files/etc/emissary/agent.yml
tools/yq/bin/yq -i '.agent.controllers.sysupgrade.firmwareVersionCommand = ["sh", "-c", "source /etc/emissary_firmware && echo \"$$FIRMWARE_VERSION\""]' files/etc/emissary/agent.yml
tools/yq/bin/yq -i '.agent.controllers.app.dataDir = "/data/emissary/apps/data"' files/etc/emissary/agent.yml
tools/yq/bin/yq -i '.agent.controllers.app.downloadDir = "/data/emissary/apps/bundles"' files/etc/emissary/agent.yml
# Copy emissary binary
mkdir -p files/usr/local/bin
@ -32,10 +38,10 @@ install-emissary-files: tools/yq/bin/yq tools/upx/bin/upx
chmod +x files/usr/local/bin/emissary
# Set defaults
mkdir -p files/etc/emissary
rm -rf files/etc/emissary/default.conf
echo "EMISSARY_RECONCILIATION_INTERVAL='$(EMISSARY_RECONCILIATION_INTERVAL)'" > files/etc/emissary/default.conf
echo "EMISSARY_SERVER_URL='$(EMISSARY_SERVER_URL)'" >> files/etc/emissary/default.conf
mkdir -p files/data/emissary
rm -rf files/data/emissary/default.conf
echo "EMISSARY_RECONCILIATION_INTERVAL='$(EMISSARY_RECONCILIATION_INTERVAL)'" > files/data/emissary/default.conf
echo "EMISSARY_SERVER_URL='$(EMISSARY_SERVER_URL)'" >> files/data/emissary/default.conf
# Compress emissary binary
tools/upx/bin/upx -9 files/usr/local/bin/emissary

View File

@ -1,3 +1,4 @@
/etc/machine-id
/etc/emissary/agent-key.json
/etc/emissary/agent-state.json
/data/emissary/agent-key.json
/data/emissary/agent-state.json
/data/emissary/apps/data

View File

@ -0,0 +1,3 @@
#!/bin/sh
export PATH="${PATH}:/usr/local/bin"

View File

@ -3,7 +3,7 @@
set -e
main() {
local default_config="/etc/emissary/default.conf"
local default_config="/data/emissary/default.conf"
if [ ! -f "${default_config}" ]; then
exit 0

14
misc/jenkins/Dockerfile Normal file
View File

@ -0,0 +1,14 @@
FROM reg.cadoles.com/proxy_cache/library/ubuntu:22.04
ARG HTTP_PROXY=
ARG HTTPS_PROXY=
ARG http_proxy=
ARG https_proxy=
# Install dev environment dependencies
RUN export DEBIAN_FRONTEND=noninteractive &&\
apt-get update -y &&\
apt-get install -y --no-install-recommends curl ca-certificates build-essential wget unzip tar git jq gawk python3 rsync file
# Add LetsEncrypt certificates
RUN curl -k https://forge.cadoles.com/Cadoles/Jenkins/raw/branch/master/resources/com/cadoles/common/add-letsencrypt-ca.sh | bash

View File

@ -6,7 +6,8 @@ ssh-copy-id root@${OPENWRT_DEVICE}
TARGET_ARCH=$(ssh root@${OPENWRT_DEVICE} source /etc/os-release \&\& echo \${OPENWRT_BOARD:-\$LEDE_BOARD})
FIRMWARE_FILE=bin/${OPENWRT_VERSION}/${TARGET_ARCH}/${OPENWRT_PROFILE}/openwrt-*-sysupgrade.img*
FIRMWARE_FILENAME=${FIRMWARE_FILENAME:-openwrt-*-sysupgrade.img*}
FIRMWARE_FILE=bin/${OPENWRT_VERSION}/${TARGET_ARCH}/${OPENWRT_PROFILE}/${FIRMWARE_FILENAME}
FIRMWARE_FILE=${CUSTOM_FIRMWARE_FILE:-$FIRMWARE_FILE}
ssh root@${OPENWRT_DEVICE} \

View File

@ -6,6 +6,6 @@ omnia:
$(MAKE) \
ADDITIONAL_INSTALL="" \
OPENWRT_TARGET="mvebu/cortexa9" \
EMISSARY_ARCH="armv6" \
EMISSARY_ARCH="armv7" \
OPENWRT_PROFILE="cznic_turris-omnia" \
build