-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Image deployed here https://github.com/bacalhau-project/bacalhau/pkgs/container/bacalhau
- Loading branch information
Showing
4 changed files
with
80 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
steps: | ||
- group: "Build Bacalhau Image" | ||
steps: | ||
- trigger: "bacalhau-golang" | ||
label: ":rocket: Build CLI " | ||
env: | ||
TRIGGER_JOB_ID: "${BUILDKITE_JOB_ID}" | ||
build: | ||
message: "${BUILDKITE_MESSAGE}" | ||
commit: "${BUILDKITE_COMMIT}" | ||
branch: "${BUILDKITE_BRANCH}" | ||
|
||
- wait: ~ | ||
- label: ":fish: Build Bacalhau Image" | ||
command: "./buildkite/scripts/build_bacalhau_image.sh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
set_environment_variables() { | ||
export GIT_TAG=$(git describe --tags --always) | ||
} | ||
|
||
docker_login() { | ||
export GHCR_PAT=$(buildkite-agent secret get GHCR_PAT) | ||
echo $GHCR_PAT | docker login ghcr.io -u bacalhau-infra-bot --password-stdin | ||
} | ||
|
||
docker_context_create() { | ||
docker context create buildx-build | ||
docker buildx create --use buildx-build | ||
} | ||
|
||
download_and_extract_artifact() { | ||
local arch=$1 | ||
local tarball="bacalhau_${GIT_TAG}_linux_${arch}.tar.gz" | ||
local target_dir="bin/linux/${arch}" | ||
|
||
mkdir -p "$target_dir" | ||
if ! tar xf "$tarball" -C "$target_dir"; then | ||
echo "Error: Failed to extract $tarball" >&2 | ||
exit 1 | ||
fi | ||
echo "Extracted $tarball to $target_dir folder" | ||
} | ||
|
||
download_artifacts() { | ||
if ! buildkite-agent artifact download "*.*" . --build "$BUILDKITE_BUILD_ID"; then | ||
echo "Error: Failed to download artifacts from build pipeline" >&2 | ||
exit 1 | ||
fi | ||
echo "Downloaded artifacts from build pipeline" | ||
|
||
download_and_extract_artifact "amd64" | ||
download_and_extract_artifact "arm64" | ||
} | ||
|
||
main() { | ||
if [ -n "${BUILDKITE_TAG:-}" ]; then | ||
set_environment_variables | ||
docker_context_create | ||
download_artifacts | ||
make build-bacalhau-image | ||
docker_login | ||
make push-bacalhau-image | ||
else | ||
echo "Skipping artifact download: BUILDKITE_TAG is not present" | ||
fi | ||
} | ||
|
||
main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters