-
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: update base os image during update dependencies workflow (#349)
Issue #, if available: Base OS image updates have been manual by maintainers. *Description of changes:* This change adds update base os image to the update dependencies workflow. *Testing done:* Locally tested regex to validate it produced the same result as the last update: ``` macedonv@localhost:/Volumes/workplace/finch-core$ aws s3 ls s3://*** --recursive | grep -E 'Fedora-Cloud-Base-.*\.aarch64-[0-9]+\.qcow2$$' | tail -n 1 | sort | awk '{print $4}' Fedora-Cloud-Base-40-1.14.aarch64-20240626221713.qcow2 macedonv@localhost:/Volumes/workplace/finch-core$ ``` - [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: Austin Vazquez <[email protected]>
- Loading branch information
1 parent
f62e43b
commit c059f8d
Showing
5 changed files
with
93 additions
and
5 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 |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# A script to update the base os image used for Finch on macOS. | ||
# | ||
# Usage: bash update-os-image.sh -d <S3 bucket> | ||
|
||
set -euxo pipefail | ||
|
||
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
PROJECT_ROOT="$(cd -- "${CURRENT_DIR}/.." && pwd)" | ||
|
||
# shellcheck source=/dev/null | ||
source "${PROJECT_ROOT}/bin/utility.sh" | ||
|
||
DEPENDENCY_CLOUDFRONT_URL="https://deps.runfinch.com" | ||
AARCH64_FILENAME_PATTERN="Fedora-Cloud-Base-.*\.aarch64-[0-9]+\.qcow2$" | ||
AMD64_FILENAME_PATTERN="Fedora-Cloud-Base-.*\.x86_64-[0-9]+\.qcow2$" | ||
|
||
while getopts d: flag | ||
do | ||
case "${flag}" in | ||
d) dependency_bucket=${OPTARG};; | ||
*) echo "Error: unknown flag" && exit 1;; | ||
esac | ||
done | ||
|
||
[[ -z "$dependency_bucket" ]] && { echo "Error: dependency bucket not set"; exit 1; } | ||
|
||
aarch64_deps=$(find_latest_object_match_from_s3 "${AARCH64_FILENAME_PATTERN}" "${dependency_bucket}") | ||
[[ -z "$aarch64_deps" ]] && { echo "Error: aarch64 dependency not found"; exit 1; } | ||
|
||
# Need to pull the shasum of the artifact to store for later verification. | ||
aarch64_deps_shasum_url="${DEPENDENCY_CLOUDFRONT_URL}/${aarch64_deps}.sha512sum" | ||
aarch64_deps_shasum=$(curl -L --fail "${aarch64_deps_shasum_url}") | ||
|
||
pull_artifact_and_verify_shasum "${DEPENDENCY_CLOUDFRONT_URL}/${aarch64_deps}" "${aarch64_deps_shasum}" | ||
|
||
amd64_deps=$(find_latest_object_match_from_s3 "${AMD64_FILENAME_PATTERN}" "${dependency_bucket}") | ||
[[ -z "$amd64_deps" ]] && { echo "Error: x86_64 dependency not found"; exit 1; } | ||
|
||
amd64_deps_shasum_url="${DEPENDENCY_CLOUDFRONT_URL}/${amd64_deps}.sha512sum" | ||
amd64_deps_shasum=$(curl -L --fail "${amd64_deps_shasum_url}") | ||
|
||
pull_artifact_and_verify_shasum "${DEPENDENCY_CLOUDFRONT_URL}/${amd64_deps}" "${amd64_deps_shasum}" | ||
|
||
# Update base os file with latest artifacts and digests | ||
OS_FILE="${PROJECT_ROOT}/deps/full-os.conf" | ||
truncate -s 0 "${OS_FILE}" | ||
{ | ||
echo "ARTIFACT_BASE_URL=${DEPENDENCY_CLOUDFRONT_URL}" | ||
echo "" | ||
echo "# From https://dl.fedoraproject.org/pub/fedora/linux/releases/40/Cloud/aarch64/images/" | ||
echo "AARCH64_ARTIFACT=$(basename "${aarch64_deps}")" | ||
echo "AARCH64_512_DIGEST=${aarch64_deps_shasum}" | ||
echo "" | ||
echo "# From https://dl.fedoraproject.org/pub/fedora/linux/releases/40/Cloud/x86_64/images/" | ||
echo "X86_64_ARTIFACT=$(basename "${amd64_deps}")" | ||
echo "X86_64_512_DIGEST=${amd64_deps_shasum}" | ||
} >> "${OS_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