drone config

This commit is contained in:
Sean OMeara 2022-11-30 10:29:33 +01:00
parent 3ddaa60de9
commit 85da0b419c
6 changed files with 124 additions and 2620 deletions

View file

@ -1,50 +1,7 @@
local registry = "084037375216.dkr.ecr.us-east-2.amazonaws.com";
local targets = [ local targets = [
// { "os": "linux", "name": "sid", "isas": [ "386", "armv7", "amd64", "arm64", "mips64le", "ppc64le", "s390x", "riscv64" ], "events": [ "push", "tag", "custom" ] },
// Render these into .drone.yaml by running "make drone"
//
{ "os": "linux", "name": "el9", "isas": [ "amd64", "arm64", "ppc64le", "s390x" ], "events": [ "tag" ] },
{ "os": "linux", "name": "el8", "isas": [ "amd64", "arm64", "ppc64le", "s390x" ], "events": [ "tag" ] },
{ "os": "linux", "name": "el7", "isas": [ "amd64", "ppc64le"], "events": [ "tag" ] },
{ "os": "linux", "name": "el6", "isas": [ "amd64" ], "events": [ "tag" ] },
{ "os": "linux", "name": "amzn2", "isas": [ "amd64", "arm64" ], "events": [ "tag" ] },
{ "os": "linux", "name": "fc37", "isas": [ "amd64", "arm64", "ppc64le", "s390x" ], "events": [ "tag" ] },
{ "os": "linux", "name": "fc36", "isas": [ "amd64", "arm64", "ppc64le", "s390x" ], "events": [ "tag" ] },
{ "os": "linux", "name": "fc35", "isas": [ "amd64", "arm64", "ppc64le", "s390x" ], "events": [ "tag" ] },
{ "os": "linux", "name": "jammy", "isas": [ "amd64", "arm64", "armv7", "riscv64", "ppc64le", "s390x" ], "events": [ "tag" ] },
{ "os": "linux", "name": "focal", "isas": [ "amd64", "arm64", "armv7", "riscv64", "ppc64le" ], "events": [ "tag" ] },
{ "os": "linux", "name": "bionic", "isas": [ "amd64", "arm64", "386", "ppc64le", "s390x" ], "events": ["tag" ] },
{ "os": "linux", "name": "xenial", "isas": [ "amd64", "arm64", "386" ], "events": [ "tag" ] },
{ "os": "linux", "name": "sid", "isas": [ "386", "amd64", "arm64", "riscv64", "mips64le", "ppc64le", "s390x" ], "events": [ "push", "tag" ] },
{ "os": "linux", "name": "bookworm", "isas": [ "amd64", "arm64", "armv7", "386", "mips64le", "ppc64le", "s390x" ], "events": [ "tag" ] },
{ "os": "linux", "name": "bullseye", "isas": [ "amd64", "arm64", "armv7", "386", "mips64le", "ppc64le", "s390x" ], "events": [ "tag" ] },
{ "os": "linux", "name": "buster", "isas": [ "amd64", "arm64", "armv7", "386", "mips64le", "ppc64le", "s390x" ], "events": [ "tag" ] },
{ "os": "linux", "name": "stretch", "isas": [ "amd64", "arm64", "386" ], "events": [ "tag" ] },
// { "os": "windows", "name": "win2k19", "isas": [ "amd64" ], "events": ["push", "tag" ] }
];
local master_targets = [
//
// Render these into .drone.yaml by running "make drone"
//
{ "os": "linux", "name": "el9", "isas": [ "amd64", "arm64", "ppc64le", "s390x" ], "events": [ "tag" ] },
{ "os": "linux", "name": "el8", "isas": [ "amd64", "arm64", "ppc64le", "s390x" ], "events": [ "tag" ] },
{ "os": "linux", "name": "el7", "isas": [ "amd64", "ppc64le"], "events": [ "tag" ] },
{ "os": "linux", "name": "el6", "isas": [ "amd64" ], "events": [ "tag" ] },
{ "os": "linux", "name": "amzn2", "isas": [ "amd64", "arm64" ], "events": [ "tag" ] },
{ "os": "linux", "name": "fc37", "isas": [ "amd64", "arm64", "ppc64le", "s390x" ], "events": [ "tag" ] },
{ "os": "linux", "name": "fc36", "isas": [ "amd64", "arm64", "ppc64le", "s390x" ], "events": [ "tag" ] },
{ "os": "linux", "name": "fc35", "isas": [ "amd64", "arm64", "ppc64le", "s390x" ], "events": [ "tag" ] },
{ "os": "linux", "name": "jammy", "isas": [ "amd64", "arm64", "armv7", "riscv64", "ppc64le", "s390x" ], "events": [ "tag" ] },
{ "os": "linux", "name": "focal", "isas": [ "amd64", "arm64", "armv7", "riscv64", "ppc64le" ], "events": [ "tag" ] },
{ "os": "linux", "name": "bionic", "isas": [ "amd64", "arm64", "386", "ppc64le", "s390x" ], "events": ["tag" ] },
{ "os": "linux", "name": "xenial", "isas": [ "amd64", "arm64", "386" ], "events": [ "tag" ] },
{ "os": "linux", "name": "sid", "isas": [ "386", "amd64", "arm64", "riscv64", "mips64le", "ppc64le", "s390x" ], "events": [ "push", "tag" ] },
{ "os": "linux", "name": "bookworm", "isas": [ "amd64", "arm64", "armv7", "386", "mips64le", "ppc64le", "s390x" ], "events": [ "tag" ] },
{ "os": "linux", "name": "bullseye", "isas": [ "amd64", "arm64", "armv7", "386", "mips64le", "ppc64le", "s390x" ], "events": [ "tag" ] },
{ "os": "linux", "name": "buster", "isas": [ "amd64", "arm64", "armv7", "386", "mips64le", "ppc64le", "s390x" ], "events": [ "tag" ] },
{ "os": "linux", "name": "stretch", "isas": [ "amd64", "arm64", "386" ], "events": [ "tag" ] },
// { "os": "windows", "name": "win2k19", "isas": [ "amd64" ], "events": ["push", "tag" ] }
]; ];
local Build(platform, os, isa, events) = { local Build(platform, os, isa, events) = {
@ -56,27 +13,18 @@ local Build(platform, os, isa, events) = {
"steps": [ "steps": [
{ {
"name": "build", "name": "build",
"image": "registry.sean.farm/honda-builder", "image": registry + "/honda-builder",
"commands": [ "./ci/scripts/build.sh " + platform + " " + isa + " " + "100.0.0+${DRONE_COMMIT_SHA:0:8}" + " " + "${DRONE_BUILD_EVENT}" ] "commands": [
}, "aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin " + registry,
{ "./ci/scripts/build.sh " + platform + " " + isa + " " + "100.0.0+${DRONE_COMMIT_SHA:0:8}" + " " + "${DRONE_BUILD_EVENT}"
"name": "list", ]
"image": "registry.sean.farm/honda-builder",
"commands": [ "ls -la " + platform ]
}, },
// { // {
// "name": "notify-mattermost", // "name": "list",
// "image": "registry.sean.farm/mattermost-notify", // "image": registry + "/honda-builder",
// "environment": { // "commands": [ "ls -la " + platform ]
// "token": { "from_secret": "mattermost-token" }, // },
// "host": { "from_secret": "mattermost-host" },
// "channel": { "from_secret": "mattermost-channel" },
// "maxRetry": 3,
// },
// "when": { "status": [ "failure" ] }
// }
], ],
"image_pull_secrets": [ "dockerconfigjson" ],
[ if isa == "arm64" || isa == "armv7" then "platform" ]: { os: os, arch: "arm64" }, [ if isa == "arm64" || isa == "armv7" then "platform" ]: { os: os, arch: "arm64" },
"trigger": { "event": events } "trigger": { "event": events }
}; };

2565
.drone.yml

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
ARG PLATFORM 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 WORKDIR /work/build
COPY . . COPY . .
RUN make debian RUN make debian

5
ci/Dockerfile.none Normal file
View file

@ -0,0 +1,5 @@
ARG PLATFORM
FROM 084037375216.dkr.ecr.us-east-2.amazonaws.com/${PLATFORM}-builder as stage
WORKDIR /work
COPY . .
RUN make

View file

@ -1,5 +1,5 @@
ARG PLATFORM 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 WORKDIR /root/rpmbuild/BUILD
COPY . . COPY . .
RUN make redhat RUN make redhat

View file

@ -8,6 +8,9 @@ export VERSION=$3
export EVENT=$4 export EVENT=$4
case $PLATFORM in case $PLATFORM in
sid)
export PKGFMT=none
;;
el*|fc*|amzn*) el*|fc*|amzn*)
export PKGFMT=rpm export PKGFMT=rpm
;; ;;
@ -15,22 +18,21 @@ case $PLATFORM in
export PKGFMT=deb export PKGFMT=deb
esac esac
# OSX #
# x86_64-apple-darwin # Allow user to drop in custom Dockerfile for PLATFORM
# aarch64-apple-darwin #
# Windows if [ -f "ci/Dockerfile.${PLATFORM}" ]; then
# x86_64-pc-windows-msvc export DOCKERFILE="ci/Dockerfile.${PLATFORM}"
# i686-pc-windows-msvc else
# aarch64-pc-windows-msvc export DOCKERFILE="ci/Dockerfile.${PKGFMT}"
fi
# Linux #
# i686-unknown-linux-gnu # Rust sometimes gets confused about where it's running.
# x86_64-unknown-linux-gnu # Normally, the build images will have Rust pre-baked.
# arm-unknown-linux-gnueabi ? # Pass RUST_TRIPLET for convenience when using a custom Dockerfile
# arm-unknown-linux-gnueabihf ? #
# armv7-unknown-linux-gnueabihf
#
case $ZT_ISA in case $ZT_ISA in
386) 386)
@ -41,13 +43,9 @@ case $ZT_ISA in
export DOCKER_ARCH=amd64 export DOCKER_ARCH=amd64
export RUST_TRIPLET=x86_64-unknown-linux-gnu export RUST_TRIPLET=x86_64-unknown-linux-gnu
;; ;;
armv6) armv7)
export DOCKER_ARCH=arm/v6
export RUST_TRIPLET=arm-unknown-linux-gnueabi
;;
armv7)
export DOCKER_ARCH=arm/v7 export DOCKER_ARCH=arm/v7
export RUST_TRIPLET=arm-unknown-linux-gnueabihf export RUST_TRIPLET=armv7-unknown-linux-gnueabihf
;; ;;
arm64) arm64)
export DOCKER_ARCH=arm64/v8 export DOCKER_ARCH=arm64/v8
@ -60,7 +58,7 @@ case $ZT_ISA in
ppc64le) ppc64le)
export DOCKER_ARCH=ppc64le export DOCKER_ARCH=ppc64le
export RUST_TRIPLET=powerpc64le-unknown-linux-gnu export RUST_TRIPLET=powerpc64le-unknown-linux-gnu
;; ;;
mips64le) mips64le)
export DOCKER_ARCH=mips64le export DOCKER_ARCH=mips64le
export RUST_TRIPLET=mips64el-unknown-linux-gnuabi64 export RUST_TRIPLET=mips64el-unknown-linux-gnuabi64
@ -69,17 +67,15 @@ case $ZT_ISA in
export DOCKER_ARCH=s390x export DOCKER_ARCH=s390x
export RUST_TRIPLET=s390x-unknown-linux-gnu export RUST_TRIPLET=s390x-unknown-linux-gnu
;; ;;
*) *)
echo "ERROR: could not determine architecture settings. PLEASE FIX ME" echo "ERROR: could not determine architecture settings. PLEASE FIX ME"
exit 1 exit 1
;; ;;
esac esac
if [ -f "ci/Dockerfile.${PLATFORM}" ]; then #
export DOCKERFILE="ci/Dockerfile.${PLATFORM}" # Print debug info
else #
export DOCKERFILE="ci/Dockerfile.${PKGFMT}"
fi
echo "#~~~~~~~~~~~~~~~~~~~~" echo "#~~~~~~~~~~~~~~~~~~~~"
echo "$0 variables:" echo "$0 variables:"
@ -94,23 +90,37 @@ echo "PWD: ${PWD}"
echo "DOCKERFILE: ${DOCKERFILE}" echo "DOCKERFILE: ${DOCKERFILE}"
echo "#~~~~~~~~~~~~~~~~~~~~" echo "#~~~~~~~~~~~~~~~~~~~~"
if [ ${EVENT} == "push" ]; then #
make munge_rpm zerotier-one.spec VERSION=${VERSION} # Munge RPM and Deb
make munge_deb debian/changelog VERSION=${VERSION} #
if [ ${PKGFMT} != "none" ] && [ ${EVENT} != "tag" ]; then
make munge_rpm zerotier-one.spec VERSION=${VERSION}
make munge_deb debian/changelog VERSION=${VERSION}
fi fi
export DOCKER_BUILDKIT=1 #
docker run --privileged --rm tonistiigi/binfmt --install all # Assemble buildx arguments
#
# docker pull --platform linux/${DOCKER_ARCH} registry.sean.farm/${PLATFORM}-builder 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
.
)
docker buildx build \ if [ ${PKGFMT} != "none" ]; then
--build-arg PLATFORM="${PLATFORM}" \ build_args+=("--output type=local,dest=.")
--build-arg RUST_TRIPLET="${RUST_TRIPLET}" \ build_args+=("--target export")
--build-arg DOCKER_ARCH="${DOCKER_ARCH}" \ fi
--platform linux/${DOCKER_ARCH} \
-f ${DOCKERFILE} \ #
-t build \ # Do build
. \ #
--output type=local,dest=. \
--target export docker buildx build ${build_args[@]}