Merge pull request #44 from ankeesler/verify-in-ci
hack/verify-codegen.sh: make this script runnable from CI
This commit is contained in:
commit
745775bf4b
@ -11,7 +11,22 @@ CODEGEN_IMAGE=${CODEGEN_IMAGE:-gcr.io/tanzu-user-authentication/k8s-code-generat
|
|||||||
function codegen() {
|
function codegen() {
|
||||||
PKG="$1"
|
PKG="$1"
|
||||||
shift 1
|
shift 1
|
||||||
docker run --rm -v "$ROOT:/go/src/$BASE_PKG" -w "/go/src/$BASE_PKG/$PKG" "${CODEGEN_IMAGE}" "$@" 2>&1 | sed "s|^|$1 ($PKG) > |"
|
if [[ ${IN_DOCKER:-0} -eq 1 ]]; then
|
||||||
|
# Already in a container ($CODEGEN_IMAGE).
|
||||||
|
mkdir -p "$(dirname /go/src/$BASE_PKG/$PKG)"
|
||||||
|
ln -sf "$ROOT" "/go/src/$BASE_PKG/$PKG"
|
||||||
|
cd "/go/src/$BASE_PKG/$PKG"
|
||||||
|
/codegen/entrypoint.sh "$@" 2>&1 | sed "s|^|$1 ($PKG) > |"
|
||||||
|
else
|
||||||
|
# Local workstation.
|
||||||
|
docker run \
|
||||||
|
--rm \
|
||||||
|
--volume "$ROOT:/go/src/$BASE_PKG" \
|
||||||
|
--workdir "/go/src/$BASE_PKG/$PKG" \
|
||||||
|
"${CODEGEN_IMAGE}" \
|
||||||
|
/codegen/entrypoint.sh "$@" 2>&1 \
|
||||||
|
| sed "s|^|$1 ($PKG) > |"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
codegen kubernetes/1.19/api generate-groups deepcopy,defaulter \
|
codegen kubernetes/1.19/api generate-groups deepcopy,defaulter \
|
||||||
|
@ -6,6 +6,4 @@ set -euo pipefail
|
|||||||
ROOT="$(realpath "$(dirname "${BASH_SOURCE[0]}")/..")"
|
ROOT="$(realpath "$(dirname "${BASH_SOURCE[0]}")/..")"
|
||||||
|
|
||||||
"$ROOT/hack/module.sh" lint
|
"$ROOT/hack/module.sh" lint
|
||||||
|
"$ROOT/hack/verify-codegen.sh"
|
||||||
# TODO: re-enable once we figure out how to run docker in CI
|
|
||||||
#"$ROOT/hack/verify-codegen.sh"
|
|
||||||
|
Loading…
Reference in New Issue
Block a user