Skip to content
This repository was archived by the owner on Mar 20, 2025. It is now read-only.

Commit 4f88c91

Browse files
committed
ci: change error color from red to purple
1 parent a297e9d commit 4f88c91

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

.github/workflows/codespaces-ci.sh

+21-11
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
#!/bin/bash
22
set -e
33

4+
# IMPORTANT:a valid GITHUB_TOKEN is required to run this script
5+
46
GITHUB_REPOSITORY="Azure-Samples/contoso-real-estate"
57
BRANCH="codespaces-ci"
68
CODESPACE_NAME="ci-nightly-build-$(date +%s)"
79
CODESPACE_ID=""
8-
RED='\033[0;31m'
10+
RED='\033[0;35m' // this is not red, it's purple!
911
GREEN='\033[0;32m'
1012
NC='\033[0m' # No Color
1113
1214
# login to GitHub CLI
1315
function gh_login() {
1416
echo "Loging in with GitHub CLI as admin..."
15-
echo $X_GITHUB_TOKEN | gh auth login --with-token
17+
echo $X_GITHUB_TOKEN | gh auth login --with-token
1618
1719
echo "Checking auth status..."
1820
gh auth status
@@ -33,7 +35,7 @@ function gh_create_codespace() {
3335
}
3436
function api_create_codespace() {
3537
echo "Creating a codespace $CODESPACE_NAME for $GITHUB_REPOSITORY on branch $BRANCH (w/ api)..."
36-
CODESPACE_ID=$(gh api \
38+
response=$(gh api \
3739
/repos/$GITHUB_REPOSITORY/codespaces \
3840
-X POST \
3941
-H 'Accept: application/vnd.github+json' \
@@ -46,9 +48,14 @@ function api_create_codespace() {
4648
-f idleTimeout='5min' \
4749
-f machineType=l'argePremiumLinux' \
4850
-f status='true' \
49-
-f defaultPermissions='true' \
50-
-q '.name')
51-
echo "Codespace created and started: $CODESPACE_ID"
51+
-f defaultPermissions='true')
52+
CODESPACE_ID=$(echo "$response" | jq '.name')
53+
CODESPACE_URL=$(echo "$response" | jq '.web_url')
54+
CODESPACE_API=$(echo "$response" | jq '.url')
55+
echo "Codespace created and started:"
56+
echo " - ID: $CODESPACE_ID"
57+
echo " - Web: $CODESPACE_URL"
58+
echo " - API: $CODESPACE_API"
5259
}
5360
5461
# fetch the codespace ID
@@ -81,7 +88,7 @@ function gh_codespace_check_services_status() {
8188
fi
8289
8390
nb_services_down=0
84-
echo "---------------------------------------------------------------------------------------------------------"
91+
echo "---------------------------------------------------------------------------------------------------------"
8592
for service in $services; do
8693
echo -ne "Inspecting: $service ... "
8794
status=$(curl -H "X-Github-Token: $GITHUB_TOKEN" -s -o /dev/null -w "%{http_code}" $service)
@@ -112,12 +119,15 @@ function gh_codespace_check_services_status() {
112119
done
113120
}
114121
115-
# Wait for the services to start
122+
# Wait for all services to start
116123
function wait_for_services() {
117-
echo -ne "Waiting 6 mintues for all dependencies to be installed and starting all services..."
118-
for i in {1..360}; do
124+
echo "Waiting 10 mintues for all dependencies to be installed and starting all services"
125+
for i in {1..600}; do
119126
echo -ne "."
120127
sleep 1
128+
if ! ((i % 60)); then
129+
echo ""
130+
fi
121131
done
122132
echo ""
123133
}
@@ -152,4 +162,4 @@ api_create_codespace;
152162
wait_for_services;
153163
gh_codespace_check_services_status;
154164
gh_codespace_stop_and_delete;
155-
print_report_and_exit;
165+
print_report_and_exit;

0 commit comments

Comments
 (0)