Skip to content

Commit a0ce9a7

Browse files
Consolidate post-start up
1 parent f79b533 commit a0ce9a7

File tree

5 files changed

+94
-255
lines changed

5 files changed

+94
-255
lines changed

.devcontainer/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,11 @@ This approach ensures that time-consuming operations happen during container pre
3333
|------|---------|-------|
3434
| `python312/devcontainer.json` | Dev container configuration (Python 3.12) | All |
3535
| `python312/Dockerfile` | Container image definition (Python 3.12) | Build |
36-
| `python312/post-start-setup.sh` | Runtime verification script | Runtime |
3736
| `python313/devcontainer.json` | Dev container configuration (Python 3.13) | All |
3837
| `python313/Dockerfile` | Container image definition (Python 3.13) | Build |
39-
| `python313/post-start-setup.sh` | Runtime verification script | Runtime |
4038
| `python314/devcontainer.json` | Dev container configuration (Python 3.14) | All |
4139
| `python314/Dockerfile` | Container image definition (Python 3.14) | Build |
42-
| `python314/post-start-setup.sh` | Runtime verification script | Runtime |
40+
| `post-start-setup.sh` | Shared runtime verification script | Runtime |
4341
| `README.md` | This documentation | - |
4442

4543
### Configuration Details
@@ -57,6 +55,7 @@ This approach ensures that time-consuming operations happen during container pre
5755
- **Virtual Environment**: Auto-activation configuration
5856

5957
#### `post-start-setup.sh` (shared behavior)
58+
- **Location**: `.devcontainer/post-start-setup.sh` is invoked by each Python variant's `post-start-setup.sh` wrapper
6059
- **Environment Verification**: Quick checks and status reporting
6160
- **Fallback Installation**: Safety net for missing components
6261
- **User Guidance**: Next steps and helpful information

.devcontainer/post-start-setup.sh

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
#!/bin/bash
2+
3+
# ------------------------------
4+
# APIM SAMPLES INSTANT VERIFICATION
5+
# ------------------------------
6+
7+
start=$(date +%s.%N)
8+
9+
# Make terminal output more prominent
10+
clear
11+
echo "============================================================================"
12+
echo " 🚀 APIM SAMPLES - INSTANT VERIFICATION "
13+
echo "============================================================================"
14+
echo ""
15+
echo "⚡ All heavy setup was completed during prebuild - verifying environment..."
16+
echo ""
17+
18+
# ------------------------------
19+
# LIGHTNING FAST VERIFICATION
20+
# ------------------------------
21+
22+
WORKSPACE_ROOT="/workspaces/Apim-Samples"
23+
VENV_PATH="$WORKSPACE_ROOT/.venv"
24+
PY_VERSION=$(python --version 2>/dev/null | awk '{print $2}' | cut -d'.' -f1,2)
25+
PY_VERSION_DISPLAY=${PY_VERSION:-"unknown"}
26+
27+
echo -e "Environment Status:\n"
28+
29+
# Ultra-fast file system checks (no command execution)
30+
if [ -d "$VENV_PATH" ]; then
31+
echo " ✅ Virtual environment"
32+
else
33+
echo " ❌ Virtual environment missing"
34+
fi
35+
36+
if [ -f "$WORKSPACE_ROOT/.env" ]; then
37+
echo " ✅ Environment file"
38+
else
39+
echo " ❌ Environment file missing"
40+
fi
41+
42+
# Quick command availability checks (fast)
43+
if command -v az >/dev/null 2>&1; then
44+
echo " ✅ Azure CLI"
45+
else
46+
echo " ❌ Azure CLI missing"
47+
fi
48+
49+
if command -v python >/dev/null 2>&1; then
50+
echo " ✅ Python (${PY_VERSION_DISPLAY})"
51+
else
52+
echo " ❌ Python missing"
53+
fi
54+
55+
# Calculate total duration
56+
end=$(date +%s.%N)
57+
duration=$(python3 -c "print(f'{float('$end') - float('$start'):.1f}')" 2>/dev/null || echo "0.1")
58+
59+
echo ""
60+
echo "============================================================================"
61+
echo " ⚡ INSTANT VERIFICATION COMPLETE! "
62+
echo "============================================================================"
63+
echo ""
64+
printf "⏱️ Verification time: %s seconds\n" "$duration"
65+
echo ""
66+
echo "🎉 Your APIM Samples environment is ready to use!"
67+
echo -e "\n"
68+
echo " Next Steps:"
69+
echo ""
70+
echo " 1. Open a new terminal and log in via the Azure CLI with either command."
71+
echo " See TROUBLESHOOTING.md in the root for details."
72+
echo ""
73+
echo " - az login"
74+
echo " - az login --tenant <your-tenant-id>"
75+
echo ""
76+
echo " 2. Wait until Codespace is fully started (it's fairly quick):"
77+
echo " - Watch progress indicators in status bar"
78+
echo " - Wait for all extensions to install"
79+
echo " --> ✅ (.venv) prefix will appear when you open a new terminal"
80+
echo ""
81+
echo " 3. Start using the infrastructures and samples!"
82+
echo " - You may initially need to select the kernel (top-right above the"
83+
echo " Jupyter notebook). If so, select the '.venv' Python environment."
84+
echo ""
85+
echo "============================================================================"
86+
echo -e "\n\n"
Lines changed: 2 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,4 @@
11
#!/bin/bash
22

