extract fails when a policy uses set-backend-service backend-id="{{namedValue}}"
Los mantenedores suelen responder en 3 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 78/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- azure, typescript
Línea de trabajo
Empieza por src/services/transitive-resolver.ts, donde el issue señala BACKEND_PATTERN y scanPolicyReferences; sigue cómo se registra el ID del backend capturado como dependencia transitiva. Revisa las pruebas relevantes del transitive resolver y añade cobertura para un marcador de posición con valor con nombre en backend-id. El trabajo está hecho cuando la extracción omite ese marcador de posición como nombre literal de Backend y la prueba confirma que no se produce ningún error falso de backend ausente.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Command that triggered the bug
apiops extract
Expected behavior
A policy that references a backend through a named value is valid in APIM:
<set-backend-service backend-id="{{demo-backend-id}}" />
extract should not treat the placeholder {{demo-backend-id}} as the name of a Backend resource. Extraction should finish with 0 errors and exit code 0 when every real resource exists.
Actual behavior
BACKEND_PATTERN in src/services/transitive-resolver.ts is:
const BACKEND_PATTERN = /<set-backend-service\s+backend-id="([^"]+)"/g;
It captures the raw attribute value including braces, so {{demo-backend-id}} is registered as a transitive dependency of type Backend with the literal name {{demo-backend-id}}. APIM has no such backend, so the GET 404s, the error counter is incremented, and the run exits 1:
[INFO] Resolving transitive dependencies for workspace "[ws name]"...
[INFO] Found 1 transitive dependencies to extract
[WARN] Transitive dependency backends/{{demo-backend-id}} was not found
[INFO] Workspace "[ws name]": extracted 32 resources, 1 errors
[INFO] Extraction complete: 33 resources extracted, 1 errors
Total: 33 resources extracted, 1 errors in 19.8s
##[error]Script failed with exit code: 1
The false error fails the pipeline step. The extracted files are written locally, but the pipeline stops before the "publish artifacts" task, so nothing is committed or published and no PR branch is created.
Since 1.0.5 (#319) the 404 is logged as a warning. Before that, the same case produced no log line at all, only the error count. The exit code 1 is unchanged.
Using the literal Backend name (backend-id="backend-xyz") instead of the named-value placeholder avoids the error. That workaround conflicts with our planned move to Backend entities referenced via named values, so this blocks our extract pipeline.
Observed in a workspace-scoped extract, but the code path is not workspace-specific: BACKEND_PATTERN/scanPolicyReferences and extractTransitiveDependencies are shared with the service-level extract in extract-service.ts, so I expect the same behavior at instance level (not tested).
Minimal repro:
- Create a Backend
backend-xyzand a Named Valuedemo-backend-idwith valuebackend-xyz. - Add
<set-backend-service backend-id="{{demo-backend-id}}" />to an API policy in the extracted scope. - Run
apiops extractwith transitive resolution on (default). - Observe the false error and exit 1.
Likely the same problem for (from reading the regex, not tested):
backend-id="@(...)"policy expressions (also not a literal Backend name).- Commented-out
<set-backend-service>elements — see #305.
Related: #276 / PR #290 (same bug class for Liquid {{ }} in NAMED_VALUE_PATTERN; leaves BACKEND_PATTERN untouched), #291 / PR #319 (named-value displayName 404s; added the "not found" warning)
apiops CLI version
1.0.5
Environment details
- Azure DevOps pipeline, Microsoft-hosted agent
- CLI installed from the v1.0.5 release tarball (
@azure-tools/apiops-cli), run vianpx apiops
CI/CD environment
Azure DevOps
Is this bug blocking you?
Yes
- Lenguaje dominante
- TypeScript
- Estrellas
- 34
- Forks
- 13
- Merge medio
- 3 d 6 h
- PR fusionados (30 d)
- 7
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Azure/apiops-cli
-
stale type:question
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Azure/apiops-cli#277 · 1 comentario ·
Los mantenedores suelen responder en 3 días
-
stale type:documentation
Dificultad 1/5 Menos de una hora Aptitud para principiantes 94/100
Azure/apiops-cli#250 · 1 comentario ·
Los mantenedores suelen responder en 3 días
-
Documentation P2 stale
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Azure/apiops-cli#24 · 2 comentarios ·
Los mantenedores suelen responder en 3 días
-
type:bug
Dificultad 3/5 1-2 días Aptitud para principiantes 53/100
Azure/apiops-cli#330 ·
Los mantenedores suelen responder en 3 días
-
type:bug
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
Azure/apiops-cli#328 ·
Los mantenedores suelen responder en 3 días
Todos los issues de Azure/apiops-cli
Issues similares
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
ajv-validator/ajv#2689 ·
-
[Bug]: IME confirmation Enter can submit the SSH port-forward dialogPosiblemente ocupada @seijikohara la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
home-assistant/frontend#55323 ·
Los mantenedores suelen responder en 1 día
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
lingdojo/kana-dojo#33188 · 1 comentario · 5 reacciones ·
Los mantenedores suelen responder en 1 día
-
self-driving
Dificultad 1/5 1-3 horas Aptitud para principiantes 86/100
Los mantenedores suelen responder en 1 día