@@ -5,66 +5,67 @@ def github_user = "gkirok"
55def docker_user = " gallziguazio"
66
77
8+ properties([pipelineTriggers([[$class : ' PeriodicFolderTrigger' , interval : ' 2m' ]])])
9+ stage(' release' ) {
10+ when ( expression { sh([returnStdout : true , script : ' echo $TAG_NAME | tr -d \'\n\' | egrep \' ^v[\\ .0-9]*-v[\\ .0-9]*$\' ' ]) } ) {
11+ podTemplate(label : " prometheus-${ label} " , inheritFrom : ' kube-slave-dood' ) {
12+ node(" prometheus-${ label} " ) {
13+ withCredentials([
14+ usernamePassword(credentialsId : ' 4318b7db-a1af-4775-b871-5a35d3e75c21' , passwordVariable : ' GIT_PASSWORD' , usernameVariable : ' GIT_USERNAME' ),
15+ secretText(credentialsId : ' dd7f75c5-f055-4eb3-9365-e7d04e644211' , secretText : ' GIT_TOKEN' )
16+ ]) {
17+ stage(' get release' ) {
18+ // sh "curl https://api.github.com/repos/gkirok/prometheus/releases/latest"
19+ sh """
20+ curl -H "Authorization: bearer ${ GIT_TOKEN} " -X POST -d '{"query": "query { repository(owner:\" gkirok\" , name:\" prometheus\" ) { releases(last: 5) { nodes { tag { name } } } } }"' https://api.github.com/graphql
21+ """
22+ }
823
9- podTemplate(label : " prometheus-${ label} " , inheritFrom : ' kube-slave-dood' ) {
10- node(" prometheus-${ label} " ) {
11- withCredentials([
12- usernamePassword(credentialsId : ' 4318b7db-a1af-4775-b871-5a35d3e75c21' , passwordVariable : ' GIT_PASSWORD' , usernameVariable : ' GIT_USERNAME' ),
13- ]) {
14- stage(' get release' ) {
15- // sh "curl https://api.github.com/repos/gkirok/prometheus/releases/latest"
16- sh """
17- curl -X POST -d " \\
18- { \\
19- \\ "query\\ ": \\ "query { viewer { login }}\\ " \\
20- } \\
21- " https://api.github.com/graphql
22- """
23- }
24-
25- stage(' prepare sources' ) {
26- sh """
27- cd ${ BUILD_FOLDER}
28- pwd
29- git clone https://${ GIT_USERNAME} :${ GIT_PASSWORD} @github.com/${ github_user} /prometheus.git src/github.com/prometheus/prometheus
30- cd ${ BUILD_FOLDER} /src/github.com/prometheus/prometheus
31- rm -rf vendor/github.com/v3io/v3io-tsdb/
32- git clone https://${ GIT_USERNAME} :${ GIT_PASSWORD} @github.com/${ github_user} /v3io-tsdb.git vendor/github.com/v3io/v3io-tsdb
33- cd vendor/github.com/v3io/v3io-tsdb
34- git checkout ${ V3IO_TSDB_VERSION}
35- rm -rf .git vendor/github.com/prometheus
36- """
37- }
24+ stage(' prepare sources' ) {
25+ sh """
26+ cd ${ BUILD_FOLDER}
27+ pwd
28+ git clone https://${ GIT_USERNAME} :${ GIT_PASSWORD} @github.com/${ github_user} /prometheus.git src/github.com/prometheus/prometheus
29+ cd ${ BUILD_FOLDER} /src/github.com/prometheus/prometheus
30+ rm -rf vendor/github.com/v3io/v3io-tsdb/
31+ git clone https://${ GIT_USERNAME} :${ GIT_PASSWORD} @github.com/${ github_user} /v3io-tsdb.git vendor/github.com/v3io/v3io-tsdb
32+ cd vendor/github.com/v3io/v3io-tsdb
33+ git checkout ${ V3IO_TSDB_VERSION}
34+ rm -rf .git vendor/github.com/prometheus
35+ """
36+ }
3837
39- def V3IO_PROM_VERSION = sh (
40- script : " cat ${ BUILD_FOLDER} /src/github.com/prometheus/prometheus/VERSION" ,
41- returnStdout : true
42- ). trim()
38+ def V3IO_PROM_VERSION = sh(
39+ script : " cat ${ BUILD_FOLDER} /src/github.com/prometheus/prometheus/VERSION" ,
40+ returnStdout : true
41+ ). trim()
4342
44- stage(' build in dood' ) {
45- container(' docker-cmd' ) {
46- sh """
47- cd ${ BUILD_FOLDER} /src/github.com/prometheus/prometheus
48- docker build . -t ${ docker_user} /v3io-prom:${ V3IO_PROM_VERSION} -${ V3IO_TSDB_VERSION} -f Dockerfile.multi
49- """
50- withDockerRegistry([ credentialsId : " 472293cc-61bc-4e9f-aecb-1d8a73827fae" , url : " " ]) {
51- sh " docker push ${ docker_user} /v3io-prom:${ V3IO_PROM_VERSION} -${ V3IO_TSDB_VERSION} "
43+ stage(' build in dood' ) {
44+ container(' docker-cmd' ) {
45+ sh """
46+ cd ${ BUILD_FOLDER} /src/github.com/prometheus/prometheus
47+ docker build . -t ${ docker_user} /v3io-prom:${ V3IO_PROM_VERSION} -${ V3IO_TSDB_VERSION} -f Dockerfile.multi
48+ """
49+ withDockerRegistry([credentialsId : " 472293cc-61bc-4e9f-aecb-1d8a73827fae" , url : " " ]) {
50+ sh " docker push ${ docker_user} /v3io-prom:${ V3IO_PROM_VERSION} -${ V3IO_TSDB_VERSION} "
51+ }
52+ }
5253 }
53- }
54- }
5554
56- stage(' git push' ) {
57- try {
58- sh """
59- git config --global user.email '${ GIT_USERNAME} @iguazio.com'
60- git config --global user.name '${ GIT_USERNAME} '
61- cd ${ BUILD_FOLDER} /src/github.com/prometheus/prometheus;
62- git add vendor/github.com/v3io/v3io-tsdb;
63- git commit -am 'Updated TSDB to ${ V3IO_TSDB_VERSION} ';
64- git push origin master
65- """
66- } catch (err) {
67- echo " Can not push code to git"
55+ stage(' git push' ) {
56+ try {
57+ sh """
58+ git config --global user.email '${ GIT_USERNAME} @iguazio.com'
59+ git config --global user.name '${ GIT_USERNAME} '
60+ cd ${ BUILD_FOLDER} /src/github.com/prometheus/prometheus;
61+ git add vendor/github.com/v3io/v3io-tsdb;
62+ git commit -am 'Updated TSDB to ${ V3IO_TSDB_VERSION} ';
63+ git push origin master
64+ """
65+ } catch (err) {
66+ echo " Can not push code to git"
67+ }
68+ }
6869 }
6970 }
7071 }
0 commit comments