-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: no-op in prefetch driver when prefetch script does not exist (
#3995) Co-authored-by: Cameron Meissner <[email protected]>
- Loading branch information
1 parent
5be109e
commit cfc7223
Showing
1 changed file
with
9 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
#!/bin/bash | ||
set -eux | ||
|
||
CONTAINER_IMAGE_PREFETCH_SCRIPT_PATH="/opt/azure/containers/prefetch.sh" | ||
|
||
if [ ! -f "$CONTAINER_IMAGE_PREFETCH_SCRIPT_PATH" ]; then | ||
echo "container image prefetch script path does not exist at $CONTAINER_IMAGE_PREFETCH_SCRIPT_PATH" | ||
exit 1 | ||
echo "container image prefetch script path does not exist at $CONTAINER_IMAGE_PREFETCH_SCRIPT_PATH, exiting early..." | ||
exit 0 | ||
fi | ||
|
||
chmod +x $CONTAINER_IMAGE_PREFETCH_SCRIPT_PATH | ||
echo "running container image prefetch script at $CONTAINER_IMAGE_PREFETCH_SCRIPT_PATH..." | ||
sudo /bin/bash $CONTAINER_IMAGE_PREFETCH_SCRIPT_PATH | ||
sudo chmod +x $CONTAINER_IMAGE_PREFETCH_SCRIPT_PATH || exit $? | ||
sudo /bin/bash $CONTAINER_IMAGE_PREFETCH_SCRIPT_PATH || exit $? | ||
echo "container image prefetch script completed successfully" | ||
|
||
echo "deleting container image prefetch script at $CONTAINER_IMAGE_PREFETCH_SCRIPT_PATH..." | ||
rm -f $CONTAINER_IMAGE_PREFETCH_SCRIPT_PATH | ||
echo "container image prefetch script deleted" | ||
echo "removing container image prefetch script at $CONTAINER_IMAGE_PREFETCH_SCRIPT_PATH..." | ||
sudo rm -f $CONTAINER_IMAGE_PREFETCH_SCRIPT_PATH || exit $? | ||
echo "removed container image prefetch script" |