Skip to content

Commit

Permalink
bring in buildkite config
Browse files Browse the repository at this point in the history
  • Loading branch information
colincoghill committed Jul 30, 2024
1 parent be0507f commit 037c8a1
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .buildkite/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/bash
set -eu

if [ -n "${KX_BUILD_DEBUG-}" ]; then
echo "Enabling script debugging..."
set -x
fi

export TIMEFORMAT='🕑 %1lR'
export [email protected]
export DEBFULLNAME="Koordinates CI Builder"

echo "Updating changelog..."

if which ggrep ; then
# so we can run this locally on MacOS
# (run `brew install grep` to install this)
GREP=ggrep
else
GREP=grep
fi

# add version number vars
source ./Version.config

DEB_BASE_VERSION="${POSTGIS_MAJOR_VERSION}.${POSTGIS_MINOR_VERSION}.${POSTGIS_MICRO_VERSION}"
DEB_VERSION="${DEB_BASE_VERSION}+kx-ci${BUILDKITE_BUILD_NUMBER}-$(git show -s --date=format:%Y%m%d --format=git%cd.%h)"
echo "Debian Package Version: ${DEB_VERSION}"

if [ -n "${BUILDKITE_AGENT_ACCESS_TOKEN-}" ] ; then
buildkite-agent meta-data set deb-base-version "$DEB_BASE_VERSION"
buildkite-agent meta-data set deb-version "$DEB_VERSION"

echo -e ":debian: Package Version: \`${DEB_VERSION}\`" \
| buildkite-agent annotate --style info --context deb-version
fi

time docker run \
-v "$(pwd):/src" \
-w "/src" \
-e DEBEMAIL \
-e DEBFULLNAME \
"${ECR}/ci-tools:latest" \
dch --distribution jammy --newversion "${DEB_VERSION}" "Koordinates CI build of ${BUILDKITE_COMMIT}: branch=${BUILDKITE_BRANCH} tag=${BUILDKITE_TAG-}"

BUILD_CONTAINER="build-${BUILDKITE_JOB_ID}"

echo "--- Building debian package ..."
# Uses a docker volume for ccache
time docker run \
--name "${BUILD_CONTAINER}" \
-v "$(pwd):/kx/source" \
-v "ccache:/ccache" \
-e CCACHE_DIR=/ccache \
-w "/kx/source" \
"${ECR}/jammybuild:master.latest" \
/kx/buildscripts/build_binary_package.sh -uc -us

echo "--- Signing debian archives ..."
time docker run \
-v "$(pwd):/src" \
-e "GPG_KEY=${APT_GPG_KEY}" \
-w "/src" \
"${ECR}/ci-tools:latest" \
sign-debs "/src/build-jammy/*.deb"
31 changes: 31 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
steps:
- label: ':debian: Build & Package & Test'
command: ".buildkite/build.sh"
artifact_paths:
- "build-jammy/*"

- block: "Release?"
prompt: "Release to archive? Check the test results first!"

- label: ':debian: Publish deb'
command:
- >
aptly-upload
--aptly-url https://apt-repo.kx.gd
--retries 3
--repo kx-builds-jammy
--series jammy
build-jammy/*.deb
retry:
automatic: true
plugins:
artifacts#v1.2.0:
download: "build-jammy/*.deb"
docker#v1.4.0:
image: "${ECR}/ci-tools"
always-pull: true
workdir: /src
environment:
- APTLY_UNAME
- APTLY_PASSWD

0 comments on commit 037c8a1

Please sign in to comment.