forked from v3io/v3io-py
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
58 lines (54 loc) · 3.66 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
50
51
52
53
54
55
56
57
58
label = "${UUID.randomUUID().toString()}"
git_project = "v3io-py"
git_project_user = "v3io"
git_project_upstream_user = "v3io"
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-golang-python37") {
node("${git_project}-${label}") {
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) {
RELEASE_ID = github.get_release_id(git_project, git_project_user, "${github.TAG_VERSION}", GIT_TOKEN)
parallel(
'upload to pypi': {
container('python37') {
if( "${github.TAG_VERSION}" != "unstable" ) {
withCredentials([
usernamePassword(credentialsId: "v3io-pypi-credentials", passwordVariable: 'V3IO_PYPI_PASSWORD', usernameVariable: 'V3IO_PYPI_USER'),
usernamePassword(credentialsId: "iguazio-prod-artifactory-credentials", passwordVariable: 'V3IO_ARTIFACTORY_PASSWORD', usernameVariable: 'V3IO_ARTIFACTORY_USER')
]) {
dir("${github.BUILD_FOLDER}/src/github.com/${git_project_upstream_user}/${git_project}") {
try {
common.shellc("pip install pipenv setuptools")
common.shellc("make update-deps")
common.shellc("make sync-deps")
pypi_version = sh(
script: "echo ${github.DOCKER_TAG_VERSION} | awk -F - '{print \$1}'",
returnStdout: true
).trim()
artifactory_repo_url="http://${pipelinex.PackagesRepo.ARTIFACTORY_IGUAZIO[0]}/artifactory/api/pypi/v3io_pypi"
common.shellc("ARTIFACTORY_PYPI_URL=${artifactory_repo_url} TRAVIS_REPO_SLUG=v3io/v3io-py V3IO_PYPI_USER=${V3IO_PYPI_USER} V3IO_PYPI_PASSWORD=${V3IO_PYPI_PASSWORD} TRAVIS_TAG=${pypi_version} make upload")
} catch (err) {
unstable("Failed uploading to pypi")
// Do not continue stages
throw err
}
}
}
} else {
echo "Uploading to pypi only stable version"
}
}
}
)
}
}
}
}
}