Exception while executing SCM command.: Error while executing command. Error while executing process. Cannot run program "git" (in directory "/app/dspace-api"): error=2, No such file or directory

155 views
Skip to first unread message

Manish Kumar

unread,
Dec 15, 2023, 7:35:23 AM12/15/23
to DSpace Community
Hi all,

I am facing below error when build and deploy my application through docker with Jenkins pipeline. It was working earlier, we didn't changed any thing, just redeployed our code and started throwing this issue, it's happening for all env's (Dev, QA, Stg and Prod).

I need your quick help, will be highly appreciated.

 --------
Downloaded from central: https://repo.maven.apache.org/maven2/org/tmatesoft/svnkit/svnkit/1.8.5/svnkit-1.8.5.jar (3.8 MB at 10 MB/s)
#16 32.84 [INFO] Executing: /bin/sh -c cd '/app/dspace-api' && 'git' 'rev-parse' '--verify' 'HEAD'
#16 32.84 [INFO] Working directory: /app/dspace-api
#16 32.86 [INFO] ------------------------------------------------------------------------
#16 32.86 [INFO] Reactor Summary for DSpace Parent Project 7.2.1:
#16 32.86 [INFO]
#16 32.86 [INFO] DSpace Parent Project .............................. SUCCESS [  2.653 s]
#16 32.86 [INFO] DSpace Services Framework :: API and Implementation  SUCCESS [ 13.534 s]
#16 32.86 [INFO] DSpace Kernel :: API and Implementation ............ FAILURE [ 14.958 s]
#16 32.86 [INFO] DSpace Addon Modules ............................... SKIPPED
#16 32.86 [INFO] DSpace Kernel :: Additions and Local Customizations  SKIPPED
#16 32.86 [INFO] DSpace IIIF ........................................ SKIPPED
#16 32.86 [INFO] DSpace OAI-PMH ..................................... SKIPPED
#16 32.86 [INFO] DSpace RDF ......................................... SKIPPED
#16 32.86 [INFO] DSpace SWORD ....................................... SKIPPED
#16 32.86 [INFO] DSpace SWORD v2 .................................... SKIPPED
#16 32.86 [INFO] DSpace Server Webapp ............................... SKIPPED
#16 32.86 [INFO] DSpace Server Webapp:: Local Customizations ........ SKIPPED
#16 32.86 [INFO] DSpace Assembly and Configuration .................. SKIPPED
#16 32.86 [INFO] ------------------------------------------------------------------------
#16 32.86 [INFO] BUILD FAILURE
#16 32.86 [INFO] ------------------------------------------------------------------------
#16 32.86 [INFO] Total time:  31.490 s
#16 32.86 [INFO] Finished at: 2023-12-15T11:52:32Z
#16 32.86 [INFO] ------------------------------------------------------------------------
#16 32.86 [ERROR] Failed to execute goal org.codehaus.mojo:buildnumber-maven-plugin:1.4:create (***) on project dspace-api: Cannot get the revision information from the scm repository :
#16 32.86 [ERROR] Exception while executing SCM command.: Error while executing command. Error while executing process. Cannot run program "git" (in directory "/app/dspace-api"): error=2, No such file or directory

#16 32.86 [ERROR] -> [Help 1]
#16 32.86 [ERROR]
#16 32.86 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
#16 32.86 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
#16 32.86 [ERROR]
#16 32.86 [ERROR] For more information about the errors and possible solutions, please read the following articles:
#16 32.86 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
#16 32.86 [ERROR]
#16 32.86 [ERROR] After correcting the problems, you can resume the build with the command
#16 32.86 [ERROR]   mvn <args> -rf :dspace-api
#16 ERROR: process "/bin/sh -c mvn clean package -Denforcer.fail=false &&   mv /app/dspace/target/$***TARGET_DIR***/* /install &&   mvn clean" did not complete successfully: exit code: 1

