-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a57fa44
commit e38a2a4
Showing
9 changed files
with
2,753 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
HOST = https://carla-releases.s3.eu-west-3.amazonaws.com/Linux | ||
RELEASE=CARLA_0.9.9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
from ubuntu:18.04 | ||
|
||
# Install base libs | ||
run apt-get update && apt-get install --no-install-recommends -y libpng16-16=1.6.34-1ubuntu0.18.04.2 \ | ||
libtiff5=4.0.9-5ubuntu0.3 libjpeg8=8c-2ubuntu8 build-essential=12.4ubuntu1 wget=1.19.4-1ubuntu2.2 git=1:2.17.1-1ubuntu0.7 \ | ||
python3.6=3.6.9-1~18.04ubuntu1 python3.6-dev=3.6.9-1~18.04ubuntu1 python3-pip=9.0.1-2.3~ubuntu1.18.04.1 \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Install python requirements | ||
run pip3 install --user setuptools==46.3.0 wheel==0.34.2 && pip3 install py_trees==0.8.3 networkx==2.2 pygame==1.9.6 \ | ||
six==1.14.0 numpy==1.18.4 psutil==5.7.0 shapely==1.7.0 xmlschema==1.1.3 ephem==3.7.6.0 tabulate==0.8.7\ | ||
&& mkdir -p /app/scenario_runner | ||
|
||
# Install scenario_runner | ||
copy . /app/scenario_runner | ||
|
||
# setup environment : | ||
# | ||
# CARLA_HOST : uri for carla package without trailing slash. | ||
# For example, "https://carla-releases.s3.eu-west-3.amazonaws.com/Linux". | ||
# If this environment is not passed to docker build, the value | ||
# is taken from CARLA_VER file inside the repository. | ||
# | ||
# CARLA_RELEASE : Name of the package to be used. For example, "CARLA_0.9.9". | ||
# If this environment is not passed to docker build, the value | ||
# is taken from CARLA_VER file inside the repository. | ||
# | ||
# | ||
# It's expected that $(CARLA_HOST)/$(CARLA_RELEASE).tar.gz is a downloadable resource. | ||
# | ||
|
||
env CARLA_HOST "" | ||
env CARLA_RELEASE "" | ||
|
||
# Extract and install python API and resources from CARLA | ||
run export DEFAULT_CARLA_HOST="$(sed -e 's/^\s*HOST\s*=\s*//;t;d' /app/scenario_runner/CARLA_VER)" && \ | ||
echo "$DEFAULT_CARLA_HOST" && \ | ||
export CARLA_HOST="${CARLA_HOST:-$DEFAULT_CARLA_HOST}" && \ | ||
export DEFAULT_CARLA_RELEASE="$(sed -e 's/^\s*RELEASE\s*=\s*//;t;d' /app/scenario_runner/CARLA_VER)" && \ | ||
export CARLA_RELEASE="${CARLA_RELEASE:-$DEFAULT_CARLA_RELEASE}" && \ | ||
echo "$CARLA_HOST/$CARLA_RELEASE.tar.gz" && \ | ||
wget -qO- "$CARLA_HOST/$CARLA_RELEASE.tar.gz" | tar -xzv PythonAPI/carla -C / && \ | ||
mv /PythonAPI/carla /app/ && \ | ||
python3 -m easy_install --no-find-links --no-deps "$(find /app/carla/ -iname '*py3.*.egg' )" | ||
|
||
|
||
# Setup working environment | ||
workdir /app/scenario_runner | ||
env PYTHONPATH "${PYTHONPATH}:/app/carla/agents:/app/carla" | ||
entrypoint ["/bin/sh" ] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,186 @@ | ||
#!/usr/bin/env groovy | ||
|
||
|
||
String CARLA_HOST | ||
String CARLA_RELEASE | ||
String TEST_HOST | ||
String COMMIT | ||
String ECR_REPOSITORY = "456841689987.dkr.ecr.eu-west-3.amazonaws.com/scenario_runner" | ||
boolean CARLA_RUNNING = false | ||
boolean CONCURRENCY = true | ||
|
||
// V3 - include detection of concurrent builds | ||
|
||
pipeline | ||
{ | ||
agent none | ||
|
||
options | ||
{ | ||
buildDiscarder(logRotator(numToKeepStr: '3', artifactNumToKeepStr: '3')) | ||
skipDefaultCheckout() | ||
} | ||
|
||
stages | ||
{ | ||
stage('setup') | ||
{ | ||
agent { label "master" } | ||
steps | ||
{ | ||
checkout scm | ||
script | ||
{ | ||
jenkinsLib = load("/home/jenkins/scenario_runner.groovy") | ||
TEST_HOST = jenkinsLib.getUbuntuTestNodeHost() | ||
CARLA_HOST= sh( | ||
script: "cat ./CARLA_VER | grep HOST | sed 's/HOST\\s*=\\s*//g'", | ||
returnStdout: true).trim() | ||
CARLA_RELEASE = sh( | ||
script: "cat ./CARLA_VER | grep RELEASE | sed 's/RELEASE\\s*=\\s*//g'", | ||
returnStdout: true).trim() | ||
COMMIT = sh(returnStdout: true, script: "git log -n 1 --pretty=format:'%h'").trim() | ||
} | ||
println "using CARLA version ${CARLA_RELEASE} from ${TEST_HOST}" | ||
} | ||
} | ||
stage('get concurrency status') | ||
{ | ||
options | ||
{ | ||
lock resource: 'ubuntu_gpu', skipIfLocked: true | ||
} | ||
agent { label "master" } | ||
steps | ||
{ | ||
script | ||
{ | ||
CONCURRENCY = false | ||
println "no concurrent builds detected." | ||
} | ||
} | ||
} | ||
stage('act on concurrency') | ||
{ | ||
agent { label "master" } | ||
steps | ||
{ | ||
script | ||
{ | ||
if ( CONCURRENCY == true ) | ||
{ | ||
println "concurrent builds detected, prebuilding SR image." | ||
stage('prebuild SR docker image') | ||
{ | ||
//checkout scm | ||
sh "docker build -t jenkins/scenario_runner:${COMMIT} ." | ||
sh "docker tag jenkins/scenario_runner:${COMMIT} ${ECR_REPOSITORY}:${COMMIT}" | ||
sh '$(aws ecr get-login | sed \'s/ -e none//g\' )' | ||
sh "docker push ${ECR_REPOSITORY}" | ||
sh "docker image rmi -f \"\$(docker images -q ${ECR_REPOSITORY}:${COMMIT})\"" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
stage('lock ubuntu_gpu instance') | ||
{ | ||
options | ||
{ | ||
lock resource: "ubuntu_gpu" | ||
} | ||
stages | ||
{ | ||
stage('start server') | ||
{ | ||
agent { label "master" } | ||
steps | ||
{ | ||
script | ||
{ | ||
jenkinsLib = load("/home/jenkins/scenario_runner.groovy") | ||
jenkinsLib.StartUbuntuTestNode() | ||
} | ||
} | ||
} | ||
stage('deploy') | ||
{ | ||
parallel | ||
{ | ||
stage('build SR docker image') | ||
{ | ||
agent { label "master" } | ||
steps | ||
{ | ||
script | ||
{ | ||
if ( CONCURRENCY == false ) | ||
{ | ||
//checkout scm | ||
sh "docker build -t jenkins/scenario_runner:${COMMIT} ." | ||
sh "docker tag jenkins/scenario_runner:${COMMIT} ${ECR_REPOSITORY}:${COMMIT}" | ||
sh '$(aws ecr get-login | sed \'s/ -e none//g\' )' | ||
sh "docker push ${ECR_REPOSITORY}" | ||
sh "docker image rmi -f \"\$(docker images -q ${ECR_REPOSITORY}:${COMMIT})\"" | ||
} | ||
else | ||
{ | ||
println "SR docker image already built due concurrency" | ||
} | ||
} | ||
} | ||
} | ||
stage('deploy CARLA') | ||
{ | ||
stages | ||
{ | ||
stage('install CARLA') | ||
{ | ||
agent { label "secondary && ubuntu && gpu && sr" } | ||
steps | ||
{ | ||
println "using CARLA version ${CARLA_RELEASE}" | ||
sh "wget -qO- ${CARLA_HOST}/${CARLA_RELEASE}.tar.gz | tar -xzv -C ." | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
stage('run test') | ||
{ | ||
agent { label "secondary && ubuntu && gpu && sr" } | ||
steps | ||
{ | ||
sh 'DISPLAY= ./CarlaUE4.sh -opengl -nosound > CarlaUE4.log&' | ||
sleep 10 | ||
script | ||
{ | ||
sh '$(aws ecr get-login | sed \'s/ -e none//g\' )' | ||
sh "docker pull ${ECR_REPOSITORY}:${COMMIT}" | ||
sh "docker container run --rm --network host -e LANG=C.UTF-8 \"${ECR_REPOSITORY}:${COMMIT}\" -c \"python3 scenario_runner.py --scenario FollowLeadingVehicle_1 --debug --output --reloadWorld \"" | ||
deleteDir() | ||
} | ||
} | ||
} | ||
} | ||
post | ||
{ | ||
always | ||
{ | ||
node('master') | ||
{ | ||
script | ||
{ | ||
jenkinsLib = load("/home/jenkins/scenario_runner.groovy") | ||
jenkinsLib.StopUbuntuTestNode() | ||
echo 'test node stopped' | ||
sh 'docker system prune --volumes -f' | ||
} | ||
deleteDir() | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018 CARLA | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
Oops, something went wrong.