-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile_docker
57 lines (55 loc) · 1.78 KB
/
Jenkinsfile_docker
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
pipeline {
agent any
tools {
nodejs "node"
}
environment {
DOCKER_IMAGE_NAME = 'girish332/webapp-cve-processor'
LATEST_TAG = 'latest'
}
stages {
stage('Checkout Code') {
steps {
cleanWs()
checkout scm
}
}
stage ('Release with Semantic Versioning') {
steps {
withCredentials([usernamePassword(credentialsId: 'github-app', passwordVariable: 'GITHUB_TOKEN', usernameVariable: 'GITHUB_USERNAME')]) {
sh '''
npm install @semantic-release/commit-analyzer
npm install @semantic-release/release-notes-generator
npm install @semantic-release/changelog
npm install semantic-release-helm
npm install @semantic-release/git
npm install @semantic-release/github
export GITHUB_ACTION=true
npx semantic-release
'''
}
}
}
stage('Build and Push webapp Docker Producer Image') {
steps {
script {
withDockerRegistry(credentialsId: 'dockerhub-creds') {
sh '''
docker buildx ls
docker buildx create --name cve-processor
docker buildx use cve-processor
VERSION=$(git describe --tags)
docker buildx build --push --platform linux/amd64,linux/arm64 --tag $DOCKER_IMAGE_NAME:$VERSION --tag $DOCKER_IMAGE_NAME:latest .
'''
}
}
}
}
}
post {
always {
cleanWs()
echo 'Pipeline complete'
}
}
}