Skip to content

Commit

Permalink
Merge pull request #22654 from ashley-cui/val
Browse files Browse the repository at this point in the history
[CI:DOCS] Improvements to make validatepr
  • Loading branch information
openshift-merge-bot[bot] authored May 13, 2024
2 parents 443e377 + 279e2d0 commit f03dc68
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 18 deletions.
8 changes: 1 addition & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,13 +291,7 @@ commit automatically with `git commit -s`.

### Go Format and lint

All code changes must pass ``make validate`` and ``make lint``.

```
podman build -t gate -f contrib/gate/Dockerfile .
```

***N/B:*** **don't miss the dot (.) at the end, it's really important**
All code changes must pass ``make validatepr``.

### Integration Tests

Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ validatepr:
$(PODMANCMD) run --rm \
-v $(CURDIR):/go/src/github.com/containers/podman \
--security-opt label=disable \
-it \
-w /go/src/github.com/containers/podman \
quay.io/libpod/validatepr:latest \
make .validatepr
Expand Down
50 changes: 39 additions & 11 deletions contrib/validatepr/validatepr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,46 @@ set -x
# 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
# to be run in a specific container environment.
#

# build all require incantations of podman
echo "Building windows ..."
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() {
err=""

echo "Building windows"
if ! GOOS=windows CGO_ENABLED=0 go build -tags "$REMOTETAGS" -o bin/podman-remote-windows ./cmd/podman; then
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 "Building podman binaries"
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"

# build podman
echo "Building podman binaries ..."
make binaries
# 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
}

echo "Running validation tooling ..."
make validate
build
validate

1 comment on commit f03dc68

@packit-as-a-service
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

podman-next COPR build failed. @containers/packit-build please check.

Please sign in to comment.