3-
# ------------------------------
4-
# APIM SAMPLES INSTANT VERIFICATION
5-
# ------------------------------
6-
7-
start=$(date +%s.%N)
8-
9-
# Make terminal output more prominent
10-
clear
11-
echo "============================================================================"
12-
echo " 🚀 APIM SAMPLES - INSTANT VERIFICATION "
13-
echo "============================================================================"
14-
echo ""
15-
echo "⚡ All heavy setup was completed during prebuild - verifying environment..."
16-
echo ""
17-
18-
# ------------------------------
19-
# LIGHTNING FAST VERIFICATION
20-
# ------------------------------
21-
22-
WORKSPACE_ROOT="/workspaces/Apim-Samples"
23-
VENV_PATH="$WORKSPACE_ROOT/.venv"
24-
PY_VERSION=$(python --version 2>/dev/null | awk '{print $2}' | cut -d'.' -f1,2)
25-
PY_VERSION_DISPLAY=${PY_VERSION:-"unknown"}
26-
27-
echo -e "Environment Status:\n"
28-
29-
# Ultra-fast file system checks (no command execution)
30-
if [ -d "$VENV_PATH" ]; then
31-
echo " ✅ Virtual environment"
32-
else
33-
echo " ❌ Virtual environment missing"
34-
fi
35-
36-
if [ -f "$WORKSPACE_ROOT/.env" ]; then
37-
echo " ✅ Environment file"
38-
else
39-
echo " ❌ Environment file missing"
40-
fi
41-
42-
# Quick command availability checks (fast)
43-
if command -v az >/dev/null 2>&1; then
44-
echo " ✅ Azure CLI"
45-
else
46-
echo " ❌ Azure CLI missing"
47-
fi
48-
49-
if command -v python >/dev/null 2>&1; then
50-
echo " ✅ Python (${PY_VERSION_DISPLAY})"
51-
else
52-
echo " ❌ Python missing"
53-
fi
54-
55-
# Calculate total duration
56-
end=$(date +%s.%N)
57-
duration=$(python3 -c "print(f'{float('$end') - float('$start'):.1f}')" 2>/dev/null || echo "0.1")
58-
59-
echo ""
60-
echo "============================================================================"
61-
echo " ⚡ INSTANT VERIFICATION COMPLETE! "
62-
echo "============================================================================"
63-
echo ""
64-
printf "⏱️ Verification time: %s seconds\n" "$duration"
65-
echo ""
66-
echo "🎉 Your APIM Samples environment is ready to use!"
67-
echo -e "\n"
68-
echo " Next Steps:"
69-
echo ""
70-
echo " 1. Open a new terminal and log in via the Azure CLI with either command."
71-
echo " See TROUBLESHOOTING.md in the root for details."
72-
echo ""
73-
echo " - az login"
74-
echo " - az login --tenant <your-tenant-id>"
75-
echo ""
76-
echo " 2. Wait until Codespace is fully started (it's fairly quick):"
77-
echo " - Watch progress indicators in status bar"
78-
echo " - Wait for all extensions to install"
79-
echo " --> ✅ (.venv) prefix will appear when you open a new terminal"
80-
echo ""
81-
echo " 3. Start using the infrastructures and samples!"
82-
echo " - You may initially need to select the kernel (top-right above the"
83-
echo " Jupyter notebook). If so, select the '.venv' Python environment."
84-
echo ""
85-
echo "============================================================================"
86-
echo -e "\n\n"
3+
# Delegate to the shared devcontainer runtime script to avoid per-version duplicates.
4+
bash "$(dirname "$0")/../post-start-setup.sh"
Lines changed: 2 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,4 @@
11
#!/bin/bash
22

