Skip to content

Commit 05adfe5

Browse files
authored
Merge pull request #4916 from sysown/v3.0-build_tap_tests_in_container
add support for containerized tap test builds
2 parents 77247a1 + 8454e64 commit 05adfe5

File tree

5 files changed

+53
-22
lines changed

5 files changed

+53
-22
lines changed

Makefile

+22-13
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ GIT_VERSION ?= $(shell git describe --long --abbrev=7)
1313
ifndef GIT_VERSION
1414
$(error GIT_VERSION is not set)
1515
endif
16+
export GIT_VERSION
17+
18+
### NOTES:
19+
### SOURCE_DATE_EPOCH is used for reproducible builds
20+
### for details consult https://reproducible-builds.org/docs/source-date-epoch/
21+
22+
SOURCE_DATE_EPOCH ?= $(shell git show -s --format=%ct HEAD || date +%s)
23+
export SOURCE_DATE_EPOCH
1624

1725
### NOTES:
1826
### to compile without jemalloc, set environment variable NOJEMALLOC=1
@@ -314,7 +322,7 @@ amd64-fedora: fedora40 fedora40-clang fedora40-dbg fedora41 fedora41-clang fedor
314322
amd64-opensuse: opensuse15 opensuse15-clang opensuse15-dbg
315323
amd64-ubuntu: ubuntu22 ubuntu22-clang ubuntu22-dbg ubuntu24 ubuntu24-clang ubuntu24-dbg
316324
amd64-pkglist:
317-
@make -nk amd64-packages 2>/dev/null | grep -Po '(?<=binaries/)proxysql\S+$$'
325+
@${MAKE} -nk amd64-packages 2>/dev/null | grep -Po '(?<=binaries/)proxysql\S+$$'
318326

319327
arm64-%: SYS_ARCH := aarch64
320328
arm64-packages: arm64-centos arm64-debian arm64-ubuntu arm64-fedora arm64-opensuse arm64-almalinux
@@ -325,7 +333,7 @@ arm64-fedora: fedora40 fedora41
325333
arm64-opensuse: opensuse15
326334
arm64-ubuntu: ubuntu22 ubuntu24
327335
arm64-pkglist:
328-
@make -nk arm64-packages 2>/dev/null | grep -Po '(?<=binaries/)proxysql\S+$$'
336+
@${MAKE} -nk arm64-packages 2>/dev/null | grep -Po '(?<=binaries/)proxysql\S+$$'
329337

330338
almalinux%: build-almalinux% ;
331339
centos%: build-centos% ;
@@ -339,24 +347,21 @@ ubuntu%: build-ubuntu% ;
339347
.NOTPARALLEL: build-%
340348
build-%: BLD_NAME=$(patsubst build-%,%,$@)
341349
build-%: PKG_VERS=$(if $(filter $(shell echo ${BLD_NAME} | grep -Po '[a-z]+'),debian ubuntu),$(DEB_VERS),$(RPM_VERS))
342-
build-%: PKG_TYPE=$(if $(filter $(shell echo $(BLD_NAME) | grep -Po '\-de?bu?g'),-dbg -debug),-dbg,)
350+
build-%: PKG_TYPE=$(if $(filter $(shell echo $(BLD_NAME) | grep -Po '\-de?bu?g|\-test|\-tap'),-dbg -debug -test -tap),-dbg,)
343351
build-%: PKG_NAME=$(firstword $(subst -, ,$(BLD_NAME)))
344352
build-%: PKG_COMP=$(if $(filter $(shell echo $(BLD_NAME) | grep -Po '\-clang'),-clang),-clang,)
345353
build-%: PKG_ARCH=$(if $(filter $(shell echo ${BLD_NAME} | grep -Po '[a-z]+'),debian ubuntu),$(DEB_ARCH),$(RPM_ARCH))
346354
build-%: PKG_KIND=$(if $(filter $(shell echo ${BLD_NAME} | grep -Po '[a-z]+'),debian ubuntu),deb,rpm)
347355
build-%: PKG_FILE=binaries/proxysql$(PKG_VERS)$(PKG_TYPE)-$(PKG_NAME)$(PKG_COMP)$(PKG_ARCH).$(PKG_KIND)
348356
build-%:
349357
@echo 'building $@'
350-
@IMG_NAME=$(PKG_NAME) IMG_TYPE=$(subst -,_,$(PKG_TYPE)) IMG_COMP=$(subst -,_,$(PKG_COMP)) $(MAKE) $(PKG_FILE)
358+
@IMG_NAME=$(PKG_NAME) IMG_TYPE=$(subst -,_,$(PKG_TYPE)) IMG_COMP=$(subst -,_,$(PKG_COMP)) BLD_NAME=$(BLD_NAME) $(MAKE) $(PKG_FILE)
351359

