Compare commits

...

4 Commits

Author SHA1 Message Date
2da57feb91 feat: add jenkins support
All checks were successful
jenkins-ci Build successful
2026-01-13 17:58:50 +00:00
ba10238ed5 fix: replace wrong server url 2026-01-13 12:39:08 +00:00
Lucas
fbb5ca8fc2 refactor: switch to nammed docker volumes 2026-01-13 12:34:33 +00:00
Lucas
50f1666507 chore: update wireguard to 1.0.20250521 2026-01-13 12:34:06 +00:00
2 changed files with 58 additions and 3 deletions

51
Jenkinsfile vendored Normal file
View File

@@ -0,0 +1,51 @@
pipeline {
agent any
environment {
GITEA_REPO_PATH = "lucas/wireguard"
GITEA_API_URL = "https://gitea.lucasroyer.fr/api/v1"
}
stages {
stage('Check git...') {
steps {
checkout scm
}
}
stage('Deploy') {
steps {
echo "Deploy new wireguard..."
sh "docker compose up -d --remove-orphans"
}
}
}
post {
always {
script {
echo "Send Gitea check..."
// Get and store SHA
def commitSha = sh(script: 'git rev-parse HEAD', returnStdout: true).trim()
// Convert from Jenkins to Gitea API
def buildState = (currentBuild.currentResult == 'SUCCESS') ? 'success' : 'failure'
def buildDesc = (currentBuild.currentResult == 'SUCCESS') ? 'Build successful' : 'Build failed'
// Send it to Gitea API with secret 'gitea-token'
withCredentials([string(credentialsId: 'gitea-token', variable: 'GITEA_TOKEN')]) {
// Use \$TOKEN to avoid jenkins to print token in logs
sh """
curl -f -X POST "${GITEA_API_URL}/repos/${GITEA_REPO_PATH}/statuses/${commitSha}" \
-H "Authorization: token \$GITEA_TOKEN" \
-H "Content-Type: application/json" \
-d '{"state": "${buildState}", "target_url": "${env.BUILD_URL}", "description": "${buildDesc}", "context": "jenkins-ci"}'
"""
}
}
echo "Clean unused image..."
sh "docker image prune -f"
}
success { echo "Success !" }
failure { echo "Failed." }
}
}

View File

@@ -1,9 +1,10 @@
services: services:
wireguard: wireguard:
image: linuxserver/wireguard image: linuxserver/wireguard:1.0.20250521
container_name: wireguard container_name: wireguard
restart: always
volumes: volumes:
- ./wireguard-server/config:/config - wireguard_config:/config
- /lib/modules:/lib/modules - /lib/modules:/lib/modules
cap_add: cap_add:
- NET_ADMIN - NET_ADMIN
@@ -14,7 +15,7 @@ services:
- PUID=1000 - PUID=1000
- PGID=1000 - PGID=1000
- TZ=Europe/Paris - TZ=Europe/Paris
- SERVEURURL=lucasroyer.com #optional - SERVEURURL=lucasroyer.fr #optional
- SERVERPORT=51820 #optional - SERVERPORT=51820 #optional
- PEERS=4 #optional - PEERS=4 #optional
- PEERDNS=auto #optional - PEERDNS=auto #optional
@@ -23,3 +24,6 @@ services:
ports: ports:
- 51820:51820/udp - 51820:51820/udp
volumes:
wireguard_config:
external: true