Skip to content

Commit 233bd40

Browse files
committed
fix: use python3 -m yamllint for more reliable YAML linting
- Replace binary yamllint lookup with python3 -m yamllint - This avoids PATH issues when yamllint is installed via pip - More reliable across different Python environments - Maintains the same functionality but with better compatibility
1 parent 1746b62 commit 233bd40

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

test-local.sh

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,19 +224,26 @@ if [ "$TEST_YAML" = true ]; then
224224
if ! command_exists yamllint; then
225225
print_warning "yamllint not found, installing..."
226226
if command_exists pip3; then
227-
pip3 install yamllint
227+
pip3 install --user yamllint
228+
# Add user bin to PATH if not already there
229+
export PATH="$HOME/.local/bin:$PATH"
228230
elif command_exists pip; then
229-
pip install yamllint
231+
pip install --user yamllint
232+
# Add user bin to PATH if not already there
233+
export PATH="$HOME/.local/bin:$PATH"
230234
else
231235
print_error "pip not found, cannot install yamllint"
232236
exit 1
233237
fi
234238
fi
235239

240+
# Use python3 -m yamllint which is more reliable
241+
YAMLLINT_CMD="python3 -m yamllint"
242+
236243
# Test all YAML files in k8s directory
237244
if [ -d "k8s" ]; then
238245
print_status "Linting Kubernetes manifests..."
239-
yamllint k8s/ || {
246+
"$YAMLLINT_CMD" k8s/ || {
240247
print_error "YAML linting failed"
241248
exit 1
242249
}
@@ -248,7 +255,7 @@ if [ "$TEST_YAML" = true ]; then
248255
# Test router configuration YAML
249256
if file_exists "router/router.yaml"; then
250257
print_status "Linting router configuration..."
251-
yamllint router/router.yaml || {
258+
"$YAMLLINT_CMD" router/router.yaml || {
252259
print_error "Router configuration YAML linting failed"
253260
exit 1
254261
}

0 commit comments

Comments
 (0)