bmoers / sn-cicd

CICD Server for Service-Now
GNU Lesser General Public License v3.0
44 stars 36 forks source link

Orlando Deployment - Deployment phase fails at preview with 'Could not find a record in sys_app_category for column category referenced in this update' #52

Closed nadimrizk83 closed 4 years ago

nadimrizk83 commented 4 years ago

Running into a deployment issue with 2 Orlando instances. The pipeline breaks at update set preview step on the instance. The error logged is as follow: 'Could not find a record in sys_app_category for column category referenced in this update'

Looked it up in the sys_app_category table and did not find a "category" column there on either sides (source or target); also checked the same tables on 2 previews versions (New York & Madrid) and tables are similar like the Orlando one.

I looked up the pull request in Git for the scoped app and looked at the exported XML and noticed the tag with a default value "customer" in there in many places; I was wondering if the process was complaining about it; even though the same process runs fine in New York & Madrid. Wondering what's breaking the process in Orlando.

Logs below:

[22:38:54.978] [LOG] [30032] Request: https://dev88759.service-now.com/api/devops/cicd/deploy_step?__step=previewUpdateSet&__status=304 [22:38:55.291] [LOG] [30032] Job in progress. Wait for 1000 ms ... [22:38:56.294] [LOG] [30032] Request: https://dev88759.service-now.com/api/devops/cicd/deploy_step?__step=previewUpdateSet&__status=304 [22:38:56.651] [LOG] [30032] Request: https://dev88759.service-now.com/api/devops/cicd/deploy_step?__step=commitUpdateSet&__status=303 [22:38:56.990] [ERROR] [30032] [/worker#hOdmxdADXHiF0GxlAAAC] deploy-update-set.deployUpdateSet : Commit requires manual interaction! - Update conflicts must be resolved manually. { name: 'Preview Review Problem', message: '- Update conflicts must be resolved manually. ', updateSet: 'https://dev88759.service-now.com/sys_remote_update_set.do?sys_id=941a68681b8b5010271ced3abc4bcb89', issues: true, previewProblems: [ { type: 'error', name: 'Could not find a record in sys_app_category for column category referenced in this update', link: 'https://dev88759.service-now.com/sys_update_preview_problem.do?sys_id=ba1aa8681b8b5010271ced3abc4bcb3e' } ], dataLossWarnings: [], payload: { version: null, sourceSysId: 'd9f4edf71b321010271ced3abc4bcb72', targetEnvironment: 'https://dev88759.service-now.com/', updateSetSysId: '54dca2c77a76f3d36b4d6dde84a86503', limitSet: [ '4VQVmZl3hVXr2A6B' ], sourceEnvironment: 'https://dev91367.service-now.com', deploy: true, collisionDetect: false, conflicts: { resolutions: {}, defaults: [Object] }, step: 'commitUpdateSet', progressId: null, state: 'previewed', remoteUpdateSetSysId: '941a68681b8b5010271ced3abc4bcb89', missingRecords: {} } } [22:38:58.482] [WARN] [30032] Email notification is disabled. Following message was not sent: "DevOps Integration" <>, DEPLOYMENT CONFLICTS - Update Set is causing conflicts: Deployment of 'my_demo_app - 1.0.0 › #1' requires manual interaction

Deployment Conflicts in Update Set 'my_demo_app - 1.0.0 › #1'

The 'preview' step during the update set deployment on target https://dev88759.service-now.com detected conflicts and requires them to be resolved manually.

            <p><b>Please open the <a href="https://dev88759.service-now.com/nav_to.do?uri=sys_remote_update_set.do%3Fsys_id%3Dnull%26sysparm_view%3Dcicd_problems">Target Update Set</a> and resolve all conflicts to proceed with this deployment.</b></p>
            <p>
                <table>
                    <tr>
                        <td>Source:</td>
                        <td>https://dev91367.service-now.com</td>
                    </tr>
                    <tr>
                        <td>Update Set:</td>
                        <td><a href="https://dev91367.service-now.com/nav_to.do?uri=sys_update_set.do%3Fsys_id%3D9c89a0ac1b4f901061ef31d7dc4bcbc0">my_demo_app - 1.0.0</a></td>
                    </tr>
                    <tr>
                        <td>Target:</td>
                        <td>https://dev88759.service-now.com</td>
                    </tr>
                    <tr>
                        <td>Update Set:</td>
                        <td><a href="https://dev88759.service-now.com/nav_to.do?uri=sys_remote_update_set.do%3Fsys_id%3Dnull%26sysparm_view%3Dcicd_problems">https://dev88759.service-now.com/nav_to.do?uri=sys_remote_update_set.do%3Fsys_id%3Dnull%26sysparm_view%3Dcicd_problems</a></td>
                    </tr>
                </table>
            </p>
            <h3>Update conflict:</h3><p><table border="1" cellspacing="0" cellpadding="4"><tr><th>Type</th><th>Description</th><th>Link</th></tr><tr><td>ERROR</td><td>Could not find a record in sys_app_category for column category referenced in this update</td><td><a href="https://dev88759.service-now.com/sys_update_preview_problem.do?sys_id=ba1aa8681b8b5010271ced3abc4bcb3e">open</a></td></tr></table></p>

