Skip to content

Commit

Permalink
Add gcr (#22)
Browse files Browse the repository at this point in the history
* gcr
  • Loading branch information
gkirok authored Jul 13, 2020
1 parent 0655258 commit a9011b9
Showing 1 changed file with 22 additions and 51 deletions.
73 changes: 22 additions & 51 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,65 +1,36 @@
label = "${UUID.randomUUID().toString()}"
expired=240
git_project = "nuclio-templates"
git_project_user = "nuclio"
git_project_upstream_user = "nuclio"
git_deploy_user = "iguazio-prod-git-user"
git_deploy_user_token = "iguazio-prod-git-user-token"
git_deploy_user_private_key = "iguazio-prod-git-user-private-key"

podTemplate(label: "${git_project}-${label}", inheritFrom: "jnlp-docker") {
node("${git_project}-${label}") {
withCredentials([
string(credentialsId: git_deploy_user_token, variable: 'GIT_TOKEN')
]) {
def TAG_VERSION
pipelinex = library(identifier: 'pipelinex@DEVOPS-204-pipelinex', retriever: modernSCM(
[$class: 'GitSCMSource',
credentialsId: git_deploy_user_private_key,
remote: "[email protected]:iguazio/pipelinex.git"])).com.iguazio.pipelinex

common.notify_slack {
stage('get tag data') {
container('jnlp') {
TAG_VERSION = github.get_tag_version(TAG_NAME)
PUBLISHED_BEFORE = github.get_tag_published_before(git_project, git_project_user, "${TAG_VERSION}", GIT_TOKEN)

echo "$TAG_VERSION"
echo "$PUBLISHED_BEFORE"
}
}

if (TAG_VERSION != null && TAG_VERSION.length() > 0 && PUBLISHED_BEFORE < expired) {
parallel(
'source archive': {
container('jnlp') {
sh("wget https://github.com/${git_project_user}/${git_project}/archive/${TAG_VERSION}.zip")
pipelinex = library(identifier: 'pipelinex@development', retriever: modernSCM(
[$class : 'GitSCMSource',
credentialsId: git_deploy_user_private_key,
remote : "[email protected]:iguazio/pipelinex.git"])).com.iguazio.pipelinex
common.notify_slack {
withCredentials([
string(credentialsId: git_deploy_user_token, variable: 'GIT_TOKEN')
]) {
github.release(git_deploy_user, git_project, git_project_user, git_project_upstream_user, true, GIT_TOKEN) {
stage("upload ${git_project} zip to artifactory") {
container('jnlp') {
sh("wget https://github.com/${git_project_user}/${git_project}/archive/${github.TAG_VERSION}.zip")

zip_path = sh(
script: "pwd",
returnStdout: true
).trim()
zip_path = sh(
script: "pwd",
returnStdout: true
).trim()

withCredentials([
string(credentialsId: pipelinex.PackagesRepo.ARTIFACTORY_IGUAZIO[2], variable: 'PACKAGES_ARTIFACTORY_PASSWORD')
]) {
common.upload_file_to_artifactory(pipelinex.PackagesRepo.ARTIFACTORY_IGUAZIO[0], pipelinex.PackagesRepo.ARTIFACTORY_IGUAZIO[1], PACKAGES_ARTIFACTORY_PASSWORD, "iguazio-devops/nuclio-templates", "${TAG_VERSION}.zip", zip_path)
}
}
withCredentials([
string(credentialsId: pipelinex.PackagesRepo.ARTIFACTORY_IGUAZIO[2], variable: 'PACKAGES_ARTIFACTORY_PASSWORD')
]) {
common.upload_file_to_artifactory(pipelinex.PackagesRepo.ARTIFACTORY_IGUAZIO[0], pipelinex.PackagesRepo.ARTIFACTORY_IGUAZIO[1], PACKAGES_ARTIFACTORY_PASSWORD, "iguazio-devops/nuclio-templates", "${github.TAG_VERSION}.zip", zip_path)
}
)

stage('update release status') {
container('jnlp') {
github.update_release_status(git_project, git_project_user, "${TAG_VERSION}", GIT_TOKEN)
}
}
} else {
stage('warning') {
if (PUBLISHED_BEFORE >= expired) {
currentBuild.result = 'ABORTED'
error("Tag too old, published before $PUBLISHED_BEFORE minutes.")
} else {
currentBuild.result = 'ABORTED'
error("${TAG_VERSION} is not release tag.")
}
}
}
Expand Down

0 comments on commit a9011b9

Please sign in to comment.