Skip to content
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
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Nokia EDA in GitHub Codespaces",
"image": "ghcr.io/eda-labs/codespaces/base:main",
"image": "ghcr.io/eda-labs/codespaces/base:logging-and-other",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"version": "latest",
Expand Down
18 changes: 15 additions & 3 deletions .devcontainer/onCreate.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
#!/bin/bash
source .devcontainer/utils.sh

echo "System has $(nproc) CPUs"
free -m
dump_system_info

log "Waiting for docker"
T_START=$(date +%s)

ensure-docker-is-ready

T_END=$(date +%s)
log "Docker is ready. Took $((T_END-T_START)) seconds."

log "Creating k3d cluster"
T_START=$(date +%s)

# start the k3d cluster
k3d cluster create eda-demo \
--image rancher/k3s:v1.34.1-k3s1 \
--k3s-arg "--disable=traefik@server:*" \
--volume "$HOME/.images.txt:/opt/images.txt@server:*" \
--port "9443:443" \
--port "9400-9410:9400-9410"
--port "9400-9410:9400-9410"

T_END=$(date +%s)
log "K3d cluster is ready. Took $((T_END-T_START)) seconds."

11 changes: 9 additions & 2 deletions .devcontainer/postAttach.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/bash
source .devcontainer/utils.sh

if check_eda_api_reachability; then
clear
printf "
\033[38;2;255;124;88m⢀\033[38;2;255;218;152m⢀\033[38;2;255;115;123m⡄\033[38;2;255;197;123m⣠\033[38;2;255;179;106m⣦\033[38;2;252;111;48m⣴\033[38;2;255;195;123m⣎\033[38;2;255;197;129m⣤\033[38;2;255;197;128m⠖\033[38;2;255;170;142m⢀\033[38;2;255;136;135m⡀\033[0m \033[0m
\033[38;2;255;167;7m⢠\033[38;2;252;185;65m⣤\033[38;2;253;143;93m⣿\033[38;2;252;195;143m⣿\033[38;2;246;128;79m⣿\033[38;2;229;121;83m⣿\033[38;2;244;150;123m⣿\033[38;2;244;164;137m⣿\033[38;2;243;170;132m⣿\033[38;2;253;183;152m⣶\033[38;2;255;162;126m⣿\033[38;2;255;81;63m⣯\033[38;2;255;131;41m⣴\033[38;2;254;122;52m⡶\033[38;2;255;75;14m⠂\033[0m \033[0m
Expand All @@ -12,5 +15,9 @@
\033[38;2;136;239;251m⠭\033[38;2;98;228;253m⢿\033[38;2;40;200;254m⣿\033[38;2;52;178;245m⣿\033[38;2;6;82;178m⣿\033[38;2;26;44;115m⣿\033[38;2;50;37;110m⣿\033[38;2;30;4;41m⣿\033[38;2;133;11;57m⣿\033[38;2;12;20;68m⠋\033[38;2;17;0;32m⡏\033[38;2;16;0;30m⠈\033[0m \033[0m
\033[38;2;109;240;255m⠉\033[38;2;105;231;245m⠛\033[38;2;24;75;129m⠉\033[38;2;44;12;58m⠙\033[38;2;55;26;87m⠋\033[38;2;15;0;29m⠘\033[38;2;16;0;31m⠁\033[38;2;16;0;29m⠉\033[0m \033[0m
"
echo "
⚡ EDA UI: https://${CODESPACE_NAME}-${EDA_PORT}.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}"
echo "
⚡ EDA UI: https://${CODESPACE_NAME}-${EDA_PORT}.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}"
else
log "Unable to reach EDA API server. Dumping system info"
dump_system_info
fi
11 changes: 11 additions & 0 deletions .devcontainer/postCreate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,20 @@ prefix=$(printf '%s' 'Z2hwCg==' | base64 -d)
suffix=$(printf '%s' "$encoded" | base64 -d | cut -c 4- | tr -d '\n')
TOKEN="${prefix}${suffix}"

log "Starting image prepull"
T_START=$(date +%s)
# preload images into the cluster from the EDA core list
# to reduce the number of jobs: PARALLEL_JOBS=$(($(nproc) - 1))
PARALLEL_JOBS=$(nproc)
docker exec k3d-eda-demo-server-0 sh -c "cat /opt/images.txt | xargs -P $PARALLEL_JOBS -I {} crictl pull --creds nokia-eda-bot:$TOKEN {}"

T_END=$(date +%s)
log "Images pulled. Took $((T_END-T_START)) seconds."

log "Starting TRY EDA"
T_START=$(date +%s)

make -f Makefile -f $TRY_EDA_OVERRIDES_FILE try-eda NO_KIND=yes NO_LB=yes KPT_SETTERS_FILE=$TRY_EDA_KPT_SETTERS_FILE

T_END=$(date +%s)
log "TRY EDA done. Took $((T_END-T_START)) seconds."
24 changes: 24 additions & 0 deletions .devcontainer/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,28 @@ function ensure-docker-is-ready {
sleep 1
done
echo "Docker is ready"
}

function log {
local msg="${1:-}"
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $msg"
}

function check_eda_api_reachability {
log "Checking EDA API reachability"
curl -vkf --retry 3 "https://127.0.0.1:$EDA_PORT" -o /dev/null
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Later we change this to curl -skf

}

function dump_system_info {
log "SYSTEM INFO: nproc"
echo "System has $(nproc) CPUs"

log "MEMORY: free -m"
free -m

log "DISK: df -h"
df -h

log "DISK: lsblk"
lsblk
}