352360
.NOTPARALLEL: binaries/proxysql%
353361
binaries/proxysql%:
354-
cd deps && ${MAKE} cleanall
355-
cd lib && ${MAKE} clean
356-
cd src && ${MAKE} clean
357-
cd test/tap && ${MAKE} clean
358-
cd test/deps && ${MAKE} cleanall
359-
find . -not -path "./binaries/*" -not -path "./.git/*" -exec touch -h --date=@`git show -s --format=%ct HEAD` {} \;
362+
${MAKE} cleanbuild
363+
${MAKE} cleantest
364+
find . -not -path "./binaries/*" -not -path "./.git/*" | xargs touch -h --date=@${SOURCE_DATE_EPOCH}
360365
@docker compose -p "${GIT_VERSION/./}" down -v --remove-orphans
361366
@docker compose -p "${GIT_VERSION/./}" up $(IMG_NAME)$(IMG_TYPE)$(IMG_COMP)_build
362367
@docker compose -p "${GIT_VERSION/./}" down -v --remove-orphans
@@ -383,23 +388,27 @@ cleandev:
383388
cd lib && ${MAKE} clean
384389
cd src && ${MAKE} clean
385390

391+
.PHONY: cleantest
392+
cleantest:
393+
cd test/tap && ${MAKE} clean
394+
cd test/deps && ${MAKE} cleanall
395+
386396
.PHONY: cleanall
387397
cleanall:
388398
cd deps && ${MAKE} cleanall
389399
cd lib && ${MAKE} clean
390400
cd src && ${MAKE} clean
391401
cd test/tap && ${MAKE} clean
392402
cd test/deps && ${MAKE} cleanall
393-
rm -f binaries/*deb || true
394-
rm -f binaries/*rpm || true
395-
rm -f binaries/*id-hash || true
403+
rm -f binaries/* || true
396404
rm -rf pkgroot || true
397405

398406
.PHONY: cleanbuild
399407
cleanbuild:
400408
cd deps && ${MAKE} cleanall
401409
cd lib && ${MAKE} clean
402410
cd src && ${MAKE} clean
411+
rm -rf pkgroot || true
403412

404413

405414
### install targets

docker-compose.yml

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ services:
1515
- WITHGCOV
1616
- NOJEMALLOC
1717
- WITHASAN
18+
- BLD_NAME
1819
command: bash -l -c /opt/entrypoint/entrypoint.bash
1920

2021
####################################################################################################

docker/images/proxysql/deb-compliant/entrypoint/entrypoint.bash

+10-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ echo "==> Building"
2525
git config --system --add safe.directory '/opt/proxysql'
2626
cd /opt/proxysql
2727
echo "==> ProxySQL '$(git describe --long --abbrev=7)'"
28-
#export SOURCE_DATE_EPOCH=$(git show -s --format=%ct HEAD)
29-
#echo "==> Setting SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH}"
30-
#find /opt/proxysql -not -path "/opt/proxysql/binaries/*" -exec touch -h --date=@${SOURCE_DATE_EPOCH} {} \;
28+
export SOURCE_DATE_EPOCH=$(git show -s --format=%ct HEAD)
29+
echo "==> Setting SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH}"
30+
# touch is expensive, do it before, outside of container
31+
#find . -not -path "./binaries/*" -not -path "./.git/*" | xargs touch -h --date=@${SOURCE_DATE_EPOCH}
3132

3233
if [[ -z ${PROXYSQL_BUILD_TYPE:-} ]] ; then
3334
deps_target="build_deps"
@@ -36,6 +37,8 @@ else
3637
deps_target="build_deps_$PROXYSQL_BUILD_TYPE"
3738
build_target="$PROXYSQL_BUILD_TYPE"
3839
fi
40+
41+
# clean is expensive, do it before, outside of container
3942
#${MAKE} cleanbuild
4043
${MAKE} ${MAKEOPT} "${deps_target}"
4144

@@ -46,6 +49,10 @@ else
4649
fi
4750
touch /opt/proxysql/src/proxysql
4851

52+
if [[ ${BLD_NAME} =~ \-test|\-tap ]]; then
53+
${MAKE} ${MAKEOPT} build_tap_test_debug
54+
fi
55+
4956
# Prepare package files and build DEB
5057
echo "==> Packaging"
5158
mkdir -p /opt/proxysql/pkgroot/tmp || true

docker/images/proxysql/rhel-compliant/entrypoint/entrypoint.bash

+10-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ echo "==> Building"
2525
git config --system --add safe.directory '/opt/proxysql'
2626
cd /opt/proxysql
2727
echo "==> ProxySQL '$(git describe --long --abbrev=7)'"
28-
#export SOURCE_DATE_EPOCH=$(git show -s --format=%ct HEAD)
29-
#echo "==> Setting SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH}"
30-
#find /opt/proxysql -not -path "/opt/proxysql/binaries/*" -exec touch -h --date=@${SOURCE_DATE_EPOCH} {} \;
28+
export SOURCE_DATE_EPOCH=$(git show -s --format=%ct HEAD)
29+
echo "==> Setting SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH}"
30+
# touch is expensive, do it before, outside of container
31+
#find . -not -path "./binaries/*" -not -path "./.git/*" | xargs touch -h --date=@${SOURCE_DATE_EPOCH}
3132

3233
if [[ -z ${PROXYSQL_BUILD_TYPE:-} ]] ; then
3334
deps_target="build_deps"
@@ -36,6 +37,8 @@ else
3637
deps_target="build_deps_$PROXYSQL_BUILD_TYPE"
3738
build_target="$PROXYSQL_BUILD_TYPE"
3839
fi
40+
41+
# clean is expensive, do it before, outside of container
3942
#${MAKE} cleanbuild
4043
${MAKE} ${MAKEOPT} "${deps_target}"
4144

@@ -46,6 +49,10 @@ else
4649
fi
4750
touch /opt/proxysql/src/proxysql
4851

52+
if [[ ${BLD_NAME} =~ \-test|\-tap ]]; then
53+
${MAKE} ${MAKEOPT} build_tap_test_debug
54+
fi
55+
4956
# Prepare package files and build RPM
5057
echo "==> Packaging"
5158
mkdir -p proxysql/usr/bin proxysql/etc

docker/images/proxysql/suse-compliant/entrypoint/entrypoint.bash

+10-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ echo "==> Building"
2525
git config --system --add safe.directory '/opt/proxysql'
2626
cd /opt/proxysql
2727
echo "==> ProxySQL '$(git describe --long --abbrev=7)'"
28-
#export SOURCE_DATE_EPOCH=$(git show -s --format=%ct HEAD)
29-
#echo "==> Setting SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH}"
30-
#find /opt/proxysql -not -path "/opt/proxysql/binaries/*" -exec touch -h --date=@${SOURCE_DATE_EPOCH} {} \;
28+
export SOURCE_DATE_EPOCH=$(git show -s --format=%ct HEAD)
29+
echo "==> Setting SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH}"
30+
# touch is expensive, do it before, outside of container
31+
#find . -not -path "./binaries/*" -not -path "./.git/*" | xargs touch -h --date=@${SOURCE_DATE_EPOCH}
3132

3233
if [[ -z ${PROXYSQL_BUILD_TYPE:-} ]] ; then
3334
deps_target="build_deps"
@@ -36,6 +37,8 @@ else
3637
deps_target="build_deps_$PROXYSQL_BUILD_TYPE"
3738
build_target="$PROXYSQL_BUILD_TYPE"
3839
fi
40+
41+
# clean is expensive, do it before, outside of container
3942
#${MAKE} cleanbuild
4043
${MAKE} ${MAKEOPT} "${deps_target}"
4144

@@ -46,6 +49,10 @@ else
4649
fi
4750
touch /opt/proxysql/src/proxysql
4851

52+
if [[ ${BLD_NAME} =~ \-test|\-tap ]]; then
53+
${MAKE} ${MAKEOPT} build_tap_test_debug
54+
fi
55+
4956
# Prepare package files and build RPM
5057
echo "==> Packaging"
5158
# prepare build root

0 commit comments

Comments
 (0)