Gitlab appengine:deploy missing JAR on Gitlab only - maven

I have setup a multi module spring boot application including Google appengine integration. Locally everything works fine.
If I do a clean checkout of my GIT repo and after that execute
mvn clean install
mvn appengine:deploy
The app gets properly deployed to Google appengine
If I try to do the same on gitlab using the following deploy pipeline
deploy-prod:
stage: deploy
image: $CI_REGISTRY_IMAGE/build
when: manual
environment: prod
script:
- 'mvn clean install'
- 'mvn appengine:deploy'
I get an error saying:
Failed to execute goal on project XXX: Could not resolve dependencies
for project YYY:XXX:war:0.0.1-SNAPSHOT: Could not find artifact
YYY:XXX:jar:0.0.1-SNAPSHOT
Do you have any idea what is wrong/different here? Never had such problems on Gitlab? And I have no idea what is different to the case when I do a clean checkout locally and execute the same commands there?
Thanks for your help.

I assume, you are checking it at your local machine. But have you checked it with $CI_REGISTRY_IMAGE/build manually? I think there is an issue with the docker image itself.

Related

GitLab: This job could not start because it could not retrieve the needed artifacts: Build

I am getting "This job could not start because it could not retrieve the needed artifacts: Build" error when trying to run integration test after deployment on GitLab.
There is not any details or log regarding to the error. So, how can I get the details or solve the problem? Before deploy I already run all the tests with mvn clean install. Any idea?

What yaml build command to put to run sonar cloud for github repo?

I have followed all the steps to setup to run my github repo for sonar cloud scan. I am not sure what to put under <your build command>.
When I leave it empty, I got an error when running the job at github action.
I have found the command already, dotnet build

Maven Dependency project on Google Cloud Build with SonarScanner

I will try to keep the description brief. We have a couple of projects. Some of them are full blown Spring Boot apps, some of them are Maven Dependency projects (used in those Spring Boot apps).
I have set up a Jenkins server for automating pipelines. Jenkins calls Google Cloud Build to build projects/docker images and cache dependencies. It also calls SonarQube in a step. This all works fine for the Spring Boot apps, but the SonarQube step fails for the dependency projects. The error is Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar (default-cli) on project projectname: Not inside a Git work tree: / -> [Help 1].
The Dockerfile for the project:
FROM maven:3.5-jdk-8-alpine
# Copy local code to the container image.
COPY pom.xml settings.xml ./
RUN mvn -s settings.xml dependency:go-offline
COPY src ./src
# Build a release artifact.
RUN mvn verify -DskipTests -s settings.xml
The cloudbuild.yaml:
substitutions:
_IMAGE_NAME: "projectname"
steps:
- name: "docker"
entrypoint: "sh"
args:
- "-c"
- |-
docker pull gcr.io/gcp-project/${_IMAGE_NAME}:$_TAG
docker pull gcr.io/gcp-project/${_IMAGE_NAME}:latest || true
- name: "docker"
args:
- "build"
- "-t"
- "gcr.io/gcp-project/${_IMAGE_NAME}"
- "-t"
- "gcr.io/gcp-project/${_IMAGE_NAME}:$_TAG"
- "--cache-from"
- "gcr.io/gcp-project/${_IMAGE_NAME}:latest"
- "--cache-from"
- "gcr.io/gcp-project/${_IMAGE_NAME}:$_TAG"
- "."
- name: "gcr.io/gcp-project/${_IMAGE_NAME}"
entrypoint: "bash"
args:
- "-ce"
- |-
mvn -f /pom.xml -s ./settings.xml sonar:sonar -Dsonar.host.url=https://sonar.server.com -Dsonar.login=${_SONAR_KEY}
- name: "gcr.io/gcp-project/${_IMAGE_NAME}"
args:
- "mvn"
- "deploy"
- "-s"
- "/settings.xml"
images: ["gcr.io/gcp-project/${_IMAGE_NAME}"]
There are two very confusing things. If i run the maven command locally, the analysis completes successfully. Also, if i run the local Google Cloud Build tool (cloud-build-local) it also passes.
I have verified that the .git folder is not uploaded. It is neither with the Spring Boot apps.
I copied the settings.xml from the Jenkins server locally and used that one. Neither the Spring Boot apps or the dependencies define a sonar-project.properties.
Is there anyone who can shed some light on this?
Thanks in advance!
EDIT
I created 2 repositories that are able to replicate this problem:
Non-working: https://github.com/claystation/mvnsonarapp
Working: https://github.com/claystation/mvnsonarappworking
I think the main difference is the dependency project not having #SpringBootApplication?
Ok, so i finally figured it out how to solve this, by doing the MCVE.. Unfortunately not WHY the problem exists.
The main difference between the projects was the #SpringBootApplication annotation. I thought this might have something to do with having the spring-boot-starter-parent parent defined.
I removed the parent part and now my project is passing in Sonar. If there is ever someone who can explain WHY Sonar gives this error with the parent defined but no #SpringBootApplication annotation, that would be very helpful.
Thanks!

jhipster v4.14.4 - building an executable WAR-file

As mentioned here as well as here it should be possible - and a must-have for the docker-container - to be able to build a WAR-file of the whole application with ./gradlew -Pprod bootWar or make the application ready for a deployment via docker-container with ./gradlew bootWar -Pprod buildDocker.
But Intellij IDEA tells me, that there is no task bootWar. And ./gradlew -Pprod bootRundoesn't generate a *.war-file in build/libs/.
I also tried publishing directly to heroku, triggered by pushes to my github-repository controlled by a local jenkins2 docker-container. Maybe even the 404-Site after successful builds at heroku comes from this. The manual way documented in the jhipster.tech-documentation with ./gradlew -Pprod bootWar -x test and heroku deploy:jar --jar build/libs/*war can't work without the *.war.
So how can I export my monolithic jhipster-application into a *.war-file?
AFAIK you can generate a war with gradle by typing the following command
./gradlew -P prod build and/or ./gradlew -P prod build bootRepackage

Maven JBoss jbpm-form-modeler deployment

I have ran mvn clean install and its has worked fine.
I can run mvn gwt:run and get the form modeler working with jetty.
When I take the WAR file from showcase and try to deploy it in jboss-as-7.1.1 or jboss-eap-6.2.0 it always fails deployment with following error:
11:52:37,365 ERROR [org.jboss.as.server] (HttpManagementService-threads - 10) JBAS015870: Deploy of deployment "jbpm-form-modeler-showcase-6.0.1.Final.war" was rolled back with the following failure message: {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.\"jbpm-form-modeler-showcase-6.0.1.Final\".\"jbpm-form-modeler-showcase-6.0.1.Final\".env.ErraiService is missing [jboss.naming.context.java.jboss.resources.ErraiService]"]}
Any help would be appreciated...
(PS. I got jbpm-console-ng deployed no problem if that make any difference...)
I think you need to use fullprofile option when you make build for this module:
mvn clean install -PfullProfile

Resources