Azure / Azure/static-web-apps-cli

CLI doesn't produce a failure related exit code in case of failure

Aperta
#783 6 commenti 8 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
TypeScript
Stelle
668
Fork
156
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

**Describe the bug**
A clear and concise description of what the bug is.

Any error coming from running the CLI doesn't have an exit code that represents a failure. When I run the CLI directly (not by using the github actions action), I don't get an error from it. One example:

```
Run ./node_modules/.bin/swa deploy --no-use-keychain --config-name dev --env pr124

Welcome to Azure Static Web Apps CLI (1.1.4)

Using configuration "dev" from file:
/home/runner/work/repo/repo/swa-cli.config.json

Deploying front-end files from folder:
/home/runner/work/repo/repo/dist

Consider providing api-language and version using --api-language and --api-version flags,
otherwise default values apiLanguage: node and apiVersion: 16 will apply
Checking Azure session...
✔ Successfully logged into Azure!
✔ Saved project credentials in .env file.

Checking project "project" settings...
✔ Successfully setup project!

Deploying to environment: pr124

Found configuration file:
/home/runner/work/repo/repo/staticwebapp.config.json

Deploying project to Azure Static Web Apps...
Could not find StaticSitesClient local binary
- Downloading https://swalocaldeploy.azureedge.net/downloads/1.0.024941/linux/StaticSitesClient@1.0.024941
[swa] ✔ Downloading https://swalocaldeploy.azureedge.net/downloads/1.0.024941/linux/StaticSitesClient@1.0.024941
- Preparing deployment. Please wait...
✖ The content server has rejected the request with: BadRequest
✖ Reason: This Static Web App already has the maximum number of staging environments (3). Please remove one and try again.
```

**To Reproduce**
Steps to reproduce the behavior:

1. Use the SWA CLI manually in github actions
2. Run a command that will fail
3. The workflow will not fail

**Expected behavior**

I expected the CLI to exit with a code that represents a failure, so the workflow would fail.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia dal punto di ingresso ./node_modules/.bin/swa deploy e riproduci il malfunzionamento con il comando di deploy mostrato, utilizzando la configurazione swa-cli.config.json e staticwebapp.config.json del report. Traccia come l’errore di deployment segnalato viene restituito al processo CLI; il lavoro è completato quando un deployment non riuscito produce un codice di uscita diverso da zero e causa il fallimento del workflow.

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

Valutazione

Stack tecnologico
typescript
Ambito
cli
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
42/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.