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

Aberta Para iniciantes
#1,715 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
1/5
Tempo estimado
Menos de uma hora
Facilidade para iniciantes
88/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
bash, github-actions, java
Domínio
build-system, ci-cd

Direção de pesquisa

Comece por gha_build.sh e inspecione a função archetype, especialmente a etapa mvn -q clean install e a chamada posterior a mvn archetype:generate. Verifique como as etapas vizinhas lidam com falhas de comandos. O trabalho estará concluído quando uma falha na instalação de archetype fizer o script ser encerrado em vez de gerar o projeto a partir de um archetype em cache; execute o script com uma instalação que falhe para confirmar.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
Java
Estrelas
1.6k
Forks
575
Merge médio
1d 15h
PRs com merge (30d)
12

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de aws/serverless-java-container

Todas as issues de aws/serverless-java-container

Issues semelhantes

Mais issues de Java

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.