aidgaf-server/Jenkinsfile
Adam Outler 1e2c77227b
All checks were successful
Updates/AI-Frontend/pipeline/head This commit looks good
Updates/AIDGAF-server/pipeline/head This commit looks good
Update apikey variable, increase token len
2024-11-16 02:47:17 +00:00

57 lines
2.3 KiB
Groovy

#!/bin/groovy
/* groovylint-disable CompileStatic, DuplicateStringLiteral, LineLength */
pipeline {
agent {
docker {
alwaysPull true
image 'docker.io/alpine:3.14'
label 'Wrangler1'
args '-u root'
}
}
stages {
stage('Prepare Environment') {
steps {
sh '#!/bin/sh \n' +
'id; apk add docker openrc git'
}
}
stage('Obtain Source') {
steps {
git branch: 'main', url: 'https://git.adamoutler.com/aoutler/aidgaf-server.git'
}
}
stage('Build in docker') {
steps {
// Get some code from a Git repository
sh '#!/bin/sh \n' +
'docker build -t aidgaf .'
}
}
stage('setup credentials') {
steps {
withCredentials([ sshUserPrivateKey(credentialsId: 'dockeruserOn192.168.1.115', keyFileVariable: 'sshkey', usernameVariable: 'user')]) {
sh '#!/bin/sh \n' +
'set +e; docker logs aidgaf-server; docker stop aidgaf-server||echo machine stopped; docker rm aidgaf-server||echo machine does not exist; set -e'
}
}
}
stage('export docker container') {
steps {
withCredentials([
string(credentialsId: 'ai-hacked-your-info-key', variable: 'OPENWEBUIAPIKEY'),
string(credentialsId: 'PapaHashingSecret', variable: 'PAPA_HASH'),
string(credentialsId: 'PapaAsyncUrl', variable: 'ASYNC_URL'),
sshUserPrivateKey(credentialsId: 'dockeruserOn192.168.1.115', keyFileVariable: 'sshkey')]) {
sh '#!/bin/sh \n' +
'mkdir -p ~/.ssh; cp "$sshkey" ~/.ssh/id_rsa'
sh '#!/bin/sh \n' +
/* groovylint-disable-next-line GStringExpressionWithinString */
'docker run --name=aidgaf-server -eSERVERPORT=8087 -eHOSTNAME=0.0.0.0 -eHASHKEY="${PAPA_HASH}" -eAPIKEY="${OPENWEBUIAPIKEY}" -eASYNC_METHOD="PATCH" -eASYNC_URL="${ASYNC_URL}" -p8087:8087 -d --restart=always aidgaf'
}
}
}
}
}