-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathJenkinsfile
More file actions
127 lines (126 loc) · 4.91 KB
/
Jenkinsfile
File metadata and controls
127 lines (126 loc) · 4.91 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
pipeline {
environment {
// CI = 'true'
// PROJECT = "bitclave-jenkins-ci"
PROJECT = "bitclave-base"
APP_NAME = "base-client-js"
FE_SVC_NAME = "${APP_NAME}-frontend"
CLUSTER = "base-first"
CLUSTER_ZONE = "us-central1-f"
// BRANCH_NAME = "master"
IMAGE_TAG = "gcr.io/bitclave-jenkins-ci/${APP_NAME}:${env.BRANCH_NAME}.${env.BUILD_NUMBER}"
BUILDER_IMAGE_TAG = "gcr.io/bitclave-jenkins-ci/base-client-js-builder"
JENKINS_CRED = "bitclave-jenkins-ci"
}
agent {
kubernetes {
label 'jenkins-builder-base-client-js'
defaultContainer 'jnlp'
yaml """
apiVersion: v1
kind: Pod
metadata:
labels:
project: base-client-js
labels:
component: ci
spec:
# Use service account that can deploy to all namespaces
serviceAccountName: cd-jenkins
containers:
- name: nodejs
image: gcr.io/bitclave-jenkins-ci/base-client-js-builder
command:
- cat
tty: true
- name: gcloud
image: gcr.io/cloud-builders/gcloud
command:
- cat
tty: true
- name: kubectl
image: gcr.io/cloud-builders/kubectl
command:
- cat
tty: true
"""
}
}
triggers {
upstream(upstreamProjects: 'base-client-js-builder/master', threshold: hudson.model.Result.SUCCESS)
}
stages {
stage('Build') {
steps {
container("nodejs") {
sh "su node -c 'npm install'"
sh "su node -c 'npm run build'"
}
}
}
stage('Test') {
steps {
container("nodejs") {
sh 'node ./external/Signer.js --authPK 02e2d9c04891bf7f9934041d7171ade343e540f5d18bd357cde4ef175da3de7e06 --host https://base2-bitclva-com.herokuapp.com &'
sh 'npm test'
}
}
}
// stage('Deploy Production') {
// // Production branch
// steps{
// // sh("echo here1")
// container('kubectl') {
// // Change deployed image in production to the one we just built
// sh("echo here2")
// sh("gcloud config get-value account")
// // sh("gcloud container clusters list")
// // sh("gcloud container clusters get-credentials jenkins-cd --zone=us-central1-f")
// // sh("gcloud container clusters list")
// // sh("kubectl config current-context")
// // sh("gcloud container clusters get-credentials base-first --zone us-central1-f --project bitclave-jenkins-ci")
// // sh("gcloud config get-value account")
// sh("sed -i.bak 's#gcr.io/cloud-solutions-images/gceme:1.0.0#gcr.io/bitclave-jenkins-ci/my-app:master.26#' ./k8s/production/*.yaml")
// sh("echo here3")
// // sh("kubectl cluster-info")
// step([$class: 'KubernetesEngineBuilder',namespace:'production', projectId: env.PROJECT, clusterName: env.CLUSTER, zone: env.CLUSTER_ZONE, manifestPattern: 'k8s/services', credentialsId: env.JENKINS_CRED, verifyDeployments: false])
// step([$class: 'KubernetesEngineBuilder',namespace:'production', projectId: env.PROJECT, clusterName: env.CLUSTER, zone: env.CLUSTER_ZONE, manifestPattern: 'k8s/production', credentialsId: env.JENKINS_CRED, verifyDeployments: false])
// sleep 10 // seconds
// sh("gcloud container clusters get-credentials base-first --zone us-central1-f --project bitclave-base")
// sh("echo `kubectl --namespace=production get service/${FE_SVC_NAME} -o jsonpath='{.status.loadBalancer.ingress[0].ip}'`")
// }
// }
// }
// stage ('Time to access the app') {
// steps {
// echo 'Waiting 3 minutes for deployment to complete prior starting smoke testing'
// sleep 100 // seconds
// }
// }
// stage('Cleanup Production') {
// // Production branch
// steps{
// // sh("echo here1")
// container('kubectl') {
// sh("gcloud container clusters get-credentials base-first --zone us-central1-f --project bitclave-base")
// sh("kubectl delete -n production services my-app-backend my-app-frontend")
// sh("kubectl delete -n production deployment my-app-backend-production my-app-frontend-production")
// }
// }
// }
// stage('Deliver') {
// steps {
// container('nodejs') {
// sh './jenkins/scripts/deliver.sh'
// input message: 'Finished using the web site? (Click "Proceed" to continue)'
// sh './jenkins/scripts/kill.sh'
// }
// }
// }
}
post {
always {
archiveArtifacts artifacts: 'dist/Base.js', fingerprint: true
}
}
}