[22:38:58.506] [LOG] [30032] Change Run State to 'failed (manual interaction required)' [22:38:58.561] [LOG] [25396] /worker#hOdmxdADXHiF0GxlAAAC is done (/worker/done) with job: acce5236-3d01-49c9-8c3e-42cfea859706 Type: exe

bmoers commented 4 years ago

Hi nadimrizk83

can you share the record causing the conflict? It should have a "category" filed with a value which is not in the "sys_app_category" table. (most likely a sys_app_application record, as its the only table referencing sys_app_category)

Thanks Boris

nadimrizk83 commented 4 years ago

Hello,

I am attaching the update set being deployed to the target host. I honestly not able to locate that record; when I go to the target and review the conflicts, I try looking for the missing record and the missing update and both are returning pretty much blank. I am attaching screen shots for reference. update_set_deployment_preview_issue finding_missing_record finding_missing_update

my_demo_app_update_set.zip

nadimrizk83 commented 4 years ago

finding_missing_update

Uploading a better screen shot for the missing update.

nadimrizk83 commented 4 years ago

The problem has been resolved - Thank you for the tip!! - When creating an application in Orlando using the guided setup, the value for Application Category is not populated with "Custom Application" even though if it is left empty; the default value should be "Custom Application" as stated in the note right above this field. Steps to fix it: Once the application is created; go to sys_app_application.list in the search picker Filter for the application name and chose it Update the Category Field with "Custom Application" and Save Re-Run the pipeline - Deployment successful

I think the long term fix should enable the extract process to check the value for this field and if it is empty set it to default "Custom Application"

