Closed rninne closed 3 years ago
For regular Git, you'd have to do a git fetch
then a git checkout
.
Also, we don't have a "switch branch" CI/CD API?
Workflow-wise, users should specify the branch_name parameter just as the API works: https://github.com/ServiceNow/servicenow-cicd-azure-extension/blob/master/src/lib/SCApply.js https://developer.servicenow.com/dev.do#!/reference/api/rome/rest/cicd-api#cicd-POST-sc-apply_changes
The feature request is therefore to do the equivalent of a git fetch
as a part of the apply remote changes API
For SN internal: https://buildtools1.service-now.com/nav_to.do?uri=rm_epic.do?sys_id=d8ef8c18db1278580af0c7a2b99619eb%26sysparm_view=scrum
[SC] Apply Remote Changes by API should refresh list of branches from remote first
When switching branches, if the branch is not yet known by the instance the branch switch fails. The most obvious time this breaks is when triggering the pipeline from a pull request. The pull request branch e.g. refs/pull/15/merge does not exist in the repo and switching to it fails.
Either add repo refresh as a part of the CICD-SC-Apply task, or add refresh as a separate task so that we can call it before apply.
The work around at the moment is to use the apply task on a known branch first e.g. master, as the apply task does a refresh after checkout, then use apply on the new branch.