./hack/module.sh learns codegen command

Runs code generation on a per-module basis. If `CONTAINED` is not set
the code generation is run in a container.

Mount point in docker is randomzied to simulate Concourse.

Introduce K8S_PKG_VERSION to make room to build different versions
eventually.
This commit is contained in:
aram price
2020-08-18 09:50:07 -04:00
committed by Andrew Keesler
parent 29654c39a5
commit a456daa0b2
3 changed files with 111 additions and 1 deletions
+6 -1
View File
@@ -33,6 +33,10 @@ function unittest_cmd() {
echo "${cmd} -short -race ./..."
}
function codegen_cmd() {
echo "${ROOT}/hack/codegen.sh codegen::generate"
}
# The race detector is slow, so sometimes you don't want to use it
function unittest_no_race_cmd() {
if [ -x "$(command -v gotest)" ]; then
@@ -62,7 +66,7 @@ function with_modules() {
function usage() {
echo "Error: <task> must be specified"
echo " do.sh <task> [tidy, lint, test, unittest, unittest_no_race]"
echo " do.sh <task> [tidy, lint, test, unittest, unittest_no_race, codegen]"
exit 1
}
@@ -73,6 +77,7 @@ function main() {
'test') with_modules 'test_cmd' ;;
'unittest') with_modules 'unittest_cmd' ;;
'unittest_no_race') with_modules 'unittest_no_race_cmd' ;;
'codegen') with_modules 'codegen_cmd' ;;
*) usage ;;
esac
}