Here's the log after this workaround: [11:47:55.959] [INFO] [30032] [/worker#sHg_exZdGt7yQRLiAAAn] searching all update set created up to commit dbed368a1b491b29080cb49f7feb7f084c5b011e [11:47:56.058] [LOG] [30032] [/worker#sHg_exZdGt7yQRLiAAAn] updateSetFiles to be merged: [ 'us/x_530067_cicd_demo/sys_update_set_ef1e1bac1b07d01061ef31d7dc4bcb7d.xml' ] [11:47:56.058] [LOG] [30032] [/worker#sHg_exZdGt7yQRLiAAAn] Parsing update set 'C:\Users\42303\AppData\Local\Temp\temp-build\a4ea1120-391c-482d-bedf-db56384f0aca\dbed368a1b491b29080cb49f7feb7f084c5b011e\us\x_530067_cicd_demo\sys_update_set_ef1e1bac1b07d01061ef31d7dc4bcb7d.xml' for content [11:47:56.068] [LOG] [25396] /worker#sHg_exZdGt7yQRLiAAAn is done (/worker/done) with job: 2a0f5c65-860f-4473-8892-c3baac539e89 Type: exe [11:47:56.562] [LOG] [19796] Request: https://dev88759.service-now.com/api/devops/cicd/deploy_step?__step=previewUpdateSet&__status=304 [11:47:57.461] [LOG] [19796] Job in progress. Wait for 1000 ms ... [11:47:58.461] [LOG] [19796] Request: https://dev88759.service-now.com/api/devops/cicd/deploy_step?__step=previewUpdateSet&__status=304 [11:47:58.905] [LOG] [25396] [EB] Add Job: extractUpdateSet [11:47:59.097] [LOG] [25396] /bus#7H0ng0rqU91IwF1pAABb has added a new RUN Job: 'extractUpdateSet' (Host: undefined) [11:47:59.098] [LOG] [25396] SERVER: EXE JOB extractUpdateSet with Worker: /worker#oCdPBqN2aUZDk7AAAo. [11:47:59.114] [LOG] [30916] [/worker#oCdPBqN2aUZDk7AAAo] Starting module: extractUpdateSet [11:47:59.114] [LOG] [30916] [/worker#oCdPBqN2aUZDk7AAAo] STARTING PROMISE JOB 'extractUpdateSet' [11:47:59.125] [INFO] [30916] [/worker#oCdPBqN2aUZDk7AAAo] [Merged Deployment] Extracting all UpdateSet in 'C:\Users\42303\AppData\Local\Temp\temp-build\a4ea1120-391c-482d-bedf-db56384f0aca\dbed368a1b491b29080cb49f7feb7f084c5b011e\us\x_530067_cicd_demo' from git@github.com:nadimrizk83/x_530067_cicd_demo.git [11:47:59.126] [LOG] [30916] [/worker#oCdPBqN2aUZDk7AAAo] extract-update-set.extractUpdateSet : File is already checked out [11:47:59.128] [LOG] [30916] [/worker#oCdPBqN2aUZDk7AAAo] extract-update-set.extractUpdateSet : Checking out git repository git@github.com:nadimrizk83/x_530067_cicd_demo.git on commit dbed368a1b491b29080cb49f7feb7f084c5b011e [11:47:59.131] [INFO] [30916] [/worker#oCdPBqN2aUZDk7AAAo] searching all update set created up to commit dbed368a1b491b29080cb49f7feb7f084c5b011e [11:47:59.247] [LOG] [30916] [/worker#oCdPBqN2aUZDk7AAAo] updateSetFiles to be merged: [ 'us/x_530067_cicd_demo/sys_update_set_ef1e1bac1b07d01061ef31d7dc4bcb7d.xml' ] [11:47:59.284] [INFO] [30916] [/worker#oCdPBqN2aUZDk7AAAo] directory cleaned C:\Users\42303\AppData\Local\Temp\temp-build\a4ea1120-391c-482d-bedf-db56384f0aca\dbed368a1b491b29080cb49f7feb7f084c5b011e [11:47:59.301] [LOG] [25396] /worker#oCdPBqN2aUZDk7AAAo is done (/worker/done) with job: d110458a-11cb-4551-93ca-4af37ea04a87 Type: exe [11:47:59.355] [LOG] [19796] Job in progress. Wait for 1000 ms ... [11:48:00.357] [LOG] [19796] Request: https://dev88759.service-now.com/api/devops/cicd/deploy_step?__step=previewUpdateSet&__status=304 [11:48:01.159] [LOG] [19796] Job in progress. Wait for 1000 ms ... [11:48:02.163] [LOG] [19796] Request: https://dev88759.service-now.com/api/devops/cicd/deploy_step?__step=previewUpdateSet&__status=304 [11:48:03.162] [LOG] [19796] Job in progress. Wait for 1000 ms ... [11:48:04.162] [LOG] [19796] Request: https://dev88759.service-now.com/api/devops/cicd/deploy_step?__step=previewUpdateSet&__status=304 [11:48:04.826] [LOG] [19796] Request: https://dev88759.service-now.com/api/devops/cicd/deploy_step?__step=commitUpdateSet&__status=303 [11:48:05.718] [LOG] [19796] Request: https://dev88759.service-now.com/api/devops/cicd/deploy_step?__step=deploymentComplete&__status=202 [11:48:06.495] [LOG] [19796] Job in progress. Wait for 1000 ms ... [11:48:07.507] [LOG] [19796] Request: https://dev88759.service-now.com/api/devops/cicd/deploy_step?__step=deploymentComplete&__status=304 [11:48:08.288] [LOG] [19796] Job in progress. Wait for 1000 ms ... [11:48:09.303] [LOG] [19796] Request: https://dev88759.service-now.com/api/devops/cicd/deploy_step?__step=deploymentComplete&__status=304 [11:48:10.827] [LOG] [19796] [/worker#uaDeuNlAjommp8sgAAAl] deploy-update-set.deployUpdateSet : UpdateSet successfully deployed in 31.17 sec. [11:48:12.732] [LOG] [19796] Change Run State to 'successful (deployment completed)' [11:48:12.782] [LOG] [25396] /worker#uaDeuNlAjommp8sgAAAl is done (/worker/done) with job: 870e10f4-70ea-4fb9-8d06-f4bc9835f5e3 Type: exe

bmoers commented 4 years ago

Seems the guided setup bug where it's not assigning this correctly and sets it to

<category display_value="">Custom Applications</category>

instead of

<category display_value="Custom Applications">e0355b31ef303000a61d5a3615c0fb78</category>

If the application is created the classic way, the category is no set.

nadimrizk83 commented 4 years ago

Interesting; thank you for the updates; what do you propose doing when creating the application to avoid the manual steps for setting the category value?

bmoers commented 4 years ago

If you use the legacy app creator it seems to be fine. But that one needs to be activated on newer instances again Doc: https://docs.servicenow.com/bundle/newyork-application-development/page/build/applications/concept/c_ApplicationCreationOptions.html

Activate: https://docs.servicenow.com/bundle/newyork-application-development/page/build/applications/task/activate-legacy-app-creator.html

nadimrizk83 commented 4 years ago

Thank you for the updates. That makes sense. We can close this issue for now; again much appreciate your support.