gha_build.sh ignores failures of the archetype's own mvn install

Aperta Adatta ai principianti
#1,715 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
1/5
Tempo stimato
Meno di un'ora
Idoneità per principianti
88/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
bash, github-actions, java

Direzione di ricerca

Inizia da gha_build.sh ed esamina la funzione archetype, in particolare il passaggio mvn -q clean install e la successiva chiamata a mvn archetype:generate. Controlla come i passaggi vicini gestiscono gli errori dei comandi. Il lavoro è completato quando un’installazione non riuscita di archetype fa terminare lo script invece di generare il progetto da un’archetype nella cache; esegui lo script con un’installazione non riuscita per verificarlo.

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

Descrizione

In gha_build.sh, the archetype function runs mvn -q clean install in the archetype module but doesn't check its exit code. The next step, mvn archetype:generate -DarchetypeCatalog=local, then generates from whatever version of the archetype is in the local catalog.

So when the archetype's integration test fails:

  • On a clean machine, which is CI today since setup-java has no Maven cache, nothing is in the local catalog and generate fails with "The desired archetype does not exist". The job goes red, but the error points at the wrong step.
  • On a machine that has installed an older archetype before (any dev machine, or CI if Maven caching is turned on later), generate quietly uses the old archetype and the run passes. The new archetype is never tested.

Releases aren't affected: release.yml runs mvn release:prepare/perform over the full reactor, which runs the archetype integration tests and stops on failure.

This came up in #1714. The springboot4 archetype's integration test failed with NoClassDefFoundError for JsonApplyView, and a local gha_build.sh run still reported success because it generated from a cached 3.0.3-SNAPSHOT archetype.

Suggested fix: check the exit code after the archetype install, like the other steps do.

cd ${WORKING_DIR}/${ARCHETYPE_NAME} && mvn -q clean install
if [[ "$?" -ne 0 ]]; then
    exit 1
fi

Passing -DarchetypeVersion with the project version to archetype:generate would also stop it from falling back to an older archetype.

Lingua principale
Java
Stelle
1.6k
Fork
575
Merge medio
1g 15h
PR unite (30g)
12

Preparare l'ambiente

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 aws/serverless-java-container

Tutte le issue di aws/serverless-java-container

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.