forked from motional/nuplan-devkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
150 lines (144 loc) · 3.74 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
@Library('jenkins-shared-libraries') _
if (env.BRANCH_NAME != null && ! env.BRANCH_NAME.matches("^(master).*")) {
jobManagement.abortPrevious()
}
pipeline{
agent {
kubernetes(
jnlp.nuplan_devkit(
name: 'nuplan-devkit-tests',
tag: "v1.0.3",
cpu: 8, maxcpu: 8,
memory: "32G", maxmemory: "64G", yaml: """spec:
containers:
- name: builder
volumeMounts:
- mountPath: /data
name: nudeep-ci
subPath: data
- mountPath: /dev/shm
name: dshm
volumes:
- name: nudeep-ci
persistentVolumeClaim:
claimName: nudeep-ci
- name: dshm
emptyDir:
medium: Memory
"""))
}
options {
timestamps()
buildDiscarder(logRotator(numToKeepStr:'10'))
}
environment {
BAZEL_CMD = "bazel --batch"
BAZEL_OPTS = "--local_cpu_resources=8 --jobs=8 --remote_cache=http://bazel-cache.ci.motional.com:80 --remote_upload_local_results=true"
NUPLAN_DATA_ROOT = "/data/sets/nuplan"
NUPLAN_DB_FILES = "/data/sets/nuplan/nuplan-v1.0/mini"
NUPLAN_MAPS_ROOT = "/data/sets/nuplan/maps"
NUPLAN_MAP_VERSION = "nuplan-maps-v1.0"
NUPLAN_EXP_ROOT = "/tmp/exp/nuplan"
NUPLAN_HYDRA_CONFIG_PATH = "config"
}
stages {
stage('Build') {
steps {
container('builder') {
sh """#!/bin/bash -eu
${env.BAZEL_CMD} build \
${env.BAZEL_OPTS} \
//...
"""
}
}
}
stage('Requirements') {
steps {
container('builder') {
sh """#!/bin/bash -eu
pip3 install -r requirements_torch.txt --index-url=${env.PIP_INDEX_URL_INTERNAL}
pip3 install -r requirements.txt --index-url=${env.PIP_INDEX_URL_INTERNAL}
pip3 install tox
"""
}
}
}
stage('Lint') {
failFast false
parallel {
stage('Bazel') {
steps {
container('builder') {
sh """#!/bin/bash -eu
${env.BAZEL_CMD} run :buildifier_test
"""
}
}
post {
failure {
println("Consider running 'bazel run :buildifier'")
}
}
}
stage('Yaml') {
steps {
container('builder') {
sh """#!/bin/bash -eu
tox -e yamllint -- .
"""
}
}
post {
failure {
println("Consider running 'tox -e yamlformat -- .'")
}
}
}
stage('Python') {
steps {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: "Consider running 'tox -e format -- .'") {
container('builder') {
sh """#!/bin/bash -eu
tox -e lint -- .
"""
}
}
}
post {
failure {
println("Consider running 'tox -e format -- .'")
}
}
}
}
}
stage('Test') {
steps {
container('builder') {
sh """#!/bin/bash -eux
${env.BAZEL_CMD} test \
${env.BAZEL_OPTS} \
--action_env=REQUIREMENTS_SHA="\$(sha256sum requirements.txt)" \
--test_tag_filters=-gpu \
//...
"""
}
}
}
stage('Sonarqube') {
steps {
container('builder') {
script {
sh script: """#!/usr/bin/env bash
env
rm -rf bazel-* # remove tree with symlinks, as it may cause sonar-scanner to slow down ot stuck
"""
sonarQube.scanner('builder', """ \
""", true)
}
}
}
}
}
}