Merge branch 'CNT-1334-publish-tags-to-artifactory' into 'master'
Add artifactory publish step See merge request nvidia/container-toolkit/nvidia-docker!18
This commit is contained in:
commit
9a98d3ff1b
101
Jenkinsfile
vendored
101
Jenkinsfile
vendored
|
@ -19,52 +19,95 @@ podTemplate (cloud:'sw-gpu-cloudnative',
|
||||||
containerTemplate(name: 'docker', image: 'docker:dind', ttyEnabled: true, privileged: true)
|
containerTemplate(name: 'docker', image: 'docker:dind', ttyEnabled: true, privileged: true)
|
||||||
]) {
|
]) {
|
||||||
node(POD_LABEL) {
|
node(POD_LABEL) {
|
||||||
|
def scmInfo
|
||||||
|
|
||||||
stage('checkout') {
|
stage('checkout') {
|
||||||
checkout scm
|
scmInfo = checkout(scm)
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('dependencies') {
|
stage('dependencies') {
|
||||||
container('docker') {
|
container('docker') {
|
||||||
sh 'apk add --no-cache make bash'
|
sh 'apk add --no-cache make bash git'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def versionInfo
|
||||||
|
stage('version') {
|
||||||
|
container('docker') {
|
||||||
|
versionInfo = getVersionInfo(scmInfo)
|
||||||
|
println "versionInfo=${versionInfo}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def dist = 'ubuntu20.04'
|
||||||
|
def arch = 'amd64'
|
||||||
|
def stageLabel = "${dist}-${arch}"
|
||||||
|
|
||||||
stage('build-one') {
|
stage('build-one') {
|
||||||
parallel (
|
container('docker') {
|
||||||
getSingleBuildForArchitectures(["amd64", "ppc64le", "arm64"])
|
stage (stageLabel) {
|
||||||
)
|
sh "make -f mk/docker.mk ADD_DOCKER_PLATFORM_ARGS=true ${dist}-${arch}"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
stage('build-all') {
|
|
||||||
parallel (
|
|
||||||
getAllBuildForArchitectures(["amd64", "ppc64le", "arm64", "x86_64", "aarch64"])
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def getBuildClosure(def architecture, def makeCommand, def makeTarget) {
|
stage('release') {
|
||||||
return {
|
container('docker') {
|
||||||
container('docker') {
|
stage (stageLabel) {
|
||||||
stage(architecture) {
|
|
||||||
sh "${makeCommand} ${makeTarget}"
|
def component = 'main'
|
||||||
|
def repository = 'sw-gpu-cloudnative-debian-local/pool/main/'
|
||||||
|
|
||||||
|
def uploadSpec = """{
|
||||||
|
"files":
|
||||||
|
[ {
|
||||||
|
"pattern": "./dist/${dist}/${arch}/*.deb",
|
||||||
|
"target": "${repository}",
|
||||||
|
"props": "deb.distribution=${dist};deb.component=${component};deb.architecture=${arch}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}"""
|
||||||
|
|
||||||
|
sh "echo starting release with versionInfo=${versionInfo}"
|
||||||
|
if (versionInfo.isTag) {
|
||||||
|
// upload to artifactory repository
|
||||||
|
def server = Artifactory.server 'sw-gpu-artifactory'
|
||||||
|
server.upload spec: uploadSpec
|
||||||
|
} else {
|
||||||
|
sh "echo skipping release for non-tagged build"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def getBuildStagesForArchitectures(def architectures, def makeCommand, def makeTargetPrefix) {
|
// getVersionInfo returns a hash of version info
|
||||||
stages = [:]
|
def getVersionInfo(def scmInfo) {
|
||||||
|
def isMaster = scmInfo.GIT_BRANCH == "master"
|
||||||
|
def isJetson = scmInfo.GIT_BRANCH == "jetson"
|
||||||
|
|
||||||
for (a in architectures) {
|
def isTag = !isMaster && !isJetson
|
||||||
stages[a] = getBuildClosure(a, makeCommand, "${makeTargetPrefix}-${a}")
|
|
||||||
|
def versionInfo = [
|
||||||
|
isMaster: isMaster,
|
||||||
|
isJetson: isJetson,
|
||||||
|
isTag: isTag(scmInfo.GIT_BRANCH)
|
||||||
|
]
|
||||||
|
|
||||||
|
scmInfo.each { k, v -> versionInfo[k] = v }
|
||||||
|
return versionInfo
|
||||||
|
}
|
||||||
|
|
||||||
|
def isTag(def branch) {
|
||||||
|
if (!branch.startsWith('v')) {
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
return stages
|
def version = shOutput('git describe --all --exact-match --always')
|
||||||
|
return version == "tags/${branch}"
|
||||||
}
|
}
|
||||||
|
|
||||||
def getSingleBuildForArchitectures(def architectures) {
|
def shOuptut(def script) {
|
||||||
return getBuildStagesForArchitectures(architectures, "make", "ubuntu18.04")
|
return sh(script: script, returnStdout: true).trim()
|
||||||
}
|
}
|
||||||
|
|
||||||
def getAllBuildForArchitectures(def architectures) {
|
|
||||||
// TODO: For the time being we only echo the command for the "all" stages
|
|
||||||
return getBuildStagesForArchitectures(architectures, "echo make", "docker")
|
|
||||||
}
|
|
Loading…
Reference in a new issue