diff --git a/vendor/github.com/v3io/v3io-tsdb/Jenkinsfile b/vendor/github.com/v3io/v3io-tsdb/Jenkinsfile index 229c112c677..008af0f8fa7 100644 --- a/vendor/github.com/v3io/v3io-tsdb/Jenkinsfile +++ b/vendor/github.com/v3io/v3io-tsdb/Jenkinsfile @@ -1,6 +1,5 @@ label = "${UUID.randomUUID().toString()}" BUILD_FOLDER = "/go" -expired=240 attempts=15 git_project = "v3io-tsdb" git_project_user = "v3io" @@ -10,7 +9,6 @@ git_deploy_user_private_key = "iguazio-prod-git-user-private-key" def build_v3io_tsdb(TAG_VERSION) { withCredentials([ - usernamePassword(credentialsId: git_deploy_user, passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME'), string(credentialsId: git_deploy_user_token, variable: 'GIT_TOKEN') ]) { def git_project = 'v3io-tsdb' @@ -53,7 +51,7 @@ def build_v3io_tsdb(TAG_VERSION) { } } -def build_nuclio(V3IO_TSDB_VERSION) { +def build_nuclio(V3IO_TSDB_VERSION, internal_status="stable") { withCredentials([ usernamePassword(credentialsId: git_deploy_user, passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME'), string(credentialsId: git_deploy_user_token, variable: 'GIT_TOKEN') @@ -61,112 +59,65 @@ def build_nuclio(V3IO_TSDB_VERSION) { def git_project = 'tsdb-nuclio' stage('prepare sources') { container('jnlp') { - sh """ - cd ${BUILD_FOLDER} - git clone https://${GIT_USERNAME}:${GIT_PASSWORD}@github.com/${git_project_user}/${git_project}.git src/github.com/v3io/${git_project} - cd ${BUILD_FOLDER}/src/github.com/v3io/${git_project} - rm -rf functions/ingest/vendor/github.com/v3io/v3io-tsdb functions/query/vendor/github.com/v3io/v3io-tsdb - git clone https://${GIT_USERNAME}:${GIT_PASSWORD}@github.com/${git_project_user}/v3io-tsdb.git functions/ingest/vendor/github.com/v3io/v3io-tsdb - cd functions/ingest/vendor/github.com/v3io/v3io-tsdb - git checkout ${V3IO_TSDB_VERSION} - rm -rf .git vendor/github.com/nuclio vendor/github.com/v3io/frames/vendor/golang.org/x/net - cd ${BUILD_FOLDER}/src/github.com/v3io/${git_project} - cp -R functions/ingest/vendor/github.com/v3io/v3io-tsdb functions/query/vendor/github.com/v3io/v3io-tsdb - """ - } - } - - stage('git push') { - container('jnlp') { - try { + if(!fileExists("${BUILD_FOLDER}/src/github.com/v3io/${git_project}")) { + sh("cd ${BUILD_FOLDER}; git clone https://${GIT_TOKEN}@github.com/${git_project_user}/${git_project}.git src/github.com/v3io/${git_project}") + } + if ( "${internal_status}" == "unstable" ) { dir("${BUILD_FOLDER}/src/github.com/v3io/${git_project}") { - sh """ - git config --global user.email '${GIT_USERNAME}@iguazio.com' - git config --global user.name '${GIT_USERNAME}' - git add functions/ingest/vendor/github.com functions/query/vendor/github.com; - git commit -am 'Updated TSDB to ${V3IO_TSDB_VERSION}'; - git push origin master - """ + sh("git checkout development") } - } catch (err) { - echo "Can not push code to master" - } - } - - container('jnlp') { - try { + } else { dir("${BUILD_FOLDER}/src/github.com/v3io/${git_project}") { - sh """ - git checkout development - git merge origin/master - git push origin development - """ + sh("git checkout master") } - } catch (err) { - echo "Can not push code to development" } - } - } - } -} - -def build_demo(V3IO_TSDB_VERSION) { - withCredentials([ - usernamePassword(credentialsId: git_deploy_user, passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME'), - string(credentialsId: git_deploy_user_token, variable: 'GIT_TOKEN') - ]) { - def git_project = 'demos' - - stage('prepare sources') { - container('jnlp') { - sh """ - cd ${BUILD_FOLDER} - git clone https://${GIT_USERNAME}:${GIT_PASSWORD}@github.com/${git_project_user}/${git_project}.git src/github.com/v3io/${git_project} - cd ${BUILD_FOLDER}/src/github.com/v3io/${git_project}/netops/golang/src/github.com/v3io/demos - rm -rf vendor/github.com/v3io/v3io-tsdb/ - git clone https://${GIT_USERNAME}:${GIT_PASSWORD}@github.com/${git_project_user}/v3io-tsdb.git vendor/github.com/v3io/v3io-tsdb - cd vendor/github.com/v3io/v3io-tsdb - git checkout ${V3IO_TSDB_VERSION} - rm -rf .git vendor/github.com/v3io vendor/github.com/nuclio - """ + dir("${BUILD_FOLDER}/src/github.com/v3io/${git_project}") { + sh """ + rm -rf functions/ingest/vendor/github.com/v3io/v3io-tsdb functions/query/vendor/github.com/v3io/v3io-tsdb + git clone https://${GIT_TOKEN}@github.com/${git_project_user}/v3io-tsdb.git functions/ingest/vendor/github.com/v3io/v3io-tsdb + cd functions/ingest/vendor/github.com/v3io/v3io-tsdb + git checkout ${V3IO_TSDB_VERSION} + rm -rf .git vendor/github.com/nuclio vendor/github.com/v3io/frames/vendor/golang.org/x/net + cd ${BUILD_FOLDER}/src/github.com/v3io/${git_project} + cp -R functions/ingest/vendor/github.com/v3io/v3io-tsdb functions/query/vendor/github.com/v3io/v3io-tsdb + """ + } } } stage('git push') { container('jnlp') { - try { - dir("${BUILD_FOLDER}/src/github.com/v3io/${git_project}/netops") { - sh """ - git config --global user.email '${GIT_USERNAME}@iguazio.com' - git config --global user.name '${GIT_USERNAME}' - git add golang/src/github.com/v3io/demos/vendor/github.com; - git commit -am 'Updated TSDB to ${V3IO_TSDB_VERSION}'; - git push origin master - """ + dir("${BUILD_FOLDER}/src/github.com/v3io/${git_project}") { + sh """ + git config --global user.email '${GIT_USERNAME}@iguazio.com' + git config --global user.name '${GIT_USERNAME}' + git remote rm origin + git remote add origin https://${GIT_USERNAME}:${GIT_TOKEN}@github.com/${git_project_user}/${git_project}.git + git add functions/ingest/vendor/github.com functions/query/vendor/github.com; + """ + try { + sh("git commit -am 'Updated TSDB to ${V3IO_TSDB_VERSION}'") + } catch (err) { + echo "Can not commit" } - } catch (err) { - echo "Can not push code to master" - } - } - - container('jnlp') { - try { - dir("${BUILD_FOLDER}/src/github.com/v3io/${git_project}/netops") { - sh """ - git checkout development - git merge origin/master - git push origin development - """ + try { + if ( "${internal_status}" == "unstable" ) { + sh("git push origin development") + } else { + sh("git push origin master") + } + } catch (err) { + echo "Can not push code" + echo err } - } catch (err) { - echo "Can not push code to development" } } } } } -def build_prometheus(V3IO_TSDB_VERSION) { + +def build_prometheus(V3IO_TSDB_VERSION, internal_status="stable") { withCredentials([ usernamePassword(credentialsId: git_deploy_user, passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME'), string(credentialsId: git_deploy_user_token, variable: 'GIT_TOKEN') @@ -175,97 +126,69 @@ def build_prometheus(V3IO_TSDB_VERSION) { stage('prepare sources') { container('jnlp') { - sh """ - cd ${BUILD_FOLDER} - if [[ ! -d src/github.com/${git_project}/${git_project} ]]; then - git clone https://${GIT_USERNAME}:${GIT_PASSWORD}@github.com/${git_project_user}/${git_project}.git src/github.com/${git_project}/${git_project} - fi - cd ${BUILD_FOLDER}/src/github.com/${git_project}/${git_project} - rm -rf vendor/github.com/v3io/v3io-tsdb/ - git clone https://${GIT_USERNAME}:${GIT_PASSWORD}@github.com/${git_project_user}/v3io-tsdb.git vendor/github.com/v3io/v3io-tsdb - cd vendor/github.com/v3io/v3io-tsdb - git checkout ${V3IO_TSDB_VERSION} - rm -rf .git vendor/github.com/${git_project} vendor/github.com/v3io/frames/vendor/golang.org/x/net - """ + if(!fileExists("${BUILD_FOLDER}/src/github.com/${git_project}/${git_project}")) { + sh("cd ${BUILD_FOLDER}; git clone https://${GIT_TOKEN}@github.com/${git_project_user}/${git_project}.git src/github.com/${git_project}/${git_project}") + } + if ( "${internal_status}" == "unstable" ) { + dir("${BUILD_FOLDER}/src/github.com/${git_project}/${git_project}") { + sh("git checkout development") + } + } else { + dir("${BUILD_FOLDER}/src/github.com/${git_project}/${git_project}") { + sh("git checkout master") + } + } + dir("${BUILD_FOLDER}/src/github.com/${git_project}/${git_project}") { + sh """ + rm -rf vendor/github.com/v3io/v3io-tsdb/ + git clone https://${GIT_TOKEN}@github.com/${git_project_user}/v3io-tsdb.git vendor/github.com/v3io/v3io-tsdb + cd vendor/github.com/v3io/v3io-tsdb + git checkout ${V3IO_TSDB_VERSION} + rm -rf .git vendor/github.com/${git_project} vendor/github.com/v3io/frames/vendor/golang.org/x/net + """ + } } } stage('git push') { container('jnlp') { - try { - dir("${BUILD_FOLDER}/src/github.com/${git_project}/${git_project}") { - sh """ - git config --global user.email '${GIT_USERNAME}@iguazio.com' - git config --global user.name '${GIT_USERNAME}' - git add vendor/github.com; - git commit -am 'Updated TSDB to ${V3IO_TSDB_VERSION}'; - git push origin master - """ + dir("${BUILD_FOLDER}/src/github.com/${git_project}/${git_project}") { + sh """ + git config --global user.email '${GIT_USERNAME}@iguazio.com' + git config --global user.name '${GIT_USERNAME}' + git remote rm origin + git remote add origin https://${GIT_USERNAME}:${GIT_TOKEN}@github.com/${git_project_user}/${git_project}.git + git add vendor/github.com; + """ + try { + sh("git commit -am 'Updated TSDB to ${V3IO_TSDB_VERSION}'") + } catch (err) { + echo "Can not commit" + } + try { + if ( "${internal_status}" == "unstable" ) { + sh("git push origin development") + } else { + sh("git push origin master") + } + } catch (err) { + echo "Can not push code" + echo err } - } catch (err) { - echo "Can not push code to master" } } } } } -podTemplate(label: "${git_project}-${label}", yaml: """ -apiVersion: v1 -kind: Pod -metadata: - name: "${git_project}-${label}" - labels: - jenkins/kube-default: "true" - app: "jenkins" - component: "agent" -spec: - shareProcessNamespace: true - containers: - - name: jnlp - image: jenkins/jnlp-slave - resources: - limits: - cpu: 1 - memory: 2Gi - requests: - cpu: 1 - memory: 2Gi - volumeMounts: - - name: go-shared - mountPath: /go - - name: docker-cmd - image: docker - command: [ "/bin/sh", "-c", "--" ] - args: [ "while true; do sleep 30; done;" ] - volumeMounts: - - name: docker-sock - mountPath: /var/run - - name: go-shared - mountPath: /go - - name: golang - image: golang:1.11 - command: [ "/bin/sh", "-c", "--" ] - args: [ "while true; do sleep 30; done;" ] - volumeMounts: - - name: go-shared - mountPath: /go - volumes: - - name: docker-sock - hostPath: - path: /var/run - - name: go-shared - emptyDir: {} -""" -) { +podTemplate(label: "${git_project}-${label}", inheritFrom: "jnlp-docker-golang") { def MAIN_TAG_VERSION - def PUBLISHED_BEFORE - def next_versions = ['demos':null, 'prometheus':null, 'tsdb-nuclio':null] + def next_versions = ['prometheus':null, 'tsdb-nuclio':null] - pipelinex = library(identifier: 'pipelinex@DEVOPS-204-pipelinex', retriever: modernSCM( - [$class: 'GitSCMSource', + pipelinex = library(identifier: 'pipelinex@shellc', retriever: modernSCM( + [$class: 'GitSCMSource', credentialsId: git_deploy_user_private_key, - remote: "git@github.com:iguazio/pipelinex.git"])).com.iguazio.pipelinex + remote: "git@github.com:iguazio/pipelinex.git"])).com.iguazio.pipelinex common.notify_slack { node("${git_project}-${label}") { @@ -275,140 +198,124 @@ spec: stage('get tag data') { container('jnlp') { MAIN_TAG_VERSION = github.get_tag_version(TAG_NAME) - PUBLISHED_BEFORE = github.get_tag_published_before(git_project, git_project_user, "${MAIN_TAG_VERSION}", GIT_TOKEN) echo "$MAIN_TAG_VERSION" - echo "$PUBLISHED_BEFORE" } } - } - } - if (MAIN_TAG_VERSION != null && MAIN_TAG_VERSION.length() > 0 && PUBLISHED_BEFORE < expired) { - parallel( - 'v3io-tsdb': { - podTemplate(label: "v3io-tsdb-${label}", inheritFrom: "${git_project}-${label}", containers: [ - containerTemplate(name: 'golang', image: 'golang:1.11') - ]) { - node("v3io-tsdb-${label}") { - withCredentials([ - string(credentialsId: git_deploy_user_token, variable: 'GIT_TOKEN') + if (github.check_tag_expiration(git_project, git_project_user, MAIN_TAG_VERSION, GIT_TOKEN)) { + parallel( + 'v3io-tsdb': { + podTemplate(label: "v3io-tsdb-${label}", inheritFrom: "${git_project}-${label}", containers: [ + containerTemplate(name: 'golang', image: 'golang:1.11') ]) { - build_v3io_tsdb(MAIN_TAG_VERSION) - } - } - } - }, - - 'tsdb-nuclio': { - podTemplate(label: "v3io-tsdb-nuclio-${label}", inheritFrom: "${git_project}-${label}") { - node("v3io-tsdb-nuclio-${label}") { - withCredentials([ - string(credentialsId: git_deploy_user_token, variable: 'GIT_TOKEN') - ]) { - def NEXT_VERSION - - stage('get previous release version') { - container('jnlp') { - NEXT_VERSION = github.get_next_tag_version("tsdb-nuclio", git_project_user, GIT_TOKEN) - - echo "$NEXT_VERSION" - next_versions.putAt("tsdb-nuclio", NEXT_VERSION) - } - } - - build_nuclio(TAG_NAME) - - stage('create tsdb-nuclio prerelease') { - container('jnlp') { - github.create_prerelease("tsdb-nuclio", git_project_user, NEXT_VERSION, GIT_TOKEN) + node("v3io-tsdb-${label}") { + withCredentials([ + string(credentialsId: git_deploy_user_token, variable: 'GIT_TOKEN') + ]) { + build_v3io_tsdb(MAIN_TAG_VERSION) } } } - } - } - }, - 'demos': { - podTemplate(label: "demos-${label}", inheritFrom: "${git_project}-${label}") { - node("demos-${label}") { - withCredentials([ - string(credentialsId: git_deploy_user_token, variable: 'GIT_TOKEN') - ]) { - def NEXT_VERSION - - stage('get previous release version') { - container('jnlp') { - NEXT_VERSION = github.get_next_tag_version("demos", git_project_user, GIT_TOKEN) - - echo "$NEXT_VERSION" - next_versions.putAt('demos', NEXT_VERSION) - } - } - - build_demo(TAG_NAME) - - stage('create demos prerelease') { - container('jnlp') { - github.create_prerelease("demos", git_project_user, NEXT_VERSION, GIT_TOKEN) + }, + 'tsdb-nuclio': { + podTemplate(label: "v3io-tsdb-nuclio-${label}", inheritFrom: "${git_project}-${label}") { + node("v3io-tsdb-nuclio-${label}") { + withCredentials([ + string(credentialsId: git_deploy_user_token, variable: 'GIT_TOKEN') + ]) { + def NEXT_VERSION + + if (MAIN_TAG_VERSION != "unstable") { + stage('get previous release version') { + container('jnlp') { + NEXT_VERSION = github.get_next_tag_version("tsdb-nuclio", git_project_user, GIT_TOKEN) + + echo "$NEXT_VERSION" + next_versions.putAt("tsdb-nuclio", NEXT_VERSION) + } + } + + build_nuclio(MAIN_TAG_VERSION, "unstable") + build_nuclio(MAIN_TAG_VERSION) + + stage('create tsdb-nuclio prerelease') { + container('jnlp') { + echo "Triggered tsdb-nuclio development will be builded with last tsdb stable version" + github.delete_release("tsdb-nuclio", git_project_user, "unstable", GIT_TOKEN) + github.create_prerelease("tsdb-nuclio", git_project_user, "unstable", GIT_TOKEN, "development") + + echo "Trigger tsdb-nuclio ${NEXT_VERSION} with tsdb ${MAIN_TAG_VERSION}" + github.create_prerelease("tsdb-nuclio", git_project_user, NEXT_VERSION, GIT_TOKEN) + } + } + } else { + stage('info') { + echo("Unstable tsdb doesn't trigger tsdb-nuclio") + } + } } } } - } - } - }, - 'prometheus': { - podTemplate(label: "v3io-tsdb-prometheus-${label}", inheritFrom: "${git_project}-${label}") { - node("v3io-tsdb-prometheus-${label}") { - withCredentials([ - usernamePassword(credentialsId: git_deploy_user, passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME'), - string(credentialsId: git_deploy_user_token, variable: 'GIT_TOKEN') - ]) { - def TAG_VERSION - def NEXT_VERSION - - stage('trigger') { - container('jnlp') { - sh """ - cd ${BUILD_FOLDER} - git clone https://${GIT_USERNAME}:${GIT_PASSWORD}@github.com/${git_project_user}/prometheus.git src/github.com/prometheus/prometheus - """ - - TAG_VERSION = sh( - script: "cat ${BUILD_FOLDER}/src/github.com/prometheus/prometheus/VERSION", - returnStdout: true - ).trim() - } - } - - if (TAG_VERSION) { - stage('get previous release version') { - container('jnlp') { - NEXT_VERSION = "v${TAG_VERSION}-${TAG_NAME}" - - echo "$NEXT_VERSION" - next_versions.putAt('prometheus', NEXT_VERSION) - } - } - - build_prometheus(TAG_NAME) - - stage('create prometheus prerelease') { - container('jnlp') { - github.create_prerelease("prometheus", git_project_user, NEXT_VERSION, GIT_TOKEN) + }, + 'prometheus': { + podTemplate(label: "v3io-tsdb-prometheus-${label}", inheritFrom: "${git_project}-${label}") { + node("v3io-tsdb-prometheus-${label}") { + withCredentials([ + string(credentialsId: git_deploy_user_token, variable: 'GIT_TOKEN') + ]) { + def TAG_VERSION + def NEXT_VERSION + + if (MAIN_TAG_VERSION != "unstable") { + stage('get current version') { + container('jnlp') { + sh """ + cd ${BUILD_FOLDER} + git clone https://${GIT_TOKEN}@github.com/${git_project_user}/prometheus.git src/github.com/prometheus/prometheus + """ + + TAG_VERSION = sh( + script: "cat ${BUILD_FOLDER}/src/github.com/prometheus/prometheus/VERSION", + returnStdout: true + ).trim() + } + } + + if (TAG_VERSION) { + stage('get previous release version') { + container('jnlp') { + NEXT_VERSION = "v${TAG_VERSION}-${MAIN_TAG_VERSION}" + + echo "$NEXT_VERSION" + next_versions.putAt('prometheus', NEXT_VERSION) + } + } + + build_prometheus(MAIN_TAG_VERSION, "unstable") + build_prometheus(MAIN_TAG_VERSION) + + stage('create prometheus prerelease') { + container('jnlp') { + echo "Triggered prometheus development will be builded with last tsdb stable version" + github.delete_release("prometheus", git_project_user, "unstable", GIT_TOKEN) + github.create_prerelease("prometheus", git_project_user, "unstable", GIT_TOKEN, "development") + + echo "Trigger prometheus ${NEXT_VERSION} with tsdb ${MAIN_TAG_VERSION}" + github.create_prerelease("prometheus", git_project_user, NEXT_VERSION, GIT_TOKEN) + } + } + } + } else { + stage('info') { + echo("Unstable tsdb doesn't trigger prometheus") + } } } } } } - } - } - ) - } else { - stage('warning') { - if (PUBLISHED_BEFORE >= expired) { - echo "Tag too old, published before $PUBLISHED_BEFORE minutes." - } else { - echo "${MAIN_TAG_VERSION} is not release tag." + ) } } } @@ -417,78 +324,84 @@ spec: withCredentials([ string(credentialsId: git_deploy_user_token, variable: 'GIT_TOKEN') ]) { - stage('waiting for prereleases moved to releases') { - container('jnlp') { - i = 0 - def tasks_list = ['demos': null, 'prometheus': null, 'tsdb-nuclio': null] - def success_count = 0 - - while (true) { - def done_count = 0 - - echo "attempt #${i}" - tasks_list.each { project, status -> - if (status == null) { - def RELEASE_SUCCESS = sh( - script: "curl --silent -H \"Content-Type: application/json\" -H \"Authorization: token ${GIT_TOKEN}\" -X GET https://api.github.com/repos/${git_project_user}/${project}/releases/tags/${next_versions[project]} | python -c 'import json,sys;obj=json.load(sys.stdin);print obj[\"prerelease\"]' | if grep -iq false; then echo 'release'; else echo 'prerelease'; fi", - returnStdout: true - ).trim() - - echo "${project} is ${RELEASE_SUCCESS}" - if (RELEASE_SUCCESS != null && RELEASE_SUCCESS == 'release') { - tasks_list.putAt(project, true) - done_count++ - success_count++ - } else { - def TAG_SHA = sh( - script: "curl --silent -H \"Content-Type: application/json\" -H \"Authorization: token ${GIT_TOKEN}\" -X GET https://api.github.com/repos/${git_project_user}/${project}/git/refs/tags/${next_versions[project]} | python -c 'import json,sys;obj=json.load(sys.stdin);print obj[\"object\"][\"sha\"]'", + if (MAIN_TAG_VERSION != "unstable") { + stage('waiting for prereleases moved to releases') { + container('jnlp') { + i = 0 + def tasks_list = ['prometheus': null, 'tsdb-nuclio': null] + def success_count = 0 + + while (true) { + def done_count = 0 + + echo "attempt #${i}" + tasks_list.each { project, status -> + if (status == null) { + def RELEASE_SUCCESS = sh( + script: "curl --silent -H \"Content-Type: application/json\" -H \"Authorization: token ${GIT_TOKEN}\" -X GET https://api.github.com/repos/${git_project_user}/${project}/releases/tags/${next_versions[project]} | python -c 'import json,sys;obj=json.load(sys.stdin);print obj[\"prerelease\"]' | if grep -iq false; then echo 'release'; else echo 'prerelease'; fi", returnStdout: true ).trim() - if (TAG_SHA != null) { - def COMMIT_STATUS = sh( - script: "curl --silent -H \"Content-Type: application/json\" -H \"Authorization: token ${GIT_TOKEN}\" -X GET https://api.github.com/repos/${git_project_user}/${project}/commits/${TAG_SHA}/statuses | python -c 'import json,sys;obj=json.load(sys.stdin);print obj[0][\"state\"]' | if grep -iq error; then echo 'error'; else echo 'ok'; fi", + echo "${project} is ${RELEASE_SUCCESS}" + if (RELEASE_SUCCESS != null && RELEASE_SUCCESS == 'release') { + tasks_list.putAt(project, true) + done_count++ + success_count++ + } else { + def TAG_SHA = sh( + script: "curl --silent -H \"Content-Type: application/json\" -H \"Authorization: token ${GIT_TOKEN}\" -X GET https://api.github.com/repos/${git_project_user}/${project}/git/refs/tags/${next_versions[project]} | python -c 'import json,sys;obj=json.load(sys.stdin);print obj[\"object\"][\"sha\"]'", returnStdout: true ).trim() - if (COMMIT_STATUS != null && COMMIT_STATUS == 'error') { - tasks_list.putAt(project, false) - done_count++ + + if (TAG_SHA != null) { + def COMMIT_STATUS = sh( + script: "curl --silent -H \"Content-Type: application/json\" -H \"Authorization: token ${GIT_TOKEN}\" -X GET https://api.github.com/repos/${git_project_user}/${project}/commits/${TAG_SHA}/statuses | python -c 'import json,sys;obj=json.load(sys.stdin);print obj[0][\"state\"]' | if grep -iq error; then echo 'error'; else echo 'ok'; fi", + returnStdout: true + ).trim() + if (COMMIT_STATUS != null && COMMIT_STATUS == 'error') { + tasks_list.putAt(project, false) + done_count++ + } } } + } else { + done_count++ } - } else { - done_count++ } - } - if (success_count >= tasks_list.size()) { - echo "all releases have been successfully completed" - break - } + if (success_count >= tasks_list.size()) { + echo "all releases have been successfully completed" + break + } - if (done_count >= tasks_list.size() || i++ > attempts) { - def failed = [] - def notcompleted = [] - def error_string = '' - tasks_list.each { project, status -> - if (status == null) { - notcompleted += project - } else if (status == false) { - failed += project + if (done_count >= tasks_list.size() || i++ > attempts) { + def failed = [] + def notcompleted = [] + def error_string = '' + tasks_list.each { project, status -> + if (status == null) { + notcompleted += project + } else if (status == false) { + failed += project + } } + if (failed.size()) { + error_string += failed.join(',') + ' have been failed :_(. ' + } + if (notcompleted.size()) { + error_string += notcompleted.join(',') + ' have been not completed :(. ' + } + error(error_string) + break } - if (failed.size()) { - error_string += failed.join(',') + ' have been failed :_(. ' - } - if (notcompleted.size()) { - error_string += notcompleted.join(',') + ' have been not completed :(. ' - } - error(error_string) - break - } - sleep(60) + sleep(60) + } } } + } else { + stage('info') { + echo("Unstable tsdb doesn't trigger tsdb-nuclio and prometheus") + } } stage('update release status') { diff --git a/vendor/github.com/v3io/v3io-tsdb/pkg/appender/store.go b/vendor/github.com/v3io/v3io-tsdb/pkg/appender/store.go index 4d5dfc9d787..72e6c8cd23f 100644 --- a/vendor/github.com/v3io/v3io-tsdb/pkg/appender/store.go +++ b/vendor/github.com/v3io/v3io-tsdb/pkg/appender/store.go @@ -65,8 +65,7 @@ type chunkStore struct { aggrList *aggregate.AggregatesList pending pendingList maxTime int64 - initMaxTime int64 // Max time read from DB metric before first append - delRawSamples bool // TODO: for metrics w aggregates only + delRawSamples bool // TODO: for metrics w aggregates only } func (cs *chunkStore) isAggr() bool { @@ -209,7 +208,6 @@ func (cs *chunkStore) processGetResp(mc *MetricsCache, metric *MetricState, resp if !mc.cfg.OverrideOld { cs.maxTime = maxTime - cs.initMaxTime = maxTime } if !cs.isAggr() { @@ -314,8 +312,8 @@ func (cs *chunkStore) writeChunks(mc *MetricsCache, metric *MetricState) (hasPen for pendingSampleIndex < len(cs.pending) && pendingSamplesCount < mc.cfg.BatchSize && partition.InRange(cs.pending[pendingSampleIndex].t) { sampleTime := cs.pending[pendingSampleIndex].t - if sampleTime <= cs.initMaxTime && !mc.cfg.OverrideOld { - mc.logger.WarnWith("Omitting the sample - time is earlier than the last sample time for this metric", "metric", metric.Lset, "T", sampleTime, "InitMaxTime", cs.initMaxTime) + if sampleTime <= cs.maxTime && !mc.cfg.OverrideOld { + mc.logger.WarnWith("Omitting the sample - time is earlier than the last sample time for this metric", "metric", metric.Lset, "T", sampleTime) pendingSampleIndex++ continue } diff --git a/vendor/github.com/v3io/v3io-tsdb/pkg/pquerier/select.go b/vendor/github.com/v3io/v3io-tsdb/pkg/pquerier/select.go index 0fcd77897bd..bf5db91031b 100644 --- a/vendor/github.com/v3io/v3io-tsdb/pkg/pquerier/select.go +++ b/vendor/github.com/v3io/v3io-tsdb/pkg/pquerier/select.go @@ -449,9 +449,6 @@ func (queryCtx *selectQueryContext) getResultBucketsSize() int { if queryCtx.isRawQuery() { return 0 } - if queryCtx.queryParams.To-queryCtx.queryParams.From == queryCtx.queryParams.Step { - return 1 - } return int((queryCtx.queryParams.To-queryCtx.queryParams.From)/queryCtx.queryParams.Step + 1) } diff --git a/vendor/github.com/v3io/v3io-tsdb/travis_v3io.yaml b/vendor/github.com/v3io/v3io-tsdb/travis_v3io.yaml index 49654869e97..6940bb91ee6 100644 --- a/vendor/github.com/v3io/v3io-tsdb/travis_v3io.yaml +++ b/vendor/github.com/v3io/v3io-tsdb/travis_v3io.yaml @@ -1,6 +1,6 @@ container: "bigdata" workers: 1 -webApiEndpoint: "webapi.iguazio.app.tsdb-integration.iguazio-cd0.com" +webApiEndpoint: "webapi.default-tenant.app.tsdb-integration.iguazio-cd2.com" username: "iguazio" -password: "e244737b57d86fde05f747e47514c4c2" +password: "UwAH8CXfDEBHpoo4" loglevel: "debug" diff --git a/vendor/github.com/v3io/v3io-tsdb/travis_v3io_bench.yaml b/vendor/github.com/v3io/v3io-tsdb/travis_v3io_bench.yaml index b9c08721875..c935dfe8014 100644 --- a/vendor/github.com/v3io/v3io-tsdb/travis_v3io_bench.yaml +++ b/vendor/github.com/v3io/v3io-tsdb/travis_v3io_bench.yaml @@ -1,8 +1,8 @@ container: "bigdata" workers: 8 -webApiEndpoint: "webapi.iguazio.app.tsdb-integration.iguazio-cd0.com" +webApiEndpoint: "webapi.default-tenant.app.tsdb-integration.iguazio-cd2.com" username: "iguazio" -password: "e244737b57d86fde05f747e47514c4c2" +password: "UwAH8CXfDEBHpoo4" batchSize: 2048 performance: