Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add oras binary to cache #4691

Merged
merged 20 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions parts/linux/cloud-init/artifacts/components.json
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,20 @@
}
],
"Packages": [
{
"name": "oras",
"downloadLocation": "/usr/local/bin",
"downloadURIs": {
"default": {
"current": {
"versions": [
"1.2.0"
],
"downloadURL": "https://github.com/oras-project/oras/releases/download/v${version}/oras_${version}_linux_${CPU_ARCH}.tar.gz"
}
}
}
},
{
"name": "runc",
"downloadLocation": "/opt/runc/downloads",
Expand Down
1 change: 1 addition & 0 deletions parts/linux/cloud-init/artifacts/cse_helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ ERR_CNI_DOWNLOAD_TIMEOUT=41 # Timeout waiting for CNI downloads
ERR_MS_PROD_DEB_DOWNLOAD_TIMEOUT=42 # Timeout waiting for https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb
ERR_MS_PROD_DEB_PKG_ADD_FAIL=43 # Failed to add repo pkg file
# ERR_FLEXVOLUME_DOWNLOAD_TIMEOUT=44 Failed to add repo pkg file -- DEPRECATED
ERR_ORAS_DOWNLOAD_ERROR=45 # Unable to install oras
ERR_SYSTEMD_INSTALL_FAIL=48 # Unable to install required systemd version
ERR_MODPROBE_FAIL=49 # Unable to load a kernel module using modprobe
ERR_OUTBOUND_CONN_FAIL=50 # Unable to establish outbound connection
Expand Down
25 changes: 25 additions & 0 deletions parts/linux/cloud-init/artifacts/cse_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,31 @@ downloadContainerdWasmShims() {
done
}

# TODO (alburgess) have oras version managed by dependant or Renovate
installOras() {
ORAS_DOWNLOAD_DIR="/opt/oras/downloads"
ORAS_EXTRACTED_DIR=${1} # Use components.json var for /usr/local/bin for linux-vhd-content-test.sh binary file checks.
ORAS_DOWNLOAD_URL=${2}
ORAS_VERSION=${3}

mkdir -p $ORAS_DOWNLOAD_DIR

echo "Installing Oras version $ORAS_VERSION..."
ORAS_TMP=${ORAS_DOWNLOAD_URL##*/} # Use bash builtin ## to remove all chars ("*") up to the final "/"
retrycmd_get_tarball 120 5 "$ORAS_DOWNLOAD_DIR/${ORAS_TMP}" ${ORAS_DOWNLOAD_URL} || exit $ERR_ORAS_DOWNLOAD_ERROR

if [ ! -f "$ORAS_DOWNLOAD_DIR/${ORAS_TMP}" ]; then
echo "File $ORAS_DOWNLOAD_DIR/${ORAS_TMP} does not exist."
exit $ERR_ORAS_DOWNLOAD_ERROR
fi

echo "File $ORAS_DOWNLOAD_DIR/${ORAS_TMP} exists."
sudo tar -zxf "$ORAS_DOWNLOAD_DIR/${ORAS_TMP}" -C $ORAS_EXTRACTED_DIR/
rm -r "$ORAS_DOWNLOAD_DIR"
echo "Oras version $ORAS_VERSION installed successfully."

}

evalPackageDownloadURL() {
local url=${1:-}
if [[ -n "$url" ]]; then
Expand Down
4 changes: 2 additions & 2 deletions pkg/agent/testdata/AKSUbuntu1604+Containerd/CustomData

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions pkg/agent/testdata/AKSUbuntu1604+Containerd/line40.sh
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,30 @@ downloadContainerdWasmShims() {
done
}

installOras() {
ORAS_DOWNLOAD_DIR="/opt/oras/downloads"
ORAS_EXTRACTED_DIR=${1}
ORAS_DOWNLOAD_URL=${2}
ORAS_VERSION=${3}

mkdir -p $ORAS_DOWNLOAD_DIR

echo "Installing Oras version $ORAS_VERSION..."
ORAS_TMP=${ORAS_DOWNLOAD_URL##*/} # Use bash builtin #
retrycmd_get_tarball 120 5 "$ORAS_DOWNLOAD_DIR/${ORAS_TMP}" ${ORAS_DOWNLOAD_URL} || exit $ERR_ORAS_DOWNLOAD_ERROR

if [ ! -f "$ORAS_DOWNLOAD_DIR/${ORAS_TMP}" ]; then
echo "File $ORAS_DOWNLOAD_DIR/${ORAS_TMP} does not exist."
exit $ERR_ORAS_DOWNLOAD_ERROR
fi

echo "File $ORAS_DOWNLOAD_DIR/${ORAS_TMP} exists."
sudo tar -zxf "$ORAS_DOWNLOAD_DIR/${ORAS_TMP}" -C $ORAS_EXTRACTED_DIR/
rm -r "$ORAS_DOWNLOAD_DIR"
echo "Oras version $ORAS_VERSION installed successfully."

}

evalPackageDownloadURL() {
local url=${1:-}
if [[ -n "$url" ]]; then
Expand Down
1 change: 1 addition & 0 deletions pkg/agent/testdata/AKSUbuntu1604+Containerd/line9.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ ERR_CONTAINERD_VERSION_INVALID=39
ERR_CNI_DOWNLOAD_TIMEOUT=41
ERR_MS_PROD_DEB_DOWNLOAD_TIMEOUT=42
ERR_MS_PROD_DEB_PKG_ADD_FAIL=43
ERR_ORAS_DOWNLOAD_ERROR=45
ERR_SYSTEMD_INSTALL_FAIL=48
ERR_MODPROBE_FAIL=49
ERR_OUTBOUND_CONN_FAIL=50
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,30 @@ downloadContainerdWasmShims() {
done
}

installOras() {
ORAS_DOWNLOAD_DIR="/opt/oras/downloads"
ORAS_EXTRACTED_DIR=${1}
ORAS_DOWNLOAD_URL=${2}
ORAS_VERSION=${3}

mkdir -p $ORAS_DOWNLOAD_DIR

echo "Installing Oras version $ORAS_VERSION..."
ORAS_TMP=${ORAS_DOWNLOAD_URL##*/} # Use bash builtin #
retrycmd_get_tarball 120 5 "$ORAS_DOWNLOAD_DIR/${ORAS_TMP}" ${ORAS_DOWNLOAD_URL} || exit $ERR_ORAS_DOWNLOAD_ERROR

if [ ! -f "$ORAS_DOWNLOAD_DIR/${ORAS_TMP}" ]; then
echo "File $ORAS_DOWNLOAD_DIR/${ORAS_TMP} does not exist."
exit $ERR_ORAS_DOWNLOAD_ERROR
fi

echo "File $ORAS_DOWNLOAD_DIR/${ORAS_TMP} exists."
sudo tar -zxf "$ORAS_DOWNLOAD_DIR/${ORAS_TMP}" -C $ORAS_EXTRACTED_DIR/
rm -r "$ORAS_DOWNLOAD_DIR"
echo "Oras version $ORAS_VERSION installed successfully."

}

evalPackageDownloadURL() {
local url=${1:-}
if [[ -n "$url" ]]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ ERR_CONTAINERD_VERSION_INVALID=39
ERR_CNI_DOWNLOAD_TIMEOUT=41
ERR_MS_PROD_DEB_DOWNLOAD_TIMEOUT=42
ERR_MS_PROD_DEB_PKG_ADD_FAIL=43
ERR_ORAS_DOWNLOAD_ERROR=45
ERR_SYSTEMD_INSTALL_FAIL=48
ERR_MODPROBE_FAIL=49
ERR_OUTBOUND_CONN_FAIL=50
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,30 @@ downloadContainerdWasmShims() {
done
}

installOras() {
ORAS_DOWNLOAD_DIR="/opt/oras/downloads"
ORAS_EXTRACTED_DIR=${1}
ORAS_DOWNLOAD_URL=${2}
ORAS_VERSION=${3}

mkdir -p $ORAS_DOWNLOAD_DIR

echo "Installing Oras version $ORAS_VERSION..."
ORAS_TMP=${ORAS_DOWNLOAD_URL##*/} # Use bash builtin #
retrycmd_get_tarball 120 5 "$ORAS_DOWNLOAD_DIR/${ORAS_TMP}" ${ORAS_DOWNLOAD_URL} || exit $ERR_ORAS_DOWNLOAD_ERROR

if [ ! -f "$ORAS_DOWNLOAD_DIR/${ORAS_TMP}" ]; then
echo "File $ORAS_DOWNLOAD_DIR/${ORAS_TMP} does not exist."
exit $ERR_ORAS_DOWNLOAD_ERROR
fi

echo "File $ORAS_DOWNLOAD_DIR/${ORAS_TMP} exists."
sudo tar -zxf "$ORAS_DOWNLOAD_DIR/${ORAS_TMP}" -C $ORAS_EXTRACTED_DIR/
rm -r "$ORAS_DOWNLOAD_DIR"
echo "Oras version $ORAS_VERSION installed successfully."

}

evalPackageDownloadURL() {
local url=${1:-}
if [[ -n "$url" ]]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ ERR_CONTAINERD_VERSION_INVALID=39
ERR_CNI_DOWNLOAD_TIMEOUT=41
ERR_MS_PROD_DEB_DOWNLOAD_TIMEOUT=42
ERR_MS_PROD_DEB_PKG_ADD_FAIL=43
ERR_ORAS_DOWNLOAD_ERROR=45
ERR_SYSTEMD_INSTALL_FAIL=48
ERR_MODPROBE_FAIL=49
ERR_OUTBOUND_CONN_FAIL=50
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,30 @@ downloadContainerdWasmShims() {
done
}

installOras() {
ORAS_DOWNLOAD_DIR="/opt/oras/downloads"
ORAS_EXTRACTED_DIR=${1}
ORAS_DOWNLOAD_URL=${2}
ORAS_VERSION=${3}

mkdir -p $ORAS_DOWNLOAD_DIR

echo "Installing Oras version $ORAS_VERSION..."
ORAS_TMP=${ORAS_DOWNLOAD_URL##*/} # Use bash builtin #
retrycmd_get_tarball 120 5 "$ORAS_DOWNLOAD_DIR/${ORAS_TMP}" ${ORAS_DOWNLOAD_URL} || exit $ERR_ORAS_DOWNLOAD_ERROR

if [ ! -f "$ORAS_DOWNLOAD_DIR/${ORAS_TMP}" ]; then
echo "File $ORAS_DOWNLOAD_DIR/${ORAS_TMP} does not exist."
exit $ERR_ORAS_DOWNLOAD_ERROR
fi

echo "File $ORAS_DOWNLOAD_DIR/${ORAS_TMP} exists."
sudo tar -zxf "$ORAS_DOWNLOAD_DIR/${ORAS_TMP}" -C $ORAS_EXTRACTED_DIR/
rm -r "$ORAS_DOWNLOAD_DIR"
echo "Oras version $ORAS_VERSION installed successfully."

}

evalPackageDownloadURL() {
local url=${1:-}
if [[ -n "$url" ]]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ ERR_CONTAINERD_VERSION_INVALID=39
ERR_CNI_DOWNLOAD_TIMEOUT=41
ERR_MS_PROD_DEB_DOWNLOAD_TIMEOUT=42
ERR_MS_PROD_DEB_PKG_ADD_FAIL=43
ERR_ORAS_DOWNLOAD_ERROR=45
ERR_SYSTEMD_INSTALL_FAIL=48
ERR_MODPROBE_FAIL=49
ERR_OUTBOUND_CONN_FAIL=50
Expand Down
Loading
Loading