Skip to content

Commit 73faa0f

Browse files
committed
check if airgap is built before installing on CMX
1 parent 2dcd239 commit 73faa0f

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

applications/wg-easy/Taskfile.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,46 @@ tasks:
611611
exit 1
612612
fi
613613
614+
# Check if airgap build is available when airgap mode is enabled
615+
if [ "{{.AIRGAP}}" = "true" ]; then
616+
echo "Checking if airgap build is available for lastest release in channel {{.CHANNEL}}..."
617+
618+
# Get release list and extract app ID and channel ID
619+
RELEASE_DATA=$(replicated release ls -o json)
620+
APP_ID=$(echo "$RELEASE_DATA" | jq -r '.[0].appId')
621+
CHANNEL_ID=$(echo "$RELEASE_DATA" | jq -r '.[0].activeChannels[] | select(.name == "{{.CHANNEL}}") | .id')
622+
623+
if [ -z "$APP_ID" ] || [ "$APP_ID" = "null" ]; then
624+
echo "Error: Could not retrieve app ID from releases"
625+
exit 1
626+
fi
627+
628+
if [ -z "$CHANNEL_ID" ] || [ "$CHANNEL_ID" = "null" ]; then
629+
echo "Error: Could not find channel ID for channel {{.CHANNEL}}"
630+
exit 1
631+
fi
632+
633+
echo "Found app ID: $APP_ID, channel ID: $CHANNEL_ID"
634+
635+
# Get channel releases and check airgap build status
636+
CHANNEL_RELEASES=$(replicated api get "v3/app/$APP_ID/channel/$CHANNEL_ID/releases")
637+
AIRGAP_BUILD_STATUS=$(echo "$CHANNEL_RELEASES" | jq -r '.releases[0].airgapBuildStatus // "none"')
638+
AIRGAP_BUILD_ERROR=$(echo "$CHANNEL_RELEASES" | jq -r '.releases[0].airgapBuildError // "none"')
639+
AIRGAP_BUNDLE_IMAGES=$(echo "$CHANNEL_RELEASES" | jq -r '.releases[0].airgapBundleImages // "none"')
640+
641+
echo "Airgap build status: $AIRGAP_BUILD_STATUS"
642+
643+
if [ "$AIRGAP_BUILD_STATUS" != "built" ]; then
644+
echo "Error: Airgap build is not ready. Status: $AIRGAP_BUILD_STATUS"
645+
echo "Airgap build error (if any): $AIRGAP_BUILD_ERROR"
646+
echo "Please wait for the airgap build to complete before installing in airgap mode."
647+
exit 1
648+
fi
649+
650+
echo "Airgap build is ready. Proceeding with installation..."
651+
echo "Contents of airgap bundle images: $AIRGAP_BUNDLE_IMAGES"
652+
fi
653+
614654
echo "SSH into the VM and download the app binary..."
615655
SSH_BASE_CMD="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
616656
if [ -n "{{.CMX_VM_PUBLIC_KEY}}" ]; then

0 commit comments

Comments
 (0)