This simple utility does the following things
- Reads the contents from GithubConfigObjects.json file.
- Foreach application listed in the json file, it downloads the respective configuration file along with the release config file into a folder with the same name as its Octopus Deploy Project Name.
- It then transforms the config file using the variables from Octopus Deploy’s Central Config Library set.
- Compares the transformed file with the actual file and publishes the differences in a new file with the prefix “diff-”
octopusprojectname: Name of the project in Octopus Deploy
configtype: Configuration file type. ‘webconfig’, ‘appconfig’ or ‘appsettingjson’
repository: Name of the github repository
configlocation: Location of the config file in repository
sourceconfig: Config file name
transformconfig: Transformation file that has placeholders for Octopus Variables
compareconfig: Config file that is being used for Transformation comparision. Prod config file if you are comparing prod configurations. Name the file after the OD project.
gitbranch: Name of the git branch
{ "GitConfigObjects": [ { "octopusprojectname": "XpoConnect-IntegrationServices-Api", "configtype": "webconfig", "repository": "xpoconnect-integration-services-backend", "configlocation": "src/backend/Api/Xpo.Connect.IntegrationService.Backend.Api.Site", "sourceconfig": "Web.config", "transformconfig": "Web.Release.config", "compareconfig": "XpoConnect-IntegrationServices-Api.config", "gitbranch": "dev"
}, { "octopusprojectname": "XpoConnectServices-Api", "configtype": "appsettingjson", "repository": "xpoconnect-services-api", "configlocation": "src/backend/Api/XpoConnect.Services.Api.Site", "sourceconfig": "appsettings.json", "transformconfig": "appsettings.Release.json", "compareconfig": "XpoConnectServices-Api.json", "gitbranch": "dev" }
] }
dotnet publish -r win-x64 -c Release -o output /p:PublishSingleFile=true
This will publish OctopusDeployConfigTransformer.exe file in ‘output’ directory. Copy GithubConfigObjects.json file and the files that need to be compared to the same directory.
Run the below command with appropriate values. This will download the transformed config files in to the directories named after their Octopus Deploy Project and diff files in the main directory with the prefix “diff-”
.\OctopusDeployConfigTransformer.exe “{your_git_id}” “{your_git_PAT}” “{your_ocotpus_deploy_api_key}” “GithubConfigObjects.json” “Prod,”