-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add script to update rootfs URL (#131)
Issue #, if available: runfinch/finch#492 *Description of changes:* for Finch on Windows runfinch/finch#492, we need to provide a rootfs to WSL2. This rootfs lives in our dependencies bucket, and will be updated from time-to-time for security patches, bug fixes, etc. This commit will automatically pull the most recent rootfs from the depenedencies bucket as part of the Update Deps action. *Testing done:* locally run script with FINCH_ROOTFS_URL ?= https://deps.runfinch.com/finch-rootfs-production-amd64-000000000.tar.zst set in Makefile, observe update. - [x] I've reviewed the guidance in CONTRIBUTING.md #### License Acceptance By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. Signed-off-by: Gavin Inglis <giinglis@amazon.com>
- Loading branch information
Showing
4 changed files
with
43 additions
and
1 deletion.
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
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,29 @@ | ||
#!/bin/sh | ||
set -euxo pipefail | ||
|
||
DEPENDENCY_CLOUDFRONT_URL="https://deps.runfinch.com/" | ||
AARCH64_FILENAME_PATTERN="common/aarch64/finch-rootfs-production-arm64-[0-9].*\.tar.zst$" | ||
AMD64_FILENAME_PATTERN="common/x86-64/finch-rootfs-production-amd64-[0-9].*\.tar.zst$" | ||
PLATFORM="common" | ||
AARCH64="aarch64" | ||
X86_64="x86-64" | ||
|
||
while getopts d: flag | ||
do | ||
case "${flag}" in | ||
d) dependency_bucket=${OPTARG};; | ||
esac | ||
done | ||
|
||
[[ -z "$dependency_bucket" ]] && { echo "Error: Dependency bucket not set"; exit 1; } | ||
|
||
aarch64Deps=$(aws s3 ls s3://${dependency_bucket}/${PLATFORM}/${AARCH64} | grep "$AARCH64_FILENAME_PATTERN" | sort | tail -n 1 | awk '{print $4}') | ||
|
||
[[ -z "$aarch64Deps" ]] && { echo "Error: aarch64 dependency not found"; exit 1; } | ||
|
||
amd64Deps=$(aws s3 ls s3://${dependency_bucket}/${PLATFORM}/${X86_64} | grep "$AMD64_FILENAME_PATTERN" | sort | tail -n 1 | awk '{print $4}') | ||
|
||
[[ -z "$amd64Deps" ]] && { echo "Error: x86_64 dependency not found"; exit 1; } | ||
|
||
sed -E -i.bak 's|^([[:blank:]]*FINCH_ROOTFS_URL[[:blank:]]*\?=[[:blank:]]*'${DEPENDENCY_CLOUDFRONT_URL}')('${AARCH64_FILENAME_PATTERN}')|\1'$aarch64Deps'|' Makefile | ||
sed -E -i.bak 's|^([[:blank:]]*FINCH_ROOTFS_URL[[:blank:]]*\?=[[:blank:]]*'${DEPENDENCY_CLOUDFRONT_URL}')('${AMD64_FILENAME_PATTERN}')|\1'$amd64Deps'|' Makefile |