Initial Commit with code from old repo with new Jenkinsfile
Some checks failed
andreas-personal/AndysAdguardHomeBlocklist/pipeline/head There was a failure building this commit
Some checks failed
andreas-personal/AndysAdguardHomeBlocklist/pipeline/head There was a failure building this commit
This commit is contained in:
71
Jenkinsfile
vendored
Normal file
71
Jenkinsfile
vendored
Normal file
@ -0,0 +1,71 @@
|
||||
#!groovy
|
||||
|
||||
pipeline {
|
||||
agent {
|
||||
label 'linux'
|
||||
}
|
||||
triggers {
|
||||
cron('H 12,0 * * *')
|
||||
}
|
||||
stages {
|
||||
stage('Compile Adblock List') {
|
||||
when {
|
||||
beforeAgent true;
|
||||
branch 'main'
|
||||
}
|
||||
steps {
|
||||
withGradle {
|
||||
sh './gradlew :compileAdblockList'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Build/Push Docker Image') {
|
||||
when {
|
||||
beforeAgent true;
|
||||
branch 'main'
|
||||
}
|
||||
agent {
|
||||
label 'linux'
|
||||
}
|
||||
environment {
|
||||
def tag = sh(returnStdout: true, script: 'git rev-parse --short=10 HEAD').trim()
|
||||
PACKAGE_REGISTRY_CREDENTIALS = credentials('gitea-package-registry-jenkins-user')
|
||||
}
|
||||
stages {
|
||||
stage('Build') {
|
||||
steps {
|
||||
sh 'docker build -t gitea.fahrecker.com/andreas-personal/AndysAdguardHomeBlocklist:dev-latest -t gitea.fahrecker.com/andreas-personal/AndysAdguardHomeBlocklist:${tag} .'
|
||||
}
|
||||
}
|
||||
stage('Login') {
|
||||
steps {
|
||||
sh 'docker login -u ${PACKAGE_REGISTRY_CREDENTIALS_USR} -p ${PACKAGE_REGISTRY_CREDENTIALS_PSW} gitea.fahrecker.com'
|
||||
}
|
||||
}
|
||||
stage('Push') {
|
||||
steps {
|
||||
sh 'docker push gitea.fahrecker.com/andreas-personal/AndysAdguardHomeBlocklist:${tag}'
|
||||
sh 'docker push gitea.fahrecker.com/andreas-personal/AndysAdguardHomeBlocklist:dev-latest'
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
sh 'docker logout gitea.fahrecker.com'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Deploy') {
|
||||
when {
|
||||
beforeAgent true;
|
||||
branch 'main'
|
||||
}
|
||||
agent {
|
||||
label 'linux'
|
||||
}
|
||||
steps {
|
||||
sh 'curl -H "Authorization: Bearer 2ykoFnTr3FWcqMLvaEthR79ffNfbTgzo" 10.55.0.2:8181/v1/update'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user