mirror of
https://github.com/containers/podman.git
synced 2025-10-18 19:53:58 +08:00
[CI:DOCS] Improvements to make validatepr
Small usability improvements for our containerized validate target. - Responds to SIGINT - Exits if build fails, only validate if builds succeed - Warns about potential of insufficient memory - Document `make validatepr` Signed-off-by: Ashley Cui <acui@redhat.com>
This commit is contained in:
@ -291,13 +291,7 @@ commit automatically with `git commit -s`.
|
|||||||
|
|
||||||
### Go Format and lint
|
### Go Format and lint
|
||||||
|
|
||||||
All code changes must pass ``make validate`` and ``make lint``.
|
All code changes must pass ``make validatepr``.
|
||||||
|
|
||||||
```
|
|
||||||
podman build -t gate -f contrib/gate/Dockerfile .
|
|
||||||
```
|
|
||||||
|
|
||||||
***N/B:*** **don't miss the dot (.) at the end, it's really important**
|
|
||||||
|
|
||||||
### Integration Tests
|
### Integration Tests
|
||||||
|
|
||||||
|
1
Makefile
1
Makefile
@ -324,6 +324,7 @@ validatepr:
|
|||||||
$(PODMANCMD) run --rm \
|
$(PODMANCMD) run --rm \
|
||||||
-v $(CURDIR):/go/src/github.com/containers/podman \
|
-v $(CURDIR):/go/src/github.com/containers/podman \
|
||||||
--security-opt label=disable \
|
--security-opt label=disable \
|
||||||
|
-it \
|
||||||
-w /go/src/github.com/containers/podman \
|
-w /go/src/github.com/containers/podman \
|
||||||
quay.io/libpod/validatepr:latest \
|
quay.io/libpod/validatepr:latest \
|
||||||
make .validatepr
|
make .validatepr
|
||||||
|
@ -6,18 +6,46 @@ set -x
|
|||||||
# This script is intended to help developers contribute to the podman project. It
|
# This script is intended to help developers contribute to the podman project. It
|
||||||
# checks various pre-CI checks like building, linting, man-pages, etc. It is meant
|
# checks various pre-CI checks like building, linting, man-pages, etc. It is meant
|
||||||
# to be run in a specific container environment.
|
# to be run in a specific container environment.
|
||||||
#
|
|
||||||
|
|
||||||
# build all require incantations of podman
|
build() {
|
||||||
echo "Building windows ..."
|
err=""
|
||||||
GOOS=windows CGO_ENABLED=0 go build -tags "$REMOTETAGS" -o bin/test.windows ./cmd/podman
|
|
||||||
echo "Building darwin..."
|
|
||||||
GOOS=darwin CGO_ENABLED=0 go build -tags "$REMOTETAGS" -o bin/test.darwin ./cmd/podman
|
|
||||||
|
|
||||||
# build podman
|
echo "Building windows"
|
||||||
echo "Building podman binaries ..."
|
if ! GOOS=windows CGO_ENABLED=0 go build -tags "$REMOTETAGS" -o bin/podman-remote-windows ./cmd/podman; then
|
||||||
make binaries
|
err+="\n - Windows "
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Building darwin"
|
||||||
|
if ! GOOS=darwin CGO_ENABLED=0 go build -tags "$REMOTETAGS" -o bin/podman-remote-darwin ./cmd/podman; then
|
||||||
|
err+="\n - Darwin "
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Running validation tooling ..."
|
echo "Building podman binaries"
|
||||||
make validate
|
if ! make binaries; then
|
||||||
|
err+="\n - Additional Binaries "
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -z "$err" ]
|
||||||
|
then
|
||||||
|
echo -e "\033[31mFailed to build: ${err}\033[0m">&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
validate(){
|
||||||
|
echo "Running validation tooling"
|
||||||
|
|
||||||
|
# golangci-lint gobbles memory.
|
||||||
|
# By default, podman machines only have 2GB memory,
|
||||||
|
# often causing the linter be killed when run on Darwin/Windows
|
||||||
|
mem=$(awk '/MemTotal/ {print $2}' /proc/meminfo)
|
||||||
|
if (( $((mem)) < 3900000 )); then
|
||||||
|
echo -e "\033[33mWarning: Your machine may not have sufficient memory (< 4 GB)to run the linter. \
|
||||||
|
If the process is killed, please allocate more memory.\033[0m">&2
|
||||||
|
fi
|
||||||
|
|
||||||
|
make validate
|
||||||
|
}
|
||||||
|
|
||||||
|
build
|
||||||
|
validate
|
||||||
|
Reference in New Issue
Block a user