From e773ed42b39480055f81fcbce50e71a1c6d79278 Mon Sep 17 00:00:00 2001 From: Brent Baude Date: Thu, 4 Apr 2024 09:54:09 -0500 Subject: [PATCH] [CI:DOCS]Initial PR validation This PR is only a first step towards being able to validate developer code locally prior to pushing a PR and using CI. Right now, we have a prepared image in a temporary spot (will change when done). That image can be used to exercise various podman builds, make validate, and DCO check. The idea here is we have a make target that spins a podman container (or machine) and then execute a small script to perform the actual builds. Note, these builds are to verify code, not make production binaries so corners are cut. As of now, we choose to not build cross-arch binaries because most of our problems thus far have been operating system builds and not arch. Of course this can be expanded in the future. This is just step one to start getting some of it in place. The rest of the work is tracked in JIRA under two cards. Signed-off-by: Brent Baude --- Makefile | 12 ++++++++++++ contrib/validatepr/Containerfile | 17 +++++++++++++++++ contrib/validatepr/validatepr.sh | 23 +++++++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 contrib/validatepr/Containerfile create mode 100755 contrib/validatepr/validatepr.sh diff --git a/Makefile b/Makefile index a8691b1d2c..40844bba45 100644 --- a/Makefile +++ b/Makefile @@ -315,6 +315,18 @@ codespell: .PHONY: validate validate: lint .gitvalidation validate.completions man-page-check swagger-check tests-expect-exit pr-removes-fixed-skips +.PHONY: validatepr +validatepr: + $(PODMANCMD) run --rm --env HOME=/root \ + -v $(CURDIR):/var/tmp/go/src/github.com/containers/podman \ + --security-opt label=disable \ + quay.io/libpod/fedora_podman:latest \ + make .validatepr + +.PHONY: .validatepr +.validatepr: + env BUILDTAGS="$(BUILDTAGS)" REMOTETAGS="$(REMOTETAGS)" contrib/validatepr/validatepr.sh + .PHONY: build-all-new-commits build-all-new-commits: # Validate that all the commits build on top of $(GIT_BASE_BRANCH) diff --git a/contrib/validatepr/Containerfile b/contrib/validatepr/Containerfile new file mode 100644 index 0000000000..5eba4c8fbe --- /dev/null +++ b/contrib/validatepr/Containerfile @@ -0,0 +1,17 @@ +FROM registry.fedoraproject.org/fedora:latest + +WORKDIR /go/src/github.com/containers/podman + +RUN dnf install -y systemd-devel \ + libassuan-devel \ + libseccomp-devel \ + gpgme-devel \ + device-mapper-devel \ + btrfs-progs-devel \ + golang \ + make \ + man-db \ + git \ + perl-Clone \ + perl-FindBin \ + pre-commit && dnf clean all diff --git a/contrib/validatepr/validatepr.sh b/contrib/validatepr/validatepr.sh new file mode 100755 index 0000000000..15cd09edb2 --- /dev/null +++ b/contrib/validatepr/validatepr.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +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 podman +echo "Building podman binaries ..." +make binaries + + +echo "Running validation tooling ..." +make validate