-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
59 lines (52 loc) · 1.98 KB
/
Jenkinsfile
File metadata and controls
59 lines (52 loc) · 1.98 KB
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
58
59
def label = "mypod-${UUID.randomUUID().toString()}"
podTemplate(label: label,
containers: [
containerTemplate(name: 'sigma-agent', image: 'invent360/sigma-agent:latest',ttyEnabled: true, command: 'cat'),
],
volumes: [
hostPathVolume(hostPath: '/var/run/docker.sock', mountPath: '/var/run/docker.sock')
]) {
node(label) {
checkout scm
dir('angular-k8') {
git url: 'https://github.com/invent360/angular-k8.git'
}
def IMAGE_NAME = 'invent360/ng-app'
def IMAGE_VERSION = 'latest'
stage('Get a Angular project') {
container('sigma-agent') {
stage('Build a Angular project') {
sh 'npm install'
sh 'ls -ltr'
sh 'ng build'
}
}
}
stage('Build and Test Image') {
container('sigma-agent') {
stage('Package into Docker Image') {
sh 'docker build -t ng-app:latest .'
sh 'docker tag ng-app:latest docker.ops.dev.invent-360.com/invent360/ng-app:latest'
}
}
}
stage('Publish Image') {
container('sigma-agent'){
stage('Publish Image to Docker Registry') {
withCredentials([usernamePassword(credentialsId: 'i360-nexus-id', passwordVariable: 'dockerPassword', usernameVariable: 'dockerUsername')]) {
sh "docker login -u ${env.dockerUsername} -p ${env.dockerPassword} docker.ops.dev.invent-360.com"
sh "docker push docker.ops.dev.invent-360.com/${IMAGE_NAME}:${IMAGE_VERSION}"
}
}
}
}
stage('Deploy To Dev') {
container('sigma-agent'){
stage('Deploy To Dev') {
sh 'kubectl create ns dev'
sh 'kubectl create -f ./angular-k8/ --namespace=dev'
}
}
}
}
}