summaryrefslogtreecommitdiff
path: root/ci
diff options
context:
space:
mode:
authorSean OMeara <[email protected]>2022-11-30 10:29:33 +0100
committerSean OMeara <[email protected]>2022-11-30 11:01:02 +0100
commit85da0b419c19da97f8310f9200b48d7ae68f2e23 (patch)
tree6be88fc066fe07a836aec5da041f4cf6b7949b18 /ci
parent3ddaa60de95ffad7e96b2b436fb87c237689f9e9 (diff)
drone config
Diffstat (limited to 'ci')
-rw-r--r--ci/Dockerfile.deb2
-rw-r--r--ci/Dockerfile.none5
-rw-r--r--ci/Dockerfile.rpm2
-rwxr-xr-xci/scripts/build.sh96
4 files changed, 60 insertions, 45 deletions
diff --git a/ci/Dockerfile.deb b/ci/Dockerfile.deb
index 91b383a6..151bca39 100644
--- a/ci/Dockerfile.deb
+++ b/ci/Dockerfile.deb
@@ -1,5 +1,5 @@
ARG PLATFORM
-FROM registry.sean.farm/${PLATFORM}-builder as stage
+FROM 084037375216.dkr.ecr.us-east-2.amazonaws.com/${PLATFORM}-builder as stage
WORKDIR /work/build
COPY . .
RUN make debian
diff --git a/ci/Dockerfile.none b/ci/Dockerfile.none
new file mode 100644
index 00000000..bee0128f
--- /dev/null
+++ b/ci/Dockerfile.none
@@ -0,0 +1,5 @@
+ARG PLATFORM
+FROM 084037375216.dkr.ecr.us-east-2.amazonaws.com/${PLATFORM}-builder as stage
+WORKDIR /work
+COPY . .
+RUN make
diff --git a/ci/Dockerfile.rpm b/ci/Dockerfile.rpm
index 9969be05..0965148b 100644
--- a/ci/Dockerfile.rpm
+++ b/ci/Dockerfile.rpm
@@ -1,5 +1,5 @@
ARG PLATFORM
-FROM registry.sean.farm/${PLATFORM}-builder as stage
+FROM 084037375216.dkr.ecr.us-east-2.amazonaws.com/${PLATFORM}-builder as stage
WORKDIR /root/rpmbuild/BUILD
COPY . .
RUN make redhat
diff --git a/ci/scripts/build.sh b/ci/scripts/build.sh
index e6aee6bc..bc28e42f 100755
--- a/ci/scripts/build.sh
+++ b/ci/scripts/build.sh
@@ -8,6 +8,9 @@ export VERSION=$3
export EVENT=$4
case $PLATFORM in
+ sid)
+ export PKGFMT=none
+ ;;
el*|fc*|amzn*)
export PKGFMT=rpm
;;
@@ -15,22 +18,21 @@ case $PLATFORM in
export PKGFMT=deb
esac
-# OSX
-# x86_64-apple-darwin
-# aarch64-apple-darwin
+#
+# Allow user to drop in custom Dockerfile for PLATFORM
+#
-# Windows
-# x86_64-pc-windows-msvc
-# i686-pc-windows-msvc
-# aarch64-pc-windows-msvc
+if [ -f "ci/Dockerfile.${PLATFORM}" ]; then
+ export DOCKERFILE="ci/Dockerfile.${PLATFORM}"
+else
+ export DOCKERFILE="ci/Dockerfile.${PKGFMT}"
+fi
-# Linux
-# i686-unknown-linux-gnu
-# x86_64-unknown-linux-gnu
-# arm-unknown-linux-gnueabi ?
-# arm-unknown-linux-gnueabihf ?
-# armv7-unknown-linux-gnueabihf
-#
+#
+# Rust sometimes gets confused about where it's running.
+# Normally, the build images will have Rust pre-baked.
+# Pass RUST_TRIPLET for convenience when using a custom Dockerfile
+#
case $ZT_ISA in
386)
@@ -41,13 +43,9 @@ case $ZT_ISA in
export DOCKER_ARCH=amd64
export RUST_TRIPLET=x86_64-unknown-linux-gnu
;;
- armv6)
- export DOCKER_ARCH=arm/v6
- export RUST_TRIPLET=arm-unknown-linux-gnueabi
- ;;
- armv7)
+ armv7)
export DOCKER_ARCH=arm/v7
- export RUST_TRIPLET=arm-unknown-linux-gnueabihf
+ export RUST_TRIPLET=armv7-unknown-linux-gnueabihf
;;
arm64)
export DOCKER_ARCH=arm64/v8
@@ -60,7 +58,7 @@ case $ZT_ISA in
ppc64le)
export DOCKER_ARCH=ppc64le
export RUST_TRIPLET=powerpc64le-unknown-linux-gnu
- ;;
+ ;;
mips64le)
export DOCKER_ARCH=mips64le
export RUST_TRIPLET=mips64el-unknown-linux-gnuabi64
@@ -69,17 +67,15 @@ case $ZT_ISA in
export DOCKER_ARCH=s390x
export RUST_TRIPLET=s390x-unknown-linux-gnu
;;
- *)
+ *)
echo "ERROR: could not determine architecture settings. PLEASE FIX ME"
exit 1
;;
esac
-if [ -f "ci/Dockerfile.${PLATFORM}" ]; then
- export DOCKERFILE="ci/Dockerfile.${PLATFORM}"
-else
- export DOCKERFILE="ci/Dockerfile.${PKGFMT}"
-fi
+#
+# Print debug info
+#
echo "#~~~~~~~~~~~~~~~~~~~~"
echo "$0 variables:"
@@ -94,23 +90,37 @@ echo "PWD: ${PWD}"
echo "DOCKERFILE: ${DOCKERFILE}"
echo "#~~~~~~~~~~~~~~~~~~~~"
-if [ ${EVENT} == "push" ]; then
-make munge_rpm zerotier-one.spec VERSION=${VERSION}
-make munge_deb debian/changelog VERSION=${VERSION}
+#
+# Munge RPM and Deb
+#
+
+if [ ${PKGFMT} != "none" ] && [ ${EVENT} != "tag" ]; then
+ make munge_rpm zerotier-one.spec VERSION=${VERSION}
+ make munge_deb debian/changelog VERSION=${VERSION}
fi
-export DOCKER_BUILDKIT=1
-docker run --privileged --rm tonistiigi/binfmt --install all
+#
+# Assemble buildx arguments
+#
+
+build_args=(
+ --no-cache
+ --build-arg PLATFORM=${PLATFORM}
+ --build-arg RUST_TRIPLET=${RUST_TRIPLET}
+ --build-arg DOCKER_ARCH=${DOCKER_ARCH}
+ --platform linux/${DOCKER_ARCH}
+ -f ${DOCKERFILE}
+ -t build
+ .
+)
+
+if [ ${PKGFMT} != "none" ]; then
+ build_args+=("--output type=local,dest=.")
+ build_args+=("--target export")
+fi
-# docker pull --platform linux/${DOCKER_ARCH} registry.sean.farm/${PLATFORM}-builder
+#
+# Do build
+#
-docker buildx build \
- --build-arg PLATFORM="${PLATFORM}" \
- --build-arg RUST_TRIPLET="${RUST_TRIPLET}" \
- --build-arg DOCKER_ARCH="${DOCKER_ARCH}" \
- --platform linux/${DOCKER_ARCH} \
- -f ${DOCKERFILE} \
- -t build \
- . \
- --output type=local,dest=. \
- --target export
+docker buildx build ${build_args[@]}