3-
# ------------------------------
4-
# APIM SAMPLES INSTANT VERIFICATION
5-
# ------------------------------
6-
7-
start=$(date +%s.%N)
8-
9-
# Make terminal output more prominent
10-
clear
11-
echo "============================================================================"
12-
echo " 🚀 APIM SAMPLES - INSTANT VERIFICATION "
13-
echo "============================================================================"
14-
echo ""
15-
echo "⚡ All heavy setup was completed during prebuild - verifying environment..."
16-
echo ""
17-
18-
# ------------------------------
19-
# LIGHTNING FAST VERIFICATION
20-
# ------------------------------
21-
22-
WORKSPACE_ROOT="/workspaces/Apim-Samples"
23-
VENV_PATH="$WORKSPACE_ROOT/.venv"
24-
PY_VERSION=$(python --version 2>/dev/null | awk '{print $2}' | cut -d'.' -f1,2)
25-
PY_VERSION_DISPLAY=${PY_VERSION:-"unknown"}
26-
27-
echo -e "Environment Status:\n"
28-
29-
# Ultra-fast file system checks (no command execution)
30-
if [ -d "$VENV_PATH" ]; then
31-
echo " ✅ Virtual environment"
32-
else
33-
echo " ❌ Virtual environment missing"
34-
fi
35-
36-
if [ -f "$WORKSPACE_ROOT/.env" ]; then
37-
echo " ✅ Environment file"
38-
else
39-
echo " ❌ Environment file missing"
40-
fi
41-
42-
# Quick command availability checks (fast)
43-
if command -v az >/dev/null 2>&1; then
44-
echo " ✅ Azure CLI"
45-
else
46-
echo " ❌ Azure CLI missing"
47-
fi
48-
49-
if command -v python >/dev/null 2>&1; then
50-
echo " ✅ Python (${PY_VERSION_DISPLAY})"
51-
else
52-
echo " ❌ Python missing"
53-
fi
54-
55-
# Calculate total duration
56-
end=$(date +%s.%N)
57-
duration=$(python3 -c "print(f'{float('$end') - float('$start'):.1f}')" 2>/dev/null || echo "0.1")
58-
59-
echo ""
60-
echo "============================================================================"
61-
echo " ⚡ INSTANT VERIFICATION COMPLETE! "
62-
echo "============================================================================"
63-
echo ""
64-
printf "⏱️ Verification time: %s seconds\n" "$duration"
65-
echo ""
66-
echo "🎉 Your APIM Samples environment is ready to use!"
67-
echo -e "\n"
68-
echo " Next Steps:"
69-
echo ""
70-
echo " 1. Open a new terminal and log in via the Azure CLI with either command."
71-
echo " See TROUBLESHOOTING.md in the root for details."
72-
echo ""
73-
echo " - az login"
74-
echo " - az login --tenant <your-tenant-id>"
75-
echo ""
76-
echo " 2. Wait until Codespace is fully started (it's fairly quick):"
77-
echo " - Watch progress indicators in status bar"
78-
echo " - Wait for all extensions to install"
79-
echo " --> ✅ (.venv) prefix will appear when you open a new terminal"
80-
echo ""
81-
echo " 3. Start using the infrastructures and samples!"
82-
echo " - You may initially need to select the kernel (top-right above the"
83-
echo " Jupyter notebook). If so, select the '.venv' Python environment."
84-
echo ""
85-
echo "============================================================================"
86-
echo -e "\n\n"
3+
# Delegate to the shared devcontainer runtime script to avoid per-version duplicates.
4+
bash "$(dirname "$0")/../post-start-setup.sh"
Lines changed: 2 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,4 @@
11
#!/bin/bash
22

