File tree 4 files changed +80
-4
lines changed
4 files changed +80
-4
lines changed Original file line number Diff line number Diff line change
1
+ steps :
2
+ - group : " Build Bacalhau Image"
3
+ steps :
4
+ - trigger : " bacalhau-golang"
5
+ label : " :rocket: Build CLI "
6
+ env :
7
+ TRIGGER_JOB_ID : " ${BUILDKITE_JOB_ID}"
8
+ build :
9
+ message : " ${BUILDKITE_MESSAGE}"
10
+ commit : " ${BUILDKITE_COMMIT}"
11
+ branch : " ${BUILDKITE_BRANCH}"
12
+
13
+ - wait : ~
14
+ - label : " :fish: Build Bacalhau Image"
15
+ command : " ./buildkite/scripts/build_bacalhau_image.sh"
Original file line number Diff line number Diff line change 4
4
# build.pull_request.labels includes "build/go" ||
5
5
# build.pull_request.labels includes "build/golang" ||
6
6
# build.tag != null
7
-
8
7
steps :
9
8
- label : " :golang: Lint"
10
9
command : " ./buildkite/scripts/lint.sh"
11
10
key : " lint"
12
11
agents :
13
- queue : " buildkite-hosted-linux-medium "
12
+ queue : " buildkite-hosted-linux-large "
14
13
15
14
- group : " :package: Build Tarball"
16
15
key : " build-tarball"
@@ -64,9 +63,14 @@ steps:
64
63
65
64
- wait : ~
66
65
67
- # Release CLI is only triggered if the tag is present.
66
+ - label : " :docker: Build & Publish Bacalhau Image"
67
+ command : " ./buildkite/scripts/bacalhau_image.sh"
68
+ key : " publish-bacalhau-image"
69
+ agents :
70
+ queue : " buildkite-hosted-linux-large"
71
+ if : build.tag != null
68
72
69
73
- label : " :rocket: Release CLI"
70
74
command : " ./buildkite/scripts/release_cli.sh"
71
75
key : " release-cli"
72
- if : build.tag != ""
76
+ if : build.tag != null
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ set -euo pipefail
4
+
5
+ set_environment_variables () {
6
+ export GIT_TAG=$( git describe --tags --always)
7
+ }
8
+
9
+ docker_login () {
10
+ export GHCR_PAT=$( buildkite-agent secret get GHCR_PAT)
11
+ echo $GHCR_PAT | docker login ghcr.io -u bacalhau-infra-bot --password-stdin
12
+ }
13
+
14
+ docker_context_create () {
15
+ docker context create buildx-build
16
+ docker buildx create --use buildx-build
17
+ }
18
+
19
+ download_and_extract_artifact () {
20
+ local arch=$1
21
+ local tarball=" bacalhau_${GIT_TAG} _linux_${arch} .tar.gz"
22
+ local target_dir=" bin/linux/${arch} "
23
+
24
+ mkdir -p " $target_dir "
25
+ if ! tar xf " $tarball " -C " $target_dir " ; then
26
+ echo " Error: Failed to extract $tarball " >&2
27
+ exit 1
28
+ fi
29
+ echo " Extracted $tarball to $target_dir folder"
30
+ }
31
+
32
+ download_artifacts () {
33
+ if ! buildkite-agent artifact download " *.*" . --build " $BUILDKITE_BUILD_ID " ; then
34
+ echo " Error: Failed to download artifacts from build pipeline" >&2
35
+ exit 1
36
+ fi
37
+ echo " Downloaded artifacts from build pipeline"
38
+
39
+ download_and_extract_artifact " amd64"
40
+ download_and_extract_artifact " arm64"
41
+ }
42
+
43
+ main () {
44
+ if [ -n " ${BUILDKITE_TAG:- } " ]; then
45
+ set_environment_variables
46
+ docker_context_create
47
+ download_artifacts
48
+ make build-bacalhau-image
49
+ docker_login
50
+ make push-bacalhau-image
51
+ else
52
+ echo " Skipping artifact download: BUILDKITE_TAG is not present"
53
+ fi
54
+ }
55
+
56
+ main
Original file line number Diff line number Diff line change 2
2
3
3
export PRIVATE_PEM_B64=$( buildkite-agent secret get PRIVATE_PEM_B64)
4
4
export PUBLIC_PEM_B64=$( buildkite-agent secret get PUBLIC_PEM_B64)
5
+ export PRIVATE_KEY_PASSPHRASE_B64=$( buildkite-agent secret get PRIVATE_KEY_PASSPHRASE_B64)
5
6
echo " $PRIVATE_PEM_B64 " | base64 --decode > /tmp/private.pem
6
7
echo " $PUBLIC_PEM_B64 " | base64 --decode > /tmp/public.pem
7
8
export PRIVATE_KEY_PASSPHRASE=" $( echo $PRIVATE_KEY_PASSPHRASE_B64 | base64 --decode) "
You can’t perform that action at this time.
0 commit comments