This was noticed when doing a build of an update set containing more than 50 items. The symptom was that some of the script includes were not extracted and committed to the project repo and my debugging found that paging on the build server side stopped at the first page of 50 results.
Thesn-cicd/lib/modules/export-update-set.js module calls the snClient getUpdateSetFiles function which sends a request to the CICD Integration application REST resource 'CI - Get UpdateSet Files' , and it calls the CiCdApi script include getUpdateSetFiles function which call _getGrResultStream which calls _createLink to create the next page web linking that the CICD server logic expects (it uses the thlorenz/parse-link-header library) and the format should be e.g.
But the format returned by the _createLink function is like this (e.g. below) , the issue being that therel="first" part is inside the > and not after it.
https://github.com/bmoers/sn-cicd-integration/blob/f5b8179f824db267adde9bbe8bd7dc1974300590/script_include/CiCdApi.js#L458
Hi Boris,
This was noticed when doing a build of an update set containing more than 50 items. The symptom was that some of the script includes were not extracted and committed to the project repo and my debugging found that paging on the build server side stopped at the first page of 50 results.
The
sn-cicd/lib/modules/export-update-set.js
module calls the snClient getUpdateSetFiles function which sends a request to the CICD Integration application REST resource 'CI - Get UpdateSet Files' , and it calls the CiCdApi script include getUpdateSetFiles function which call _getGrResultStream which calls _createLink to create the next page web linking that the CICD server logic expects (it uses the thlorenz/parse-link-header library) and the format should be e.g.<https://api.github.com/user/9287/repos?page=3&per_page=100>; rel="next"
But the format returned by the _createLink function is like this (e.g. below) , the issue being that the
rel="first"
part is inside the>
and not after it.https://myinstance.service-now.com/api/devops/cicd/updateset_files/8daf684edb4d38506c1f0c17f3961969?sysparm_fields=action%2C%20name%2C%20payload%2C%20update_set%2C%20sys_id%2C%20sys_created_by%2C%20sys_updated_by&sysparm_limit=50&sysparm_offset=0;rel="first">,
I believe the simple fix for this is to modify the _createLink function to change the return value so that the
rel=
part is after the>
i.e.return '<'.concat(self.request.url, '?', queryParams.concat(['sysparm_limit=' + limit, 'sysparm_offset=' + offset]).join('&'), '">', ';rel="', rel);
Thanks and regards, Chris Devine