Jenkinsfile v1.
Build, unit test build image using kaniko, integraiton test. THe nexus docker proxy is used as well as the nexus go proxy. Also for the normal build, a cache RWX PVC is used.
This commit is contained in:
parent
e18a0ceb1f
commit
140f0f7593
80
Jenkinsfile
vendored
Normal file
80
Jenkinsfile
vendored
Normal file
@ -0,0 +1,80 @@
|
||||
|
||||
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('Checkout') {
|
||||
steps {
|
||||
git credentialsId: 'aa7540b3-6e80-4d5e-97d4-852da70986b9',
|
||||
url: 'https://git.wamblee.org/erik/converge.git',
|
||||
branch: 'main'
|
||||
}
|
||||
}
|
||||
stage('Build') {
|
||||
steps {
|
||||
sh """
|
||||
export
|
||||
cd /home/jenkins/agent/workspace/gobuildertest
|
||||
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}: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:latest
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Integration test') {
|
||||
steps {
|
||||
sh """
|
||||
make integrationtest
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user