Skip to content

Commit

Permalink
Add error handling for failed oras pull during installation. (radiu…
Browse files Browse the repository at this point in the history
…s-project#7302)

# Description

This PR adds a check to make sure the `oras pull` command compelted
successfully. This is needed because it will fail if you have an expired
token for GHCR.

## Type of change

<!--

Please select **one** of the following options that describes your
change and delete the others. Clearly identifying the type of change you
are making will help us review your PR faster, and is used in authoring
release notes.

If you are making a bug fix or functionality change to Radius and do not
have an associated issue link please create one now.

-->

- This pull request fixes a bug in Radius and has an approved issue
(issue link required).

<!--

Please update the following to link the associated issue. This is
required for some kinds of changes (see above).

-->

Fixes: radius-project#7301

---------

Signed-off-by: Aaron Crawfis <[email protected]>
Co-authored-by: Young Bu Park <[email protected]>
  • Loading branch information
AaronCrawfis and youngbupark authored Mar 20, 2024
1 parent a58a5d5 commit 2a681be
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
8 changes: 8 additions & 0 deletions deploy/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,14 @@ if ($Version -eq "edge") {
$downloadURL = "ghcr.io/${GitHubOrg}/rad/${OS}-${Arch}:latest"
Write-Output "Downloading edge CLI from ${downloadURL}..."
oras pull $downloadURL -o $RadiusRoot

# Check if the oras pull command was successful
if ($LASTEXITCODE -ne 0) {
Write-Output "Failed to download edge rad CLI."
Write-Output "If this was an authentication issue, please run 'docker logout ghcr.io' to clear any expired credentials."
Write-Output "Visit https://edge.docs.radapp.io/installation for edge build installation instructions."
Exit 1
}
}
else {
# Get the list of releases from GitHub
Expand Down
9 changes: 9 additions & 0 deletions deploy/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,15 @@ downloadFile() {
DOWNLOAD_URL="ghcr.io/radius-project/rad/${OS}-${ARCH}:latest"
echo "Downloading edge CLI from ${DOWNLOAD_URL}..."
oras pull $DOWNLOAD_URL -o $RADIUS_TMP_ROOT

# Check if the oras pull command was successfull
if [ $? -ne 0 ]; then
echo "Failed to download edge CLI."
echo "If this was an authentication issue, please run 'docker logout ghcr.io' to clear any expired credentials."
echo "Visit https://edge.docs.radapp.io/installation for edge CLI installation instructions."
exit 1
fi

mv $RADIUS_TMP_ROOT/rad $ARTIFACT_TMP_FILE
else
DOWNLOAD_BASE="https://github.com/${GITHUB_ORG}/${GITHUB_REPO}/releases/download"
Expand Down

0 comments on commit 2a681be

Please sign in to comment.