3-
# ------------------------------
4-
# APIM SAMPLES INSTANT VERIFICATION
5-
# ------------------------------
6-
7-
start=$(date +%s.%N)
8-
9-
# Make terminal output more prominent
10-
clear
11-
echo "============================================================================"
12-
echo " 🚀 APIM SAMPLES - INSTANT VERIFICATION "
13-
echo "============================================================================"
14-
echo ""
15-
echo "⚡ All heavy setup was completed during prebuild - verifying environment..."
16-
echo ""
17-
18-
# ------------------------------
19-
# LIGHTNING FAST VERIFICATION
20-
# ------------------------------
21-
22-
WORKSPACE_ROOT="/workspaces/Apim-Samples"
23-
VENV_PATH="$WORKSPACE_ROOT/.venv"
24-
PY_VERSION=$(python --version 2>/dev/null | awk '{print $2}' | cut -d'.' -f1,2)
25-
PY_VERSION_DISPLAY=${PY_VERSION:-"unknown"}
26-
27-
echo -e "Environment Status:\n"
28-
29-
# Ultra-fast file system checks (no command execution)
30-
if [ -d "$VENV_PATH" ]; then
31-
echo " ✅ Virtual environment"
32-
else
33-
echo " ❌ Virtual environment missing"
34-
fi
35-
36-
if [ -f "$WORKSPACE_ROOT/.env" ]; then
37-
echo " ✅ Environment file"
38-
else
39-
echo " ❌ Environment file missing"
40-
fi
41-
42-
# Quick command availability checks (fast)
43-
if command -v az >/dev/null 2>&1; then
44-
echo " ✅ Azure CLI"
45-
else
46-
echo " ❌ Azure CLI missing"
47-
fi
48-
49-
if command -v python >/dev/null 2>&1; then
50-
echo " ✅ Python (${PY_VERSION_DISPLAY})"
51-
else
52-
echo " ❌ Python missing"
53-
fi
54-
55-
# Calculate total duration
56-
end=$(date +%s.%N)
57-
duration=$(python3 -c "print(f'{float('$end') - float('$start'):.1f}')" 2>/dev/null || echo "0.1")
58-
59-
echo ""
60-
echo "============================================================================"
61-
echo " ⚡ INSTANT VERIFICATION COMPLETE! "
62-
echo "============================================================================"
63-
echo ""
64-
printf "⏱️ Verification time: %s seconds\n" "$duration"
65-
echo ""
66-
echo "🎉 Your APIM Samples environment is ready to use!"
67-
echo -e "\n"
68-
echo " Next Steps:"
69-
echo ""
70-
echo " 1. Open a new terminal and log in via the Azure CLI with either command."
71-
echo " See TROUBLESHOOTING.md in the root for details."
72-
echo ""
73-
echo " - az login"
74-
echo " - az login --tenant <your-tenant-id>"
75-
echo ""
76-
echo " 2. Wait until Codespace is fully started (it's fairly quick):"
77-
echo " - Watch progress indicators in status bar"
78-
echo " - Wait for all extensions to install"
79-
echo " --> ✅ (.venv) prefix will appear when you open a new terminal"
80-
echo ""
81-
echo " 3. Start using the infrastructures and samples!"
82-
echo " - You may initially need to select the kernel (top-right above the"
83-
echo " Jupyter notebook). If so, select the '.venv' Python environment."
84-
echo ""
85-
echo "============================================================================"
86-
echo -e "\n\n"
3+
# Delegate to the shared devcontainer runtime script to avoid per-version duplicates.
4+
bash "$(dirname "$0")/../post-start-setup.sh"

0 commit comments

Comments
 (0)