75 lines
2.0 KiB
Groovy
75 lines
2.0 KiB
Groovy
|
|
pipeline {
|
|
agent {
|
|
kubernetes agentsetup(containers: 'go-1-23-2,docker,kaniko' )
|
|
}
|
|
options {
|
|
disableConcurrentBuilds()
|
|
buildDiscarder(logRotator(
|
|
numToKeepStr: '5', // Number of build records to keep
|
|
artifactNumToKeepStr: '3', // Number of builds for which to keep artifacts
|
|
daysToKeepStr: '30', // Days to keep builds
|
|
artifactDaysToKeepStr: '15' // Days to keep artifacts
|
|
))
|
|
}
|
|
environment {
|
|
REGISTRY = "lodge.wamblee.org"
|
|
IMAGE_NAME = "converge"
|
|
IMAGE_TAG = "${BUILD_NUMBER}"
|
|
}
|
|
stages {
|
|
stage('Build') {
|
|
steps {
|
|
sh """
|
|
export
|
|
pwd
|
|
ls -l
|
|
make build
|
|
"""
|
|
}
|
|
}
|
|
stage('Unit test') {
|
|
steps {
|
|
sh """
|
|
make test
|
|
"""
|
|
}
|
|
}
|
|
stage('Build images') {
|
|
steps {
|
|
container('kaniko') {
|
|
sh '''
|
|
/kaniko/executor \
|
|
--build-arg GOPROXY="$GOPROXY" \
|
|
--build-arg GOSUMDB="$GTOSUMDB" \
|
|
--registry-mirror wharf.wamblee.org \
|
|
--context=dir://. \
|
|
--dockerfile=Dockerfile.prod \
|
|
--destination=${REGISTRY}/${IMAGE_NAME}:${IMAGE_TAG} \
|
|
--destination=${REGISTRY}/${IMAGE_NAME}:${BRANCH_NAME}-latest
|
|
rm -rf /kaniko/*[0-9]* && rm -rf /kaniko/Dockerfile && mkdir -p /workspace
|
|
'''
|
|
sh '''
|
|
/kaniko/executor \
|
|
--build-arg GOPROXY="$GOPROXY" \
|
|
--build-arg GOSUMDB="$GTOSUMDB" \
|
|
--registry-mirror wharf.wamblee.org \
|
|
--context=dir://. \
|
|
--dockerfile=Dockerfile.test \
|
|
--destination=${REGISTRY}/${IMAGE_NAME}-test:${IMAGE_TAG} \
|
|
--destination=${REGISTRY}/${IMAGE_NAME}-test:${BRANCH_NAME}-latest
|
|
'''
|
|
}
|
|
}
|
|
}
|
|
stage('Integration test') {
|
|
steps {
|
|
sh """
|
|
make integrationtest
|
|
"""
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|