initial build (#28)

This commit is contained in:
Jarred Hunter 2022-03-17 13:36:53 -05:00 committed by GitHub
parent 13f0f383e0
commit c4a9b41234
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

49
Jenkinsfile vendored
View File

@ -1,25 +1,36 @@
def label = "docker-${UUID.randomUUID().toString()}" pipeline {
agent {
podTemplate(label: label, inheritFrom: 'base') { kubernetes {
node(label) { label "kaniko-${UUID.randomUUID().toString()}"
stage('Checkout Repository') { inheritFrom 'kaniko'
container('base') {
checkout scm
}
} }
}
stage('Login to Dockerhub') { environment {
withCredentials([usernamePassword(credentialsId: 'DockerHubAccessYardstick', usernameVariable: 'USER', passwordVariable: 'PASS')]) { REPOSITORY = 'yardstick/measure-solver'
container('base') { }
sh "docker login --username ${USER} --password ${PASS}" stages {
stage('Build Kaniko image') {
steps {
withCredentials([usernamePassword(credentialsId: 'DockerHubAccessYardstick', usernameVariable: 'USER', passwordVariable: 'PASS')]) {
container('kaniko') {
checkout scm
// Setup docker credentials
sh 'echo "{\\"auths\\":{\\"https://index.docker.io/v1/\\":{\\"auth\\":\\"$(printf "%s:%s" "$USER" "$PASS" | base64 | tr -d \'\n\')\\"}}}" > /kaniko/.docker/config.json'
// Execute kaniko build
sh """
/kaniko/executor -f `pwd`/Dockerfile \
-c `pwd` \
--insecure=true \
--insecure-registry=docker-registry.default:5000 \
--cache=true \
--cache-repo=docker-registry.default:5000/${REPOSITORY} \
--destination ${env.REPOSITORY}:\$(echo ${BRANCH_NAME} | grep -Eo 'feature/([A-Za-z]+-[0-9]*)' | grep -Eo '[A-Za-z]+-[0-9]*' || \
echo ${BRANCH_NAME} | grep -Eo '(release|hotfix)/[[:digit:]]+\\.[[:digit:]]+\\.[[:digit:]]+' | grep -Eo '[[:digit:]]+\\.[[:digit:]]+\\.[[:digit:]]+' || \
echo ${BRANCH_NAME} | grep -Eo 'YASDEV-([[:digit:]]*)')
"""
}
} }
} }
} }
stage('Build Docker image') {
container('base') {
sh "make display full branch=${BRANCH_NAME}"
}
}
} }
} }