cancel
Showing results for 
Search instead for 
Did you mean: 

Developing with SAP Extension Suite - CI/CD Pipeline build failure

NitinMahajan
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi, 

I followed the steps in the tutorial to do an automated build via CI/CD service. I tried to run the job via CI/CD cockpit to test, but it fails. 

Log:

 

[2022-11-24T11:42:28.515Z] error mtaBuild - npm ERR! Cannot read property '@sap-cloud-sdk/http-client' of undefined
[2022-11-24T11:42:28.551Z] info  mtaBuild - 
[2022-11-24T11:42:28.586Z] error mtaBuild - npm ERR! A complete log of this run can be found in:
[2022-11-24T11:42:28.622Z] error mtaBuild - npm ERR!     /home/mta/.npm/_logs/2022-11-24T11_42_24_763Z-debug.log
[2022-11-24T11:42:28.659Z] error mtaBuild - [2022-11-24 11:42:24] ERROR could not build the "risk-management-srv" module: could not execute the "npm clean-install --production" command: exit status 1
[2022-11-24T11:42:28.695Z] info  mtaBuild - make: *** [Makefile_20221124114138.mta:37: risk-management-srv] Error 1
[2022-11-24T11:42:28.731Z] info  mtaBuild - Error: could not build the MTA project: could not execute the "make -f Makefile_20221124114138.mta p=CF mtar=risk-management.mtar strict=true mode= t=\"/home/jenkins/agent/workspace/riskmanagement-job\"" command: exit status 2
[2022-11-24T11:42:28.767Z] info  mtaBuild - fatal error: errorDetails{"category":"build","correlationId":"n/a","error":"running command 'mbt' failed: cmd.Run() failed: exit status 1","library":"SAP/jenkins-library","message":"failed to execute mta build","result":"failure","stepName":"mtaBuild","time":"2022-11-24T11:42:24.780906692Z"}
[2022-11-24T11:42:28.802Z] fatal mtaBuild - failed to execute mta build - running command 'mbt' failed: cmd.Run() failed: exit status 1
[2022-11-24T11:42:28.838Z] info  mtaBuild - persisting reports to GCS is disabled, because gcsBucketId is empty
[2022-11-24T11:42:28.874Z] info  mtaBuild - Step telemetry data:{"StepStartTime":"2022-11-24 11:41:38.752086498 +0000 UTC","PipelineURLHash":"50f013532a9770a2c2cfdc38b7581dd01df69b70","BuildURLHash":"50f013532a9770a2c2cfdc38b7581dd01df69b70","StageName":"Build","StepName":"mtaBuild","ErrorCode":"1","StepDuration":"46029","ErrorCategory":"build","CorrelationID":"n/a","PiperCommitHash":"e2db94dc5e9debcc618bdf706f83941e4ced0f5e","ErrorDetail":{"category":"build","correlationId":"n/a","error":"running command 'mbt' failed: cmd.Run() failed: exit status 1","library":"SAP/jenkins-library","message":"failed to execute mta build","result":"failure","stepName":"mtaBuild","time":"2022-11-24T11:42:24.780906692Z"}}
[2022-11-24T11:42:42.664Z] ----------------------------------------------------------
[2022-11-24T11:42:42.753Z] --- An error occurred in the library step: dockerExecuteOnKubernetes
[2022-11-24T11:42:43.252Z] ----------------------------------------------------------
[2022-11-24T11:42:43.286Z] 
[2022-11-24T11:42:43.321Z] The following parameters were available to the step:
[2022-11-24T11:42:43.355Z] ***
[2022-11-24T11:42:43.402Z] *** to show step parameters, set verbose:true in general pipeline configuration
[2022-11-24T11:42:43.437Z] *** WARNING: this may reveal sensitive information. ***
[2022-11-24T11:42:43.471Z] ***
[2022-11-24T11:42:43.506Z] 
[2022-11-24T11:42:43.540Z] The error was:
[2022-11-24T11:42:43.575Z] ***
[2022-11-24T11:42:43.611Z] hudson.AbortException: [mtaBuild] Step execution failed (category: build). Error: running command 'mbt' failed: cmd.Run() failed: exit status 1
[2022-11-24T11:42:43.647Z] ***
[2022-11-24T11:42:43.682Z] 
[2022-11-24T11:42:43.719Z] Further information:
[2022-11-24T11:42:43.754Z] * Documentation of library step dockerExecuteOnKubernetes: https://sap.github.io/jenkins-library/steps/dockerExecuteOnKubernetes/
[2022-11-24T11:42:43.790Z] * Source code of library step dockerExecuteOnKubernetes: https://github.com/SAP/jenkins-library/blob/master/vars/dockerExecuteOnKubernetes.groovy
[2022-11-24T11:42:43.826Z] * Library documentation: https://sap.github.io/jenkins-library/
[2022-11-24T11:42:43.861Z] * Library repository: https://github.com/SAP/jenkins-library/
[2022-11-24T11:42:43.896Z] 
[2022-11-24T11:42:43.931Z] ----------------------------------------------------------

The build works  fine when doing it manually on the BAS 

Can someone help here ?

Regards

markushaug
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hi, is the first log the entire one? Seems like it's just a small part of it. Could you please share the entire one? And if possible, also a git-repo for your code. Thanks.
Sabarim_07
Explorer

Dear Nitin,

As the error says, 

Cannot read property '@sap-cloud-sdk/http-client' of undefined

I have added the below list of commands in the mta.yaml to make the build success.

commands:
 - npm install
 - npx -p @Former Member/cds-dk cds build --production
 - npm install @Former Member-cloud-sdk/http-client
 - npm update --package-lock-only
 - npm clean-install --production

Regards,
Sabari Nathan

Accepted Solutions (1)

Accepted Solutions (1)

NitinMahajan
Product and Topic Expert
Product and Topic Expert

Many thanks, this works. 

Margit_Wagner
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi @NitinMahajan,

Thank you for sharing this with us. We are glad to hear that this is solve. 
I would like to ask you to use function “Answer” button to complete this question.
Please always feel free to post question related to our SAP BTP learning journeys in our  SAP BTP Learning.
We are here to support you.

Kind regards,
Margit

 

Answers (2)

Answers (2)

NitinMahajan
Product and Topic Expert
Product and Topic Expert

This issues is resolved. Many thanks !

Carme_AG
Discoverer
0 Kudos
How did you solve this issue? Thanks!
markushaug
Product and Topic Expert
Product and Topic Expert
0 Kudos

Thanks for your help @Former Member!

 

You could also install them directly, so that they are part of your package.json. In your case, they are then only part of the build. But in this case, this is also fine.