-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
49 lines (42 loc) · 1.35 KB
/
Jenkinsfile
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
def podlabel = "jenkins-builder.${env.JOB_NAME.replace('%2F','_').reverse().take(38).reverse()}.${env.BUILD_NUMBER}".replace('-', '_').replace('/', '_')
pipeline {
agent {
kubernetes {
label podlabel
yaml """
apiVersion: v1
kind: Pod
metadata:
name: cypress-test-pod
spec:
containers:
- name: cypress
image: cypress/base:10
imagePullPolicy: Always
command: ["/bin/sleep", "infinity"]
"""
}
}
environment {
// we will be recording test results and video on Cypress dashboard
// to record we need to set an environment variable
// we can load the record key variable from credentials store
// see https://jenkins.io/doc/book/using/using-credentials/
CYPRESS_RECORD_KEY = credentials('CYPRESS_RECORD_KEY')
CYPRESS_ADMIN = credentials('CYPRESS_ADMIN')
CYPRESS_ADMIN_PASSWORD = credentials('CYPRESS_ADMIN_PASSWORD')
CYPRESS_USER = credentials('CYPRESS_USER')
CYPRESS_USER_PASSWORD = credentials('CYPRESS_USER_PASSWORD')
}
stages {
stage('build and test') {
steps {
container(name: 'cypress') {
sh 'npm install'
sh 'npm ci'
sh "npm run cy:run"
}
}
}
}
}