Does anyone have an example folder structure of utilizing the SDK as well as source control?

Brady Holliday
Tera Guru

We are looking at utilizing the SDK along with our normal development (which uses source control from the studio) I was curious if anybody had an example of how they setup the structure of the GitHub repository in which both the SDK and the Source Control from the instance would be in sync.

 

Thanks in advance!

1 ACCEPTED SOLUTION

currently, there is not "git-to-new-git" migration provided. We suggest creating a new repo and following the instructions from these docs: https://www.servicenow.com/docs/bundle/yokohama-application-development/page/build/servicenow-sdk/ta...

View solution in original post

3 REPLIES 3

EdwinCoronado
ServiceNow Employee
ServiceNow Employee

Hi Brady! the existing source control in Studio stores application content in its raw XML format in a very specific directory structure. The SDK (Fluent apps) is much more flexible and can be arranged in any way you'd like as long as the `now.config.json` is set up correctly.

 

Currently, they are not interoperable or compatible without some manual work. Additionally, the original studio source control integration discourages people from modifying contents of the repo "by hand" and instead is meant to be used through the servicenow instance. This is not the case for the SDK apps. The major difference between them is that the studio git saves the application's content ready for the runtime (the instance), whereas the SDK (Fluent) app has a "build" step to produce an application artifact that is basically the XML and directory structure that the git studio requires but it is an artifact of the now-sdk build, and not what you'd store in the Fluent app repo itself. Fluent projects, however, do have compatibility with raw XML (like what you'd see in studio) by using the `metadata` directory. You can learn more about that here: https://www.servicenow.com/docs/bundle/xanadu-application-development/page/build/custom-application/.... Using this metadata directory could bridge the gap and give you an opportunity to have some items defined in Fluent and some left as XML (like studio would). 

 

Hope this helps!

Hey @EdwinCoronado, thanks for your reply! 

 

As far as the manual steps go is there any information on how you can take an already existing application that is hooked up to source control and convert it into the SDK format, where if you were to push up from the instance or the SDK you would be editing the same code?

 

For example, when connecting the instance to source control it is structured like this:

 

Repo:

  • <sys_id>

    • author_elective_update

      • files.xml

    • update

      • files.xml

    • checksum.txt

    • sys_app_<sys_id>

  • sn_source_control.properties

 

However, when you use the SDK it is structured like this:

Repo:

  • now_sdk_folder
    • metadata
      • update
        • files.xml
      • package_inventory.csv
      • sys_app_<sys_id>

 

If we were to update the 'sn_source_control.properties' file from this:

 

#############################################################
# This ServiceNow-created file contains the path to the app in this repo
# path=<path to app content in your repo>
# For example, if the app content resides in a folder named x_my_custom_app, the path value would be:
# path=/x_my_custom_app
# Update the path value when you move the app to a new repo location.
############################################################
#
#Wed May 18 07:15:04 PDT 2022
path=<sys_id>

to this:

#############################################################
# This ServiceNow-created file contains the path to the app in this repo
# path=<path to app content in your repo>
# For example, if the app content resides in a folder named x_my_custom_app, the path value would be:
# path=/x_my_custom_app
# Update the path value when you move the app to a new repo location.
############################################################
#
#Wed May 18 07:15:04 PDT 2022
path=/now_sdk_folder/metadata/update

Would this ensure that if you pushed from the SDK to GitHub and then used the instance to apply remote updates that the files would be in sync and vice versa?

 

currently, there is not "git-to-new-git" migration provided. We suggest creating a new repo and following the instructions from these docs: https://www.servicenow.com/docs/bundle/yokohama-application-development/page/build/servicenow-sdk/ta...