-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feat]: [CI-15228]: Package buildkit tarball as part of buildx image (#…
…50) * Modify dockerfiles * Update docker.go * make changes * Update .drone.yml * update
- Loading branch information
1 parent
02f7b59
commit 78d2e90
Showing
6 changed files
with
115 additions
and
74 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
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 |
---|---|---|
@@ -1,29 +1,32 @@ | ||
#!/bin/bash | ||
|
||
# Usage: ./release.sh <platform> | ||
# Example: ./release.sh linux/amd64 | ||
|
||
set -e | ||
|
||
# Default platform | ||
platform="${1:-linux/amd64}" | ||
|
||
# Extract the full buildkit version (e.g., "harness/buildkit:1.0.6") without jq or grep -P | ||
full_buildkit_version=$(grep '"buildkit_version"' buildkit/version.json | awk -F'"' '{print $4}') | ||
|
||
# Extract only the version number (e.g., "1.0.6") | ||
buildkit_version=${full_buildkit_version##*:} | ||
|
||
# Parse platform components | ||
os=${platform%%/*} | ||
arch=${platform##*/} | ||
|
||
# Construct GCS tarball URL | ||
tarball_url="https://storage.cloud.google.com/harness-ti/buildkit/${buildkit_version}/harness-buildkit-${buildkit_version}-${os}-${arch}.tar" | ||
|
||
# Download the tarball | ||
echo "Downloading Buildkit tarball from ${tarball_url}..." | ||
mkdir -p buildkit | ||
curl -L -o buildkit/buildkit.tar "${tarball_url}" | ||
|
||
echo "Buildkit tarball downloaded to buildkit/buildkit.tar" | ||
image_name=$(grep '"buildkit_version"' buildkit/version.json | awk -F'"' '{print $4}') | ||
|
||
# Check if image name was extracted successfully | ||
if [ -z "$image_name" ]; then | ||
echo "Error: Unable to extract image name from JSON file." | ||
exit 1 | ||
fi | ||
|
||
# Check for an optional platform override | ||
platform_override=${1:-} | ||
if [ -n "$platform_override" ]; then | ||
echo "Using platform override: $platform_override" | ||
else | ||
echo "No platform override provided. Using default platform." | ||
fi | ||
|
||
# Pull the Docker image with optional platform specification | ||
echo "Pulling Docker image: $image_name" | ||
if [ -n "$platform_override" ]; then | ||
docker pull --platform "$platform_override" "$image_name" | ||
else | ||
docker pull "$image_name" | ||
fi | ||
|
||
# Save the Docker image to a tarball | ||
tar_file="buildkit/buildkit.tar" | ||
echo "Saving Docker image to tarball: $tar_file" | ||
docker save "$image_name" -o "$tar_file" | ||
|
||
echo "Done. Docker image saved to $tar_file" |
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
Oops, something went wrong.