bmoers / sn-cicd

CICD Server for Service-Now

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue When Building App - Install Node App fails

nci-snow-cicd opened this issue · comments

Install Node App steps fails as follow - Please advise.

[12:11:44.983] [LOG] [10336] Using SYS_* Field White-List 'sys_class_name, sys_created_by, sys_created_on, sys_id, sys_mod_count, sys_name, sys_package, sys_policy, sys_scope, sys_update_name, sys_updated_by, sys_updated_on'
[12:11:44.983] [LOG] [10336] Project Datastore: use remote
[12:11:44.985] [LOG] [10336] [/worker#ZbGaE-8YwQO-wT-JAAAA] build-project : install node application
[12:11:45.015] [LOG] [10336] install node app in C:\Users\user1\AppData\Local\Temp\3\git-root\459c6b10-47eb-4605-be75-f78bffe92478 [ 'ci', '--silent', '--no-audit', '--no-optional' ]
[12:11:55.729] [LOG] [10336] npm install process exited with code: 1
[12:11:55.730] [ERROR] [10336] [/worker#ZbGaE-8YwQO-wT-JAAAA] build-project : install node application failed:
Error
at C:\Users\user1\Documents\sncicd-server\node_modules\sn-cicd\lib\modules\build-project.js:41:76
at tryCatcher (C:\Users\user1\Documents\sncicd-server\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (C:\Users\user1\Documents\sncicd-server\node_modules\bluebird\js\release\promise.js:547:31)
at Promise._settlePromise (C:\Users\user1\Documents\sncicd-server\node_modules\bluebird\js\release\promise.js:604:18)
at Promise._settlePromise0 (C:\Users\user1\Documents\sncicd-server\node_modules\bluebird\js\release\promise.js:649:10)
at Promise._settlePromises (C:\Users\user1\Documents\sncicd-server\node_modules\bluebird\js\release\promise.js:725:18)
at _drainQueueStep (C:\Users\user1\Documents\sncicd-server\node_modules\bluebird\js\release\async.js:93:12)
at _drainQueue (C:\Users\user1\Documents\sncicd-server\node_modules\bluebird\js\release\async.js:86:9)
at Async._drainQueues (C:\Users\user1\Documents\sncicd-server\node_modules\bluebird\js\release\async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (C:\Users\user1\Documents\sncicd-server\node_modules\bluebird\js\release\async.js:15:14)
at processImmediate (internal/timers.js:456:21) Error
at C:\Users\user1\Documents\sncicd-server\node_modules\sn-cicd\lib\modules\build-project.js:41:76
at tryCatcher (C:\Users\user1\Documents\sncicd-server\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (C:\Users\user1\Documents\sncicd-server\node_modules\bluebird\js\release\promise.js:547:31)
at Promise._settlePromise (C:\Users\user1\Documents\sncicd-server\node_modules\bluebird\js\release\promise.js:604:18)
at Promise._settlePromise0 (C:\Users\user1\Documents\sncicd-server\node_modules\bluebird\js\release\promise.js:649:10)
at Promise._settlePromises (C:\Users\user1\Documents\sncicd-server\node_modules\bluebird\js\release\promise.js:725:18)
at _drainQueueStep (C:\Users\user1\Documents\sncicd-server\node_modules\bluebird\js\release\async.js:93:12)
at _drainQueue (C:\Users\user1\Documents\sncicd-server\node_modules\bluebird\js\release\async.js:86:9)
at Async._drainQueues (C:\Users\user1\Documents\sncicd-server\node_modules\bluebird\js\release\async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (C:\Users\user1\Documents\sncicd-server\node_modules\bluebird\js\release\async.js:15:14)
at processImmediate (internal/timers.js:456:21)
[12:11:55.737] [LOG] [10336] [/worker#ZbGaE-8YwQO-wT-JAAAA] build-project : cleaning up project
[12:11:55.740] [LOG] [10336] deleting C:\Users\user1\AppData\Local\Temp\3\git-root\459c6b10-47eb-4605-be75-f78bffe92478\node_modules
[12:11:57.512] [ERROR] [10336] [/worker#ZbGaE-8YwQO-wT-JAAAA] PROMISE JOB ERROR: Job 'buildProject' {
type: 'exe',
name: 'buildProject',
options: 'xUauor5G8AKEmCLY',
host: 'ncias-d2371-c',
id: '0895740f-60fe-41ee-990b-09621667cfb5',
emitter: { _events: {}, _eventsCount: 2 },
created: 1586880704932,
completed: null,
workerId: '/worker#ZbGaE-8YwQO-wT-JAAAA',
result: undefined,
error: undefined

Please navigate to C:\Users\user1\AppData\Local\Temp\3\git-root\459c6b10-47eb-4605-be75-f78bffe92478 and manually run npm ci
What kind of error does that throw?

Thank you for the reply; I actually was able to figure it out; had to downgrade the nodejs version from 12 to 10, deleted node_module and the package-lock.json; rebuilt the app - using npm install; then run; and the build completed successfully.

I am now running into a different issue where the Pull request is being raised; but no notification being recieved through slack even though I have it configured and enabled; I am not seeing the payload message being posted in the log screen and when I merge the pull request; nothing happens.

Can you please advise?

Would you mind to share your .env file and the logs. You can send it in anonymised form to my email.

sure attached are both - The weird part is I receive messages for failed builds - For example I tried changing the CICD_GIT_STRICT_MASTER=true, specified a default GIT_MASTER_SOURCE, kept the CICD_ATF_RUN_ON_PRODUCTION to false and got a failed build since ATF Run is disabled for Prod runs and the CICD process looks at the Default GIT Master source as being prod - I did get the slack notification for that; but for positive scenarios when every thing passes as shown in the log file; I am not seeing the Slack payload published in the log and not receiving the slack notification and of course can't pass this stage even if I manipulate the rest of the process from GitHub.

You don't get a PR slack message as there is none ;)

return self.raisePullRequest({

Best you configure the GIT host to send a Slack message on PR

Thank you, Issue resolved, closing the ticket.

Thank you, Issue resolved, closing the ticket.

@nci-snow-cicd do you think it would make sense to integrate with slack here or is it sufficient to let the PR side do that?

yes it would; however - what I noticed is when the pull request is being published under the Webhook for the GitHub Repo created as part of the CICD run; the Webhook URL always appends the .service-now.com to the URL; so in my case my instance name has no ".service-now.com" in the link; it is a DNS name as follow: https://service-instance-dev.xxx.xxx.com so when the pull request is raised; it is raised with a web hook URL in the git repo as follow: https://service-instance-dev.xxx.xxx.com.service-now.com/api/devops/cicd/pull_request rather than: https://service-instance-dev.xxx.xxx.com/api/devops/cicd/pull_request - This was causing me an issue - so when repo is being created; I have to manually go the repo setting; Webhooks, remove the .-service-now.com from the Webhook URL and move on - And then I can start seeing the Webhook interactions for Slack for all the remaining phases.

so the question here is if I have FQDN for my instance name that does not have ".service-now.com" in the host name; where do I change the code so the Github Webhook URL is generated without the ".service-now.com" - Please let me know.

The webhook is created here:
https://github.com/bmoers/sn-cicd-example/blob/292c1b595f10a4394001e670093ac99c402fcfa0/cicd.js#L72, you can change that to your domain.
But I think it would make sense to support custom domains as an option in the .env and use that instead on the whole server.
Are you using the "custom url" feature or have a self hosted env?

Thank you for considering both enhancements. To answer your question, we're using the custom URL feature and our instances are not self hosted on-prem.

Thanks
Seems not to be a big deal to implement #31 however it needs a change in the cicd-integration app https://github.com/bmoers/sn-cicd-integration/blob/81407229cc645228e718e7e69477e6c6ae19df6c/script_include/CiCdDeploy.js#L343

Would it be sufficient to compare the host across source and target (targetMatch[1] != targetMatch[2]) ?

Yes absolutely; If custom URL is used then there is no need to compare with the .service-now.com as long as the comparison is left at a generic level that should be sufficient. This can be driven by the env variable set in the .env file (whether it is cutsom URL or default .service-now.com)

Closing this as the custom domain feature is now official #31 and the example implementation updated bmoers/sn-cicd-example@1241af9
The messaging topic #32 I'll address when the MS Teams plugin is implemented.