-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
41 lines (41 loc) · 1.38 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
pipeline {
agent { label 'default' }
options { timeout(time: 4, unit: 'MINUTES') }
triggers {
eventTrigger jmespathQuery("controller.action=='casc_bundle_update'")
}
stages {
stage('Validate Bundle') {
steps {
sh '''
git clone https://github.com/cbci-pipeline/controller.git controller
mkdir -p bundles/cbci-pipeline-controller
cd controller/bundle
cp --parents `find -name \\*.yaml*` ../../bundles/cbci-pipeline-controller/
cd ../../bundles/
zip -r bundle.zip .
cd ../controller/bundle/items
yq 'true' pipelines.yaml > /dev/null
'''
withCredentials([usernamePassword(credentialsId: 'admin-cli-token', usernameVariable: 'JENKINS_CLI_USR', passwordVariable: 'JENKINS_CLI_PSW')]) {
sh '''
pwd
mkdir unzip
cd ./unzip
unzip ../bundles/bundle.zip
ls -la
cd cbci-pipeline-controller
ls -la
cd items
ls -la
cd ../../..
curl -i --user "$JENKINS_CLI_USR:$JENKINS_CLI_PSW" -XPOST \
-H "Accept: application/json" \
-H "Content-type: application/zip;charset=utf-8" --data-binary "@./bundles/bundle.zip" \
http://cjoc/cjoc/casc-bundle/pre-validate-bundle
'''
}
}
}
}
}