Migrate completed update set history to Source Control
Summarize
Summary of Migrate Completed Update Set History to Source Control
This feature allows ServiceNow application developers to migrate completed update set histories into Source Control, ensuring that all changes are preserved as historical commits. It is important to ensure that certain prerequisites are met prior to migration.
Show less
Prerequisites
- Role Required: Admin
- Complete any update sets intended for export as Source Control history.
- Export completed update sets to preserve them before linking to Source Control.
Migration Process
When linking to Source Control, developers are prompted to choose between preserving or not preserving update set history. Selecting "Yes" retains the history as commits, while "No" does not. Regardless of the choice, all completed update sets and Customer Update records will be deleted upon linking.
For each completed update set, the system generates commits based on sysupdatexml records, ordered by timestamp. For global applications, records from completed global update sets are included as historical commits.
Key Features
- Historical commits are generated for completed update sets, allowing you to track changes over time.
- Commits are organized to maintain an ordered history, especially for files with multiple updates.
- Customizable commit messages by adding fields through glide.sourcecontrol.historicalcommitfields.
Key Outcomes
After migration, the latest commit represents the current state of the application. Developers can view historical commits in their Git repository or through the Source Control menu. However, caution is advised when handling historical commits, as they do not represent stable application snapshots.
When linking to Source Control, this feature allows application developers the choice of migrating the information in completed update sets to Source Control history.
Before migrating
- Role required: admin
- Read the Link an application or application-customization to source control topic
- Complete any update sets for your application that you want to export as Source Control history.
- Export the completed update set if you want to preserve it.
- If you select “Yes, do retain update set history as commits”, the update set history is preserved as Source Control commits.
- If you select “No, do not retain update set history as commits,” they are not preserved as commits.
For every completed update set with updates to the application that you are linking to Source Control, commits are generated automatically by the system based on the sys_update_xml records in the update sets. The commits are ordered by the sys_recorded_at timestamp. For Global applications: Any sys_update_xml records that belong to the application and are part of a completed Global update set are captured as historical commits.
- If there are updates for a file that are out of order between different update sets.
- If an update set contains multiple update records for a single file.
The commits for an update set are split into multiple commits ([Historical Commit 1], [Historical Commit 2]...) to represent each update. This is done so that each file has an ordered history of updates.
The author_elective_update folder is not created until the initial commit. That means that in the initial commit you might see files such as sys_choice files being renamed and moved from the update folder to the author_elective_update folder. Any files that are deleted from update sets in historical commits are deleted, and not moved to the author_elective_update folder as they would be for actual commits. During the initial commit, DELETE payloads are also created for any DELETE sys_update_xml records that were deleted as part of completed update sets.
[Historical Commit 1] <Name of update set that this commit belongs to>
Description: <Description of update set that this commit belongs to>
Update Set was completed on / installed on <date>
Update Set was completed by <sys_user user_name > <sys_user email>
{}
{Batch update set information (See the Batch update sets section below) }
Batch update sets
If an update set is part of a batch update set, that information is appended to the commit message in the following format, with the highest number being the Batch Base:
{
"1": {
"parent": "<name of parent update set>",
"description": "<description of parent update set>"
},
"2": {
"parent": " <name of parent 1’s parent update set> ",
"description": " <description of parent 1’s parent update set> "
}
}
Customization
You can add additional fields to include in the commit message by adding a glide.source_control.historical_commit_fields property. The value is a comma-separated list of fields the user wants to include from sys_update_set XML fields. Spaces and invalid or misspelled field names are ignored. This property is used for all applications that are linked to Source Control from the instance if the committer chooses to retain update set history.