Fix CI/CD: YAML syntax errors and missing netcat dependency
Some checks reported errors
continuous-integration/drone/push Build encountered an error

- Fixed YAML formatting issues in staging deployment section
- Added explicit netcat-openbsd installation before connectivity tests
- Escaped DRONE_BRANCH variable in SSH commands to prevent YAML parsing errors
- Fixed indentation and structure to ensure proper YAML validation
This commit is contained in:
2025-11-25 18:21:43 +09:00
parent b3b5b6260b
commit 42ed981d16

View File

@@ -211,6 +211,7 @@ steps:
- chmod 600 ~/.ssh/id_rsa - chmod 600 ~/.ssh/id_rsa
- ssh-keyscan -H $STAGING_HOST >> ~/.ssh/known_hosts 2>/dev/null || true - ssh-keyscan -H $STAGING_HOST >> ~/.ssh/known_hosts 2>/dev/null || true
- echo "Testing staging server connectivity..." - echo "Testing staging server connectivity..."
- apk add --no-cache netcat-openbsd
- | - |
if ! nc -z $STAGING_HOST 22 2>/dev/null; then if ! nc -z $STAGING_HOST 22 2>/dev/null; then
echo "❌ Cannot connect to staging server on port 22" echo "❌ Cannot connect to staging server on port 22"
@@ -222,7 +223,7 @@ steps:
ssh $STAGING_USER@$STAGING_HOST "cd /opt/smartsoltech-staging && ssh $STAGING_USER@$STAGING_HOST "cd /opt/smartsoltech-staging &&
echo 'Fetching latest changes...' && echo 'Fetching latest changes...' &&
git fetch origin && git fetch origin &&
git reset --hard origin/${DRONE_BRANCH} && git reset --hard origin/\${DRONE_BRANCH} &&
echo 'Restarting services...' && echo 'Restarting services...' &&
docker-compose down --timeout 30 && docker-compose down --timeout 30 &&
docker-compose pull && docker-compose pull &&
@@ -417,6 +418,7 @@ steps:
exit 1 exit 1
fi fi
- echo "Testing SSH connectivity to $PROD_HOST..." - echo "Testing SSH connectivity to $PROD_HOST..."
- apk add --no-cache netcat-openbsd
- | - |
if ! nc -z $PROD_HOST 22; then if ! nc -z $PROD_HOST 22; then
echo "❌ SSH port 22 is not accessible on $PROD_HOST" echo "❌ SSH port 22 is not accessible on $PROD_HOST"