Example Patch Creation Procedure
This document outlines an example patch creation procedure.
It outlines how patches can be created, given two folders. One containing a latest build, and one containing a previous build to patch from.
The patches will then be prepared for upload on a CDN using bundling.
Creating Resource Groups
Resource Groups can be created via the lib or CLI. This example uses the CLI.
This example uses two directories.
C:\PreviousBuild Contains files in a previous build
C:\NextBuild Contains files in the latest build
.\resources.exe create-group C:\PreviousBuild --output-file PreviousResourceGroup.yaml
.\resources.exe create-group C:\NextBuild --output-file NextResourceGroup.yaml
These two commands will create two resource groups
PreviousResourceGroup.yaml
NextResourceGroup.yaml
The resource group files are human readable yaml files and quite self explanatory. For more information see Filesystem Design - Local/Remote
Creating a Patch from the Resource Groups
The resource groups generated in the previous section can now be use to generate a patch.
.\resources.exe create-patch PreviousResourceGroup.yaml NextResourceGroup.yaml --resource-source-base-path-previous C:\PreviousBuild --resource-source-base-path-next C:\NextBuild
The command is passed 4 required arguments
Positional argument 1 - Path to previous resource group
Positional argument 2 - Path to next resource group
--resource-source-base-path-previous- base path to source resources for previous--resource-source-base-path-next- base path to source resources for next
Note
See CLI help for more information regarding options.
This will create a patch in the folder PatchOut which contains:
A PatchResourceGroup.yaml file - This holds the patch information including a list of binary patches required for the full patch.
The
Patchesdirectory which contains the binary patch data, by default this is saved in aLOCAL_CDNfile structure which are in a CDN friendly structure but uncompressed. See Filesystem Design - Local/Remote For more information regarding filesystem design.
Note
The patch data generated by default is not compressed so is not reflective of the finished patch size.
Creating a Bundle from the Patch
Patch creation can create many files. This is due many factors such as chunked input.
Furthermore, once the patch binaries are compressed their size may reduce dramatically.
This gives a patch which is created of many very small files which is not ideal for transfer over the internet.
In order to solve this resources also provides a concept of bundling.
Bundling joins files together into chunks based on their final combined compressed size.
.\resources.exe create-bundle PatchOut\PatchResourceGroup.yaml --resource-source-path PatchOut\Patches --resource-source-type LOCAL_CDN --chunk-destination-type REMOTE_CDN
Arguments:
Positional argument - Path to the PatchResourceGroup.yaml that is to be bundled
--resource-source-path- Source base path where resources referred to in the PatchResourceGroup can be sourced--resource-source-type- filesystem type that the resources adhere to. Create patch command used in the previous section outputted toLOCAL_CDNso this is used as an input here.--chunk-destination- Destination filesystem type to output the chunks of the bundle to.REMOTE_CDNwill output in a CDN friendly structure and also compress the files ready for upload.
Conclusion
This document presented a method to take two builds that were locally on a system and produce a bundled patch which is ready for uploading to a CDN. There are many more exposed options than discussed here. For exhaustive list refer to the CLI help
.\resources.exe -h
.\resources.exe create-group -h
.\resources.exe create-patch -h
.\resources.exe create-bundle -h