Skip to content

Commit 51a085c

Browse files
committed
ci: Add initial buildkite support
Add buildkite related CI files. We add the starts of a deploy.yml that will not directly get invoked by buildkite for security reasons. Signed-off-by: Kumar Gala <[email protected]>
1 parent cd1657d commit 51a085c

File tree

3 files changed

+132
-0
lines changed

3 files changed

+132
-0
lines changed

.buildkite/deploy.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
steps:
2+
- command:
3+
- sudo apt-get install -y makeself p7zip-full cpio tree curl
4+
- sudo pip3 install setuptools
5+
- sudo pip3 install awscli
6+
- >
7+
if [ "${BUILDKITE_PULL_REQUEST}" != "false" ]; then
8+
sed -i "s/$$/-pr-${BUILDKITE_PULL_REQUEST}/" VERSION;
9+
fi
10+
- release=$(cat VERSION)
11+
- echo "Release - [$${release}] $${release}"
12+
13+
- >
14+
if [ -n "${BUILDKITE_TAG}" ]; then
15+
if [ "${BUILDKITE_TAG}" != $${release} ]; then
16+
echo "Need to fix VERSION file. Tag ${BUILDKITE_TAG} doesn't match $${release}"
17+
#exit 1
18+
fi
19+
export S3_PUB_PATH="s3://builds.zephyrproject.org/sdk/${BUILDKITE_TAG}/"
20+
elif [ "${BUILDKITE_PULL_REQUEST}" != "false" ]; then
21+
export S3_PUB_PATH="s3://builds.zephyrproject.org/zephyrproject-rtos/sdk-ng/${BUILDKITE_PULL_REQUEST}/"
22+
fi
23+
- echo "S3_PUB_PATH - [$${S3_PUB_PATH}]"
24+
- mkdir -p scripts/toolchains
25+
- cd scripts/toolchains
26+
- buildkite-agent artifact download *.tar.bz2 . --build $${BUILDKITE_TRIGGERED_FROM_BUILD_ID}
27+
- buildkite-agent artifact download *.sh . --build $${BUILDKITE_TRIGGERED_FROM_BUILD_ID}
28+
- chmod a+x *.sh
29+
- cd ..
30+
- tree -H '.' -L 1 --noreport --charset utf-8 toolchains > index.html
31+
- ./make_zephyr_sdk.sh
32+
- ls -F
33+
- sdk_filename=$(ls -1 zephyr-sdk*)
34+
- toolchain_files=$(ls -1 zephyr-toolchain-*)
35+
- hosttools_filename=$(ls -1 toolchains/*hosttools*)

.buildkite/hooks/pre-command

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
# Copyright (c) 2020 Linaro Limited
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
# Save off where we started so we can go back there
7+
WORKDIR=${PWD}
8+
9+
ls -lsa .git
10+
11+
if [ -n "${BUILDKITE_PULL_REQUEST_BASE_BRANCH}" ]; then
12+
git fetch -v origin ${BUILDKITE_PULL_REQUEST_BASE_BRANCH}
13+
git checkout FETCH_HEAD
14+
git config --local user.email "[email protected]"
15+
git config --local user.name "Zephyr CI"
16+
git merge --no-edit "${BUILDKITE_COMMIT}" || {
17+
local merge_result=$?
18+
echo "Merge failed: ${merge_result}"
19+
git merge --abort
20+
exit $merge_result
21+
}
22+
ls -lsa .git
23+
fi
24+
25+
mkdir -p /var/lib/buildkite-agent/zephyr-ccache/
26+
27+
# create cache dirs, no-op if they already exist
28+
mkdir -p /var/lib/buildkite-agent/zephyr-module-cache/modules
29+
mkdir -p /var/lib/buildkite-agent/zephyr-module-cache/tools
30+
mkdir -p /var/lib/buildkite-agent/zephyr-module-cache/bootloader
31+
32+
# Clean cache - if it already exists
33+
cd /var/lib/buildkite-agent/zephyr-module-cache
34+
find -type f -not -path "*/.git/*" -not -name ".git" -delete
35+
36+
# Remove any stale locks
37+
find -name index.lock -delete
38+
39+
# return from where we started so we can find pipeline files from
40+
# git repo
41+
cd ${WORKDIR}

.buildkite/pipeline.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
steps:
2+
- command:
3+
- >
4+
case "$${BUILDKITE_PARALLEL_JOB}" in
5+
0) TARGET="arm";;
6+
1) TARGET="arc";;
7+
2) TARGET="tools";;
8+
3) TARGET="riscv64";;
9+
4) TARGET="nios2";;
10+
5) TARGET="sparc";;
11+
6) TARGET="x86_64-zephyr-elf";;
12+
7) TARGET="arm64";;
13+
8) TARGET="xtensa_sample_controller";;
14+
9) TARGET="xtensa_intel_apl_adsp";;
15+
10) TARGET="xtensa_intel_bdw_adsp";;
16+
11) TARGET="xtensa_intel_byt_adsp";;
17+
12) TARGET="xtensa_nxp_imx_adsp";;
18+
13) TARGET="xtensa_nxp_imx8m_adsp";;
19+
14) TARGET="xtensa_intel_s1000";;
20+
15) TARGET="cmake";;
21+
esac
22+
- >
23+
if [ $${TARGET} = "tools" ]; then
24+
touch zephyr-sdk-x86_64-hosttools-standalone-0.9.sh;
25+
buildkite-agent artifact upload zephyr-sdk-x86_64-hosttools-standalone-0.9.sh;
26+
elif [ $${TARGET} = "cmake" ]; then
27+
touch cmake.tar.bz2;
28+
buildkite-agent artifact upload cmake.tar.bz2;
29+
else
30+
touch $${TARGET}.tar.bz2;
31+
buildkite-agent artifact upload $${TARGET}.tar.bz2;
32+
fi
33+
parallelism: 16
34+
env:
35+
BUILDKITE_CLEAN_CHECKOUT: "true"
36+
plugins:
37+
- docker#v3.5.0:
38+
image: "zephyrprojectrtos/sdk-build"
39+
propagate-environment: true
40+
user: buildkite-agent
41+
agents:
42+
- "queue=sdk-ng-x86"
43+
44+
- wait
45+
46+
- trigger: "sdk-deploy"
47+
if: build.tag != null || build.pull_request.id != null
48+
build:
49+
message: "${BUILDKITE_MESSAGE}"
50+
commit: "${BUILDKITE_COMMIT}"
51+
branch: "${BUILDKITE_BRANCH}"
52+
env:
53+
BUILDKITE_PULL_REQUEST: "${BUILDKITE_PULL_REQUEST}"
54+
BUILDKITE_PULL_REQUEST_BASE_BRANCH: "${BUILDKITE_PULL_REQUEST_BASE_BRANCH}"
55+
BUILDKITE_PULL_REQUEST_REPO: "${BUILDKITE_PULL_REQUEST_REPO}"
56+
BUILDKITE_TAG: "${BUILDKITE_TAG}"

0 commit comments

Comments
 (0)