Refactoring and linting

This commit is contained in:
adamoutler
2023-02-15 03:26:12 +00:00
parent 2752702d17
commit e3e20a7b07
18 changed files with 134 additions and 120 deletions

50
Jenkinsfile vendored
View File

@ -1,4 +1,5 @@
#! /bin/groovy
#!/bin/groovy
/* groovylint-disable CompileStatic, DuplicateStringLiteral, LineLength */
pipeline {
agent {
docker {
@ -9,18 +10,14 @@ pipeline {
}
}
stages {
stage('Prepare Environment'){
steps{
sh "#!/bin/sh \n" +
stage('Prepare Environment') {
steps {
sh '#!/bin/sh \n' +
'id; apk add docker openrc git'
}
}
stage('Obtain Source'){
stage('Obtain Source') {
steps {
git branch: 'main', url: 'https://git.adamoutler.com/aoutler/aidgaf-server.git'
}
@ -28,42 +25,35 @@ pipeline {
stage('Build in docker') {
steps {
// Get some code from a Git repository
sh "#!/bin/sh \n" +
sh '#!/bin/sh \n' +
'docker build -t aidgaf .'
}
}
stage ("setup credentials"){
steps{
stage('setup credentials') {
steps {
withCredentials([ sshUserPrivateKey(credentialsId: 'dockeruserOn192.168.1.115', keyFileVariable: 'sshkey', usernameVariable: 'user')]) {
sh "#!/bin/sh \n" +
sh '#!/bin/sh \n' +
'set +e; docker stop aidgaf-server||echo machine stopped; docker rm aidgaf-server||echo machine does not exist; set -e'
}
}
}
stage ('export docker container'){
stage('export docker container') {
steps {
sh "#!/bin/sh \n" +
sh '#!/bin/sh \n' +
'set +e; docker stop aidgaf-server||echo machine stopped; docker rm aidgaf-server||echo machine does not exist; set -e'
withCredentials([
string(credentialsId: 'OpenAI-API-Token', variable: 'OPEN_AI_TOKEN'),
string(credentialsId: 'PapaHashingSecret', variable: 'PAPA_HASH'),
sshUserPrivateKey(credentialsId: 'dockeruserOn192.168.1.115', keyFileVariable: 'sshkey', usernameVariable: 'user')
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" +
'docker run --name=aidgaf-server -eSERVERPORT=8087 -eHOSTNAME=0.0.0.0 -eHASHKEY="${PAPA_HASH}" -eAPIKEY="${OPEN_AI_TOKEN}" -p8087:8087 -d --restart=always aidgaf'
}
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="${OPEN_AI_TOKEN}" -eASYNC_METHOD="PATCH" -eASYNC_URL="${} -p8087:8087 -d --restart=always aidgaf'
}
}
}
// To run Maven on a Windows agent, use
// bat "mvn -Dmaven.test.failure.ignore=true clean package"
}
}