Skip to content

Commit c1dde7e

Browse files
committed
fix: simplify YAML linting to avoid installation issues
- Remove automatic yamllint installation which was causing problems - Check for yamllint availability via python3 -m yamllint or PATH - Skip YAML linting tests gracefully if yamllint is not available - Provide helpful message on how to install yamllint manually - Makes the script more reliable and less prone to installation failures
1 parent 233bd40 commit c1dde7e

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

test-local.sh

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -221,25 +221,19 @@ if [ "$TEST_YAML" = true ]; then
221221
print_status "Testing YAML formatting..."
222222

223223
# Check if yamllint is available
224-
if ! command_exists yamllint; then
225-
print_warning "yamllint not found, installing..."
226-
if command_exists pip3; then
227-
pip3 install --user yamllint
228-
# Add user bin to PATH if not already there
229-
export PATH="$HOME/.local/bin:$PATH"
230-
elif command_exists pip; then
231-
pip install --user yamllint
232-
# Add user bin to PATH if not already there
233-
export PATH="$HOME/.local/bin:$PATH"
234-
else
235-
print_error "pip not found, cannot install yamllint"
236-
exit 1
237-
fi
224+
YAMLLINT_CMD=""
225+
if python3 -c "import yamllint" 2>/dev/null; then
226+
YAMLLINT_CMD="python3 -m yamllint"
227+
print_status "yamllint found via python3 -m yamllint"
228+
elif command_exists yamllint; then
229+
YAMLLINT_CMD="yamllint"
230+
print_status "yamllint found in PATH"
231+
else
232+
print_warning "yamllint not available, skipping YAML linting tests"
233+
print_info "To enable YAML linting, install yamllint: pip3 install yamllint"
234+
return 0
238235
fi
239236

240-
# Use python3 -m yamllint which is more reliable
241-
YAMLLINT_CMD="python3 -m yamllint"
242-
243237
# Test all YAML files in k8s directory
244238
if [ -d "k8s" ]; then
245239
print_status "Linting Kubernetes manifests..."

0 commit comments

Comments
 (0)