To summerize the issue, I have git repository for example called Repo_A.
Repo_A contains:
Repo_A:
---> release-pipeline.gdsl
---> src/
---> pom.xml
release-pipeline.gdsl content:
node(params.node) {
stage('Build Source Code') {
sh 'pwd'
sh 'ls -l'
sh 'mvn clean compile package'
}
}
The output of the stage is the following (Jenkins project name Repo_A_CI_Project):
Started by user MyUser
Obtained release-pipeline.gdsl from git [email protected]:Repo_A.git
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] node
Running on myServer in /home/MyHome/jenkins_agent/workspace/Repo_A_CI_Project
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Build Source Code)
[Pipeline] sh
+ pwd
/home/MyHome/jenkins_agent/workspace/Repo_A_CI_Project
[Pipeline] sh
+ ls -l
total 0
[Pipeline] sh
+ mvn clean compile package
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.735 s
[INFO] Finished at: 2019-10-20T09:26:34+00:00
[INFO] Final Memory: 25M/1963M
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (/home/MyHome/jenkins_agent/workspace/Repo_A_CI_Project). Please verify you invoked Maven from the correct directory. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
[BFA] Scanning build for known causes...
[BFA] No failure causes found
[BFA] Done. 0s
ERROR: script returned exit code 1
Finished: FAILURE
The problem here is that Jenkins Pipeline doens't clone the whole Repo_A repository contents. It's only obtain the gdsl file release-pipeline.gdsl
.
The job is pipeline type, I already set the right config for this project and what is the git repo should pull it.
Previously it was working without issue and pull the whole repo and consider the execution place on the root of the repo to start execute stage's commands.
As you can see from the log, I used ls -l
to view the content and it show 0 content.
[Pipeline] sh
+ ls -l
total 0
[Pipeline]
I expect to see like that
[Pipeline] sh
+ ls
release-pipeline.gdsl src/ pom.xml
[Pipeline]
in Jenkins log, the only thing that I see is this simple message.
org.jenkinsci.plugins.githubautostatus.GithubNotificationConfig log
INFO: Could not find commit sha - status will not be provided for this build
I'm using this approach since it's simple to pull the Jenkins build file (release-pipeline.gdsl
) as well as the other content of repo to build directly without extra steps.
Appreciate your help.