Files
kaolin/ci/gitlab_jenkins_templates/windows_wheels_CI.jenkins
2024-01-16 17:22:21 +08:00

85 lines
2.5 KiB
Groovy

#!/usr/bin/env groovy
docker_registry_server = ImageTag.split(':')[0..1].join(':')
currentBuild.displayName = ImageTag.split(':')[2]
currentBuild.description = sourceBranch + ": " + commitHash
// to manage image secrets:
// 1) log into docker
// docker login gitlab-master.nvidia.com:5005
// 2) create secret
// kubectl create secret docker-registry test-secret -n kaolin --docker-server=gitlab-master.nvidia.com:5005 --docker-username azook --docker-password XXX
// 3) add to service account
// https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#add-imagepullsecrets-to-a-service-account
// kubectl patch kaolin-sa default -p '{"imagePullSecrets": [{"name": "myregistrykey"}]}'
// 4) add to pod template
gitlabCommitStatus("test-${configName}") {
podTemplate(cloud:'sc-ipp-blossom-116',
slaveConnectTimeout: 4000,
yaml: """
apiVersion: v1
kind: Pod
spec:
volumes:
- name: pvc-mount
persistentVolumeClaim:
claimName: 'kaolin-pvc'
containers:
- name: jnlp
image: urm.nvidia.com/sw-ipp-blossom-sre-docker-local/jnlp-agent:jdk11-windows
env:
- name: JENKINS_AGENT_WORKDIR
value: C:/Jenkins/agent
- name: windows
image: ${imageTag}
restartPolicy: Never
backoffLimit: 4
tty: true
volumeMounts:
- mountPath: c:/mnt
name: pvc-mount
imagePullSecrets:
- name: gitlabcred
nodeSelector:
kubernetes.io/os: windows
"""
)
{
node(POD_LABEL) {
container("windows") {
stage("Basic test") {
powershell '''
python --version
python -c "import kaolin; print(kaolin.__version__)"
python -c "import torch; print(torch.__version__)"
'''
}
if (currentBuild.getCurrentResult() != "FAILURE") {
stage("Push wheels on volume") {
def cudaTag = cudaVer.split('\\.')[0..<2].join('')
withEnv(["cudaTag=$cudaTag"]) {
powershell '''
New-Item -Path /mnt/whl/torch-"$env:torchVer"_cu"$env:cudaTag" -ItemType "directory" -Force
'''
powershell '''
cp /kaolin/kaolin-*.whl /mnt/whl/torch-"$env:torchVer"_cu"$env:cudaTag"/
'''
}
}
stage("Push wheels on artifacts") {
// archiveArtifacts only take relative path, and the working directory doesn't work in jenkins
// So we copy from /kaolin to current dir
powershell '''
cp /kaolin/kaolin-*.whl .
'''
archiveArtifacts artifacts: "kaolin-*.whl"
}
}
}
}
}
} // gitlabCommitStatus