------
 > [build 5/5] RUN mvn clean package -Denforcer.fail=false &&   mv /app/dspace/target/dspace-installer/* /install &&   mvn clean:
Error: ERROR] -> [Help 1]
Error: ERROR]
Error: ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
Error: ERROR] Re-run Maven using the -X switch to enable full debug logging.
Error: ERROR]
Error: ERROR] For more information about the errors and possible solutions, please read the following articles:
Error: ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Error: ERROR]
Error: ERROR] After correcting the problems, you can resume the build with the command
Error: ERROR]   mvn <args> -rf :dspace-api
------
Dockerfile:23
--------------------
  22 |     # Copy the dspace-installer directory to /install.  Clean up the build to keep the docker image small
  23 | >>> RUN mvn clean package -Denforcer.fail=false && \
  24 | >>>   mv /app/dspace/target/$***TARGET_DIR***/* /install && \
  25 | >>>   mvn clean
  26 |    
--------------------
ERROR: failed to solve: process "/bin/sh -c mvn clean package -Denforcer.fail=false &&   mv /app/dspace/target/$***TARGET_DIR***/* /install &&   mvn clean" did not complete successfully: exit code: 1
Error: Process completed with exit code 1.

Majo

unread,
Dec 15, 2023, 7:45:17 AM12/15/23
to DSpace Community
Hi.

This happened to us too. In our case, issue was that we used DSpace/dspace-dependencies image.
There are several possibilities for you. You can include git in your build Dockerfile,
use your own (old) dspace-dependencies image or synchronize code with upstream (possibly maven build file = pom.xml)

I also advise you to check if git is present while building, before proceeding. It might be
some other issue, but to me it looks exactly like I described above.

Best regards,
Majo



--
All messages to this mailing list should adhere to the Code of Conduct: https://www.lyrasis.org/about/Pages/Code-of-Conduct.aspx
---
You received this message because you are subscribed to the Google Groups "DSpace Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dspace-communi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dspace-community/7eb18486-8fe2-4851-9153-3279356e80afn%40googlegroups.com.

Manish Kumar

unread,
Dec 16, 2023, 6:44:53 AM12/16/23
to DSpace Community
Thanks for your reply,

Below is my docker command to use dspace/dspace-dependencies.

# This image will be published as dspace/dspace
# See https://github.com/DSpace/DSpace/tree/main/dspace/src/main/docker for usage details
#
# - note: default tag for branch: dspace/dspace: dspace/dspace:dspace-7_x

# This Dockerfile uses JDK11 by default, but has also been tested with JDK17.
# To build with JDK17, use "--build-arg JDK_VERSION=17"
ARG JDK_VERSION=11

# Step 1 - Run Maven Build
#FROM dspace/dspace-dependencies:dspace-7_x as build
FROM dspace/dspace-dependencies:dspace-7.2.1 as build
ARG TARGET_DIR=dspace-installer
WORKDIR /app
# The dspace-installer directory will be written to /install
RUN mkdir /install \
    && chown -Rv dspace: /install \
    && chown -Rv dspace: /app

Instead of 7_x, should we use 7.2.1?, as we are using same version of UI. Just curious to know the impact on system(I mean data loss, security concerns) if I use hardcoded 7.2.1. Best thing is due to 7.2.1 pipeline passed without any errors.

Majo

unread,
Dec 20, 2023, 2:30:33 AM12/20/23
to DSpace Community
Hello there.

I am sorry I was not able to get to you sooner.
I am in no position to make a strong recommendations,
but using old image certainly does not look like a good idea.

You need to add git to the build process, so that it is available
to maven. 
One of the simple fixes would be to add "apt update && apt install git -y"
right before calling maven. Another, perhaps better one, to use your own
dspace-dependencies (now you are using dspace/dspace-dependencies...),
something like "your-institution/dspace-dependencies:dspace-x.y.z".
That is, if you have your own docker images built. 
Since I don't know details about your environment, I can't recommend
bes solution (and if I knew the details, I would not dare recommend),
but as per your very good question about security concerns,
it does not seem to be a good idea to use old version.

I hope I helped at least a bit. But I understand that if you are
not familiar (to some extent) with the build process, it will be
hard if not impossible to use these information and implement them.

Best regards,
Majo


Manish Kumar

unread,
Jan 11, 2024, 5:05:59 AM1/11/24
to DSpace Community
Thanks, it worked for me, I added docker command for git install and it started working.
Reply all
Reply to author
Forward
0 new messages