Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

jq: error: null (null) has no keys for any template without a parameters object

Aperta Adatta ai principianti
#956 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
1/5
Tempo stimato
Meno di un'ora
Idoneità per principianti
90/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
powershell
Ambito
ci-cd

Direzione di ricerca

Inizia in src/functions/Invoke-AzOpsPush.ps1 intorno alla riga 396 e analizza l’istruzione jq applicata a .parameters. Riproducila con un modello ARM o Bicep senza parametri, quindi verifica che validation o push non registri più l’errore null-keys continuando comunque a gestire i modelli con parametri.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Describe the bug

Given a parameterless resource template, when attempting to push or validate the template using the AzOps pipelines, the jq statement throws an error statement in the pipeline log.
jq: error (at <stdin>:76): null (null) has no keys

This is not super critical, as the Powershell ConvertFrom-Json -AsHashtable seems to handle the error case just fine, however the error log could be interpreted as an actual fault.

Scripts in question:

Steps to reproduce

  1. A parameterless main.bicep:
var location = 'westeurope'

resource example 'Microsoft.Storage/storageAccounts@2023-05-01' = {
  name: 'st${uniqueString(resourceGroup().id)}'
  location: location
  sku: {
    name: 'Standard_LRS'
  }
  kind: 'StorageV2'
}
  1. Build it and show Bicep omits parameters entirely rather than emitting {}:
$ bicep build main.bicep --outfile main.json
$ jq 'has("parameters")' main.json
false
$ jq '.parameters | with_entries(select(.value.defaultValue == null))' main.json
jq: error: null (null) has no keys

Note:
The is not a bicep specific error, and is even reproducible with the following bare-bones ARM template:

{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "resources": []
}

Proposed Solution:

Add a safeguard to the jq statement, which defaults to an empty object in case .parameters does not exist:

Old: .parameters | with_entries(select(.value.defaultValue == null))
New: .parameters // {} | with_entries(select(.value.defaultValue == null))

Lingua principale
PowerShell
Stelle
420
Fork
174
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Azure/AzOps

Tutte le issue di Azure/AzOps

Issue simili

Altre issue su DevOps

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.