-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile.autoware-auto-odd
117 lines (88 loc) · 4.22 KB
/
Makefile.autoware-auto-odd
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
COMPOSE_PROJECT_NAME=awf_scenario_runner
export COMPOSE_PROJECT_NAME
COMPOSE:=docker-compose -f docker/docker-compose-dev.autoware-auto-odd.yml
SCENARIO_RUNNER_IMAGE:=awf_scenario_runner_devenv:latest
export SCENARIO_RUNNER_IMAGE
BUILD_REF:="devenv-$(shell git describe --always --tag)"
export BUILD_REF
# To disable "docker build" from using cached base images and layers, invoke "make" with NO_BUILD_CACHE=1.
ifdef NO_BUILD_CACHE
DOCKER_BUILD_OPTS:=--pull --no-cache
endif
# PYTHON_VERSION_TAG is the version portion of the tag of the Python base image to be used. It can be MAJOR.MINOR.PATCH or just
# MAJOR.MINOR .
ifdef PYTHON_VERSION_TAG
RUNNER_BASE_TAG:=autoware-auto-odd-$(PYTHON_VERSION_TAG)
REQUIREMENTS_TXT:=requirements-$(PYTHON_VERSION_TAG).txt
BUILD_ARG__PYTHON_VERSION_MAJOR_MINOR:=$(shell set - $(subst ., ,$(PYTHON_VERSION_TAG)); echo --build-arg PYTHON_VERSION_MAJOR_MINOR=$$1.$$2)
# BUILD_ARG__PYTHON_VERSION_PATCH includes the leading "." unless there isn't a patch version field in PYTHON_VERSION_TAG, in
# which case the value is empty.
BUILD_ARG__PYTHON_VERSION_PATCH:=$(shell set - $(subst ., ,$(PYTHON_VERSION_TAG)); echo --build-arg PYTHON_VERSION_PATCH=$${3:+.$${3}})
BUILD_ARG__REQUIREMENTS_TXT:=--build-arg REQUIREMENTS_TXT=$(REQUIREMENTS_TXT)
else
RUNNER_BASE_TAG:=latest
# Use the defaults specified in docker/Dockerfile for PYTHON_VERSION_MAJOR_MINOR, PYTHON_VERSION_PATCH, and REQUIREMENTS_TXT.
# However, the latter is needed in this file, so extract its default from there.
REQUIREMENTS_TXT:=$(shell awk 'toupper($$1) == "ARG" && $$2 ~ /^REQUIREMENTS_TXT=/ { print gensub(/^REQUIREMENTS_TXT=/, "", 1, $$2); exit }' docker/Dockerfile.autoware-auto-odd)
endif
build-base:
docker build $(DOCKER_BUILD_OPTS) -f docker/Dockerfile.autoware-auto-odd \
-t local/awf_scenario_runner_base:$(RUNNER_BASE_TAG) \
$(BUILD_ARG__PYTHON_VERSION_MAJOR_MINOR) \
$(BUILD_ARG__PYTHON_VERSION_PATCH) \
$(BUILD_ARG__REQUIREMENTS_TXT) \
.
upgrade-base-dependencies:
touch $(REQUIREMENTS_TXT)
docker build --pull --no-cache -f docker/Dockerfile.autoware-auto-odd \
--target builder \
-t local/awf_scenario_runner_base_requirements \
$(BUILD_ARG__PYTHON_VERSION_MAJOR_MINOR) \
$(BUILD_ARG__PYTHON_VERSION_PATCH) \
$(BUILD_ARG__REQUIREMENTS_TXT) \
--build-arg GENERATE_REQUIREMENTS_TXT=true \
.
# Don't include the packages that we build.
docker run --rm local/awf_scenario_runner_base_requirements python3 -m pip freeze | grep -v '@ file://' > $(REQUIREMENTS_TXT)
docker image rm local/awf_scenario_runner_base_requirements
build-devenv: build-base
docker build $(DOCKER_BUILD_OPTS) -f docker/Dockerfile.devenv --build-arg BASE_IMAGE=local/awf_scenario_runner_base -t local/awf_scenario_runner_devenv .
build: compose-build list-devenv-images
compose-build:
${COMPOSE} build
docker tag autoware-auto-odd-runner:latest auto-gitlab.lgsvl.net:4567/hdrp/scenarios/runner/autoware-auto-odd:dev
list-devenv-images:
@docker images | grep -E "^REPOSITORY|^${COMPOSE_PROJECT_NAME}|hdrp/scenarios/runner|^autoware-auto-odd-runner"
docker-latest-rel:
docker tag autoware-auto-odd-runner:latest lgsvl/simulator-scenarios-autoware-auto-odd-runner:latest
docker images | grep -E 'awf_scenario_runner' | sort
shell:
./scripts/scenario_runner.sh
env:
./scripts/scenario_runner.sh env
run-help:
./scripts/scenario_runner.sh run --help
devenv:
${COMPOSE} run --rm devenv /bin/bash
cleanup:
${COMPOSE} rm
flake8:
${COMPOSE} run --rm devenv flake8 autoware-auto-odd-runner
test:
${COMPOSE} run --rm devenv pytest -s -v autoware-auto-odd-runner/tests
submodules-pull-master:
git submodule init
git submodule update
git submodule foreach git checkout master
git submodule foreach git pull
git status
inspect-labels:
docker inspect --format {{.Config.Labels}} ${SCENARIO_RUNNER_IMAGE}
version:
./scripts/scenario_runner.sh version
SIMULATOR_DIR?=/home/user/path/to/simulator
.check_simulator_dir:
@test -d ${SIMULATOR_DIR} || (echo "E: Can't locate simulator dir at ${SIMULATOR_DIR}. Make sure SIMULATOR_DIR env var points to correct path"; exit 1)
push-ci-trybyild:
git push origin -f HEAD:ci-master && git push origin -f && git tag -f CI-TAG && git push origin -f CI-TAG
@echo "\r\nURL https://auto-gitlab.lgsvl.net/HDRP/Scenarios/runner/pipelines"