Skip to content

Commit c24ded4

Browse files
committed
Merge remote-tracking branch 'origin/main' into feature/uat-aws
2 parents 6e36ea4 + 469e217 commit c24ded4

File tree

3 files changed

+757
-19
lines changed

3 files changed

+757
-19
lines changed

DEVELOPMENT.md

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,19 @@ This will:
7777
make dev-env-setup AUTO_MODE=true
7878
```
7979

80+
**Debugging setup issues**: If the setup script fails, enable debug mode for detailed output:
81+
```bash
82+
DEBUG=true make dev-env-setup AUTO_MODE=true
83+
```
84+
85+
This will show:
86+
- Architecture detection and mappings
87+
- URL construction for all downloads
88+
- HTTP response codes for failed downloads
89+
- Detailed error messages with suggestions
90+
91+
Common setup issues and solutions are documented in the [Debugging](#-debugging) section.
92+
8093
### Build System
8194

8295
**Unified build system** features:
@@ -851,6 +864,187 @@ The CI environment uses:
851864
# See: https://github.com/koalaman/shellcheck#installing
852865
```
853866

867+
### Debugging Setup Script Issues
868+
869+
The `scripts/setup-dev-env.sh` script installs all development dependencies. If you encounter issues:
870+
871+
#### Enable Debug Mode
872+
873+
```bash
874+
# Run with detailed debugging output
875+
DEBUG=true make dev-env-setup AUTO_MODE=true
876+
877+
# Or run the script directly
878+
DEBUG=true AUTO_MODE=true ./scripts/setup-dev-env.sh
879+
```
880+
881+
**Debug output includes**:
882+
- Architecture detection (x86_64 → amd64, aarch64 → arm64)
883+
- Architecture mappings for different tools (GO_ARCH vs PROTOC_ARCH)
884+
- Complete URLs being constructed for downloads
885+
- HTTP response codes from URL verification
886+
- Version information from `.versions.yaml`
887+
888+
#### Common Setup Issues
889+
890+
**1. Download Failures (404 errors)**
891+
892+
If you see errors like "HTTP 404 Not Found":
893+
894+
```bash
895+
# Enable debug mode to see the exact URL
896+
DEBUG=true ./scripts/setup-dev-env.sh
897+
898+
# Verify the URL manually
899+
curl -I "https://github.com/koalaman/shellcheck/releases/download/v0.11.0/shellcheck-v0.11.0.linux.x86_64.tar.xz"
900+
901+
# Check if the release exists on GitHub
902+
# Visit: https://github.com/<owner>/<repo>/releases
903+
```
904+
905+
**Common causes**:
906+
- Version in `.versions.yaml` doesn't exist in GitHub releases
907+
- Architecture-specific filename doesn't match release assets
908+
- Tool project changed their release naming convention
909+
910+
**2. Architecture Mismatch**
911+
912+
Different tools use different architecture naming:
913+
- **Go tools** (yq, kubectl, helm): `amd64`, `arm64`, `darwin`
914+
- **Protocol Buffers**: `x86_64`, `aarch_64`, `osx-universal_binary`
915+
- **Shellcheck**: `x86_64`, `aarch64`, `darwin`
916+
917+
The script automatically maps these:
918+
```bash
919+
# See mappings in debug output
920+
DEBUG=true ./scripts/setup-dev-env.sh
921+
# Look for: "DEBUG: Architecture mappings: Raw ARCH: x86_64, GO_ARCH: amd64, PROTOC_ARCH: x86_64"
922+
```
923+
924+
**3. Permission Issues**
925+
926+
```bash
927+
# If installation to /usr/local/bin fails
928+
sudo make dev-env-setup AUTO_MODE=true
929+
930+
# Or install to user directory (requires PATH modification)
931+
mkdir -p ~/bin
932+
export PATH="$HOME/bin:$PATH"
933+
# Modify script to use ~/bin instead of /usr/local/bin
934+
```
935+
936+
**4. Network/Proxy Issues**
937+
938+
```bash
939+
# Test connectivity to GitHub
940+
curl -I https://github.com
941+
942+
# If behind proxy, configure:
943+
export HTTP_PROXY="http://proxy.example.com:8080"
944+
export HTTPS_PROXY="http://proxy.example.com:8080"
945+
export NO_PROXY="localhost,127.0.0.1"
946+
947+
# Then retry
948+
DEBUG=true make dev-env-setup AUTO_MODE=true
949+
```
950+
951+
**5. Version Validation**
952+
953+
```bash
954+
# Check what versions are configured
955+
cat .versions.yaml
956+
957+
# Verify specific tool version exists
958+
TOOL_VERSION=$(yq eval '.SHELLCHECK_VERSION' .versions.yaml)
959+
echo "Checking shellcheck version: $TOOL_VERSION"
960+
curl -I "https://github.com/koalaman/shellcheck/releases/tag/$TOOL_VERSION"
961+
962+
# Update version if needed
963+
yq eval '.SHELLCHECK_VERSION = "v0.11.0"' -i .versions.yaml
964+
```
965+
966+
#### Testing URL Construction
967+
968+
To test URL construction without running the full setup:
969+
970+
```bash
971+
# Source the script functions
972+
source scripts/setup-dev-env.sh
973+
974+
# Test specific tool URLs
975+
echo "yq URL: $YQ_URL"
976+
echo "kubectl URL: $KUBECTL_URL"
977+
echo "protoc URL: $PROTOC_URL"
978+
echo "shellcheck URL: $SHELLCHECK_URL"
979+
980+
# Test URL accessibility
981+
curl -I "$SHELLCHECK_URL"
982+
```
983+
984+
#### Manual Verification Steps
985+
986+
1. **Verify tool exists in releases**:
987+
```bash
988+
# Check GitHub releases page
989+
open "https://github.com/koalaman/shellcheck/releases"
990+
991+
# Or use API
992+
curl -s "https://api.github.com/repos/koalaman/shellcheck/releases/latest" | grep browser_download_url
993+
```
994+
995+
2. **Test download manually**:
996+
```bash
997+
# Download specific asset
998+
wget "https://github.com/koalaman/shellcheck/releases/download/v0.11.0/shellcheck-v0.11.0.linux.x86_64.tar.xz"
999+
1000+
# Verify archive integrity
1001+
tar -tzf shellcheck-v0.11.0.linux.x86_64.tar.xz
1002+
```
1003+
1004+
3. **Validate script syntax**:
1005+
```bash
1006+
# Check for syntax errors
1007+
bash -n scripts/setup-dev-env.sh
1008+
1009+
# Run shellcheck on the script itself
1010+
shellcheck scripts/setup-dev-env.sh
1011+
```
1012+
1013+
#### Reporting Setup Issues
1014+
1015+
When reporting setup script issues, include:
1016+
1017+
1. **Debug output**:
1018+
```bash
1019+
DEBUG=true make dev-env-setup AUTO_MODE=true 2>&1 | tee setup-debug.log
1020+
```
1021+
1022+
2. **Environment details**:
1023+
```bash
1024+
echo "OS: $(uname -s)"
1025+
echo "Architecture: $(uname -m)"
1026+
echo "Shell: $SHELL"
1027+
echo "Bash version: $BASH_VERSION"
1028+
```
1029+
1030+
3. **Version file content**:
1031+
```bash
1032+
cat .versions.yaml
1033+
```
1034+
1035+
4. **Failed URL** (from debug output):
1036+
```
1037+
Look for lines like:
1038+
❌ ERROR: Failed to verify URL: https://...
1039+
HTTP Status: 404 Not Found
1040+
```
1041+
1042+
This information helps diagnose whether the issue is:
1043+
- Version-specific (tool version doesn't exist)
1044+
- Architecture-specific (wrong filename for platform)
1045+
- Network-related (connectivity or proxy issues)
1046+
- Script bug (incorrect URL construction logic)
1047+
8541048
## 🔧 Makefile Reference
8551049
8561050
### Makefile Structure Overview

0 commit comments

Comments
 (0)