Skip to content

Commit 6978154

Browse files
committed
Makefile: add "verify" target to test install of packages
This verify step is primarily intended to verify that dependencies are defined correctly, and available on the given distro. Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent a18ae7e commit 6978154

File tree

4 files changed

+26
-9
lines changed

4 files changed

+26
-9
lines changed

Jenkinsfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ def genBuildStep(LinkedHashMap pkg, String arch) {
4444
sh 'docker info'
4545
}
4646
stage("build") {
47-
try {
48-
checkout scm
49-
sh "make REF=$branch ${pkg.target}"
50-
} finally {
51-
sh "make clean"
52-
}
47+
checkout scm
48+
sh "make clean"
49+
sh "make REF=$branch ${pkg.target}"
50+
}
51+
stage("verify") {
52+
sh "make IMAGE=${pkg.image} verify"
5353
}
5454
}
5555
}

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,13 @@ static: checkout ## build static-compiled packages
9797
for p in $(DOCKER_BUILD_PKGS); do \
9898
$(MAKE) -C $@ VERSION=$(VERSION) GO_VERSION=$(GO_VERSION) TARGETPLATFORM=$(TARGETPLATFORM) CONTAINERD_VERSION=$(CONTAINERD_VERSION) RUNC_VERSION=$(RUNC_VERSION) $${p}; \
9999
done
100+
101+
.PHONY: verify
102+
verify: ## verify installation of packages
103+
# to verify using packages from staging, use: make VERIFY_PACKAGE_REPO=stage IMAGE=ubuntu:focal verify
104+
docker run $(VERIFY_PLATFORM) --rm -i \
105+
-v "$$(pwd):/v" \
106+
-e DEBIAN_FRONTEND=noninteractive \
107+
-e PACKAGE_REPO=$(VERIFY_PACKAGE_REPO) \
108+
-w /v \
109+
$(IMAGE) ./verify

common.mk

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ DOCKER_SCAN_REF ?= v0.17.0
4343
DOCKER_COMPOSE_REF ?= v2.5.1
4444
DOCKER_BUILDX_REF ?= v0.8.2
4545

46+
# Use "stage" to install dependencies from download-stage.docker.com during the
47+
# verify step. Leave empty or use any other value to install from download.docker.com
48+
VERIFY_PACKAGE_REPO ?= staging
49+
50+
# Optional flags like --platform=linux/armhf
51+
VERIFY_PLATFORM ?=
52+
4653
export BUILDTIME
4754
export DEFAULT_PRODUCT_LICENSE
4855
export PACKAGER_NAME

verify

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# Description: This runs a smoke test to verify that the packages can be installed corrected
77
###
88

9-
# packaging/build/${DIST_ID}/${DIST_VERSION}/${ARCH} - location of all packages
9+
# build/${DIST_ID}/${DIST_VERSION}/${ARCH} - location of all packages
1010
# Manually Testing: docker run --rm -it -v $(pwd):/v -w /v "centos:7" ./verify
1111

1212
set -e
@@ -47,7 +47,7 @@ function verify_deb() {
4747

4848
install_debian_containerd
4949

50-
packages=$(find "packaging/deb/debbuild/${DIST_ID}-${DIST_VERSION}/" -type f -name "*.deb")
50+
packages=$(find "deb/debbuild/${DIST_ID}-${DIST_VERSION}/" -type f -name "*.deb")
5151
# All local packages need to be prefixed with `./` or else apt-get doesn't understand where to pull from
5252
packages=$(echo "${packages}" | awk '$0="./"$0' | xargs)
5353

@@ -120,7 +120,7 @@ function verify_rpm() {
120120

121121
# find all rpm packages, exclude src package
122122
echo "[DEBUG] Installing engine rpms"
123-
packages=$(find "packaging/rpm/rpmbuild/${DIST_ID}-${DIST_VERSION}/RPMS/" -type f -name "*.rpm" | sed '/src/d')
123+
packages=$(find "rpm/rpmbuild/${DIST_ID}-${DIST_VERSION}/RPMS/" -type f -name "*.rpm" | sed '/src/d')
124124

125125
# install all non-source packages
126126
(

0 commit comments

Comments
 (0)