example.
Some checks failed
internetmastercz/test/pipeline/head There was a failure building this commit

This commit is contained in:
2021-10-20 03:43:53 +02:00
parent bb7a435f52
commit c7b97effe5

20
Jenkinsfile vendored
View File

@@ -22,19 +22,31 @@ pipeline {
sh "docker build -t registry.proxyq.co/jenkins/website:${env.BUILD_ID} ." sh "docker build -t registry.proxyq.co/jenkins/website:${env.BUILD_ID} ."
} }
} }
stage('Test') { stage('Testing') {
steps { steps {
echo "start Testing" echo "start Testing"
sh 'sleep 5' sh 'sleep 5'
echo "finish Testing" echo "finish Testing"
} }
} }
stage('Deploy') { stage('Publish') {
steps { steps {
echo "${env.ENV_REGISTRY_URL}" sh "docker login https://registry.proxyq.co --user ${REGISTRY_CREDENTIALS_USR} --password-stdin ${REGISTRY_CREDENTIALS_PSW}"
sh "docker login https://registry.proxyq.co -u ${REGISTRY_CREDENTIALS_USR} -p ${REGISTRY_CREDENTIALS_PSW}"
sh "docker push registry.proxyq.co/jenkins/website:${env.BUILD_ID}" sh "docker push registry.proxyq.co/jenkins/website:${env.BUILD_ID}"
} }
} }
stage('Redeploy') {
steps {
script {
def json = """
{"username": "test", "password": "test"}
"""
def jwtResponse = httpRequest acceptType: 'APPLICATION_JSON', contentType: 'APPLICATION_JSON', validResponseCodes: '200', httpMode: 'POST', ignoreSslErrors: true, consoleLogResponseBody: true, requestBody: json, url: "https://portainer.<yourdomain>.com/api/auth"
def jwtObject = new groovy.json.JsonSlurper().parseText(jwtResponse.getContent())
env.JWTTOKEN = "Bearer ${jwtObject.jwt}"
}
echo "${env.JWTTOKEN}"
}
}
} }
} }