Skip to content

Commit ea49917

Browse files
authored
chore(ci): add buildkite pipelines (#4)
* chore: added buildkite config * chore: add exec permission ci/buildkite-pipeline.sh * chore(ci): update ci/buildkite-pipeline.sh * chore(ci): update ci/buildkite-pipeline.sh * chore(ci): update ci/buildkite-pipeline.sh
1 parent eff3bdf commit ea49917

File tree

3 files changed

+67
-0
lines changed

3 files changed

+67
-0
lines changed

.buildkite/pipeline-upload.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
#
3+
# This script is used to upload the full buildkite pipeline. The steps defined
4+
# in the buildkite UI should simply be:
5+
#
6+
# steps:
7+
# - command: ".buildkite/pipeline-upload.sh"
8+
#
9+
10+
set -e
11+
cd "$(dirname "$0")"/..
12+
source ci/_
13+
14+
_ ci/buildkite-pipeline.sh pipeline.yml
15+
echo +++ pipeline
16+
cat pipeline.yml
17+
18+
_ buildkite-agent pipeline upload pipeline.yml

ci/_

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Buildkite log management helper
2+
#
3+
# See https://buildkite.com/docs/pipelines/managing-log-output
4+
#
5+
# |source| me
6+
#
7+
8+
base_dir=$(realpath --strip "$(dirname "$0")/..")
9+
10+
_() {
11+
if [[ $(pwd) = $base_dir ]]; then
12+
echo "--- $*"
13+
else
14+
echo "--- $* (wd: $(pwd))"
15+
fi
16+
"$@"
17+
}

ci/buildkite-pipeline.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Builds a buildkite pipeline based on the environment variables
4+
#
5+
6+
set -e
7+
cd "$(dirname "$0")"/..
8+
9+
output_file=${1:-/dev/stderr}
10+
11+
if [[ -n $CI_PULL_REQUEST ]]; then
12+
IFS=':' read -ra affected_files <<< "$(buildkite-agent meta-data get affected_files)"
13+
if [[ ${#affected_files[*]} -eq 0 ]]; then
14+
echo "Unable to determine the files affected by this PR"
15+
exit 1
16+
fi
17+
else
18+
affected_files=()
19+
fi
20+
21+
start_pipeline() {
22+
echo "# $*" > "$output_file"
23+
echo "steps:" >> "$output_file"
24+
}
25+
26+
wait_step() {
27+
echo " - wait" >> "$output_file"
28+
}
29+
30+
start_pipeline "Push pipeline for ${BUILDKITE_BRANCH:-?unknown branch?}"
31+
wait_step
32+
exit 0

0 commit comments

Comments
 (0)