Skip to content

abjinugu/ODVariablesubstitution

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation



Octopus Deploy Variable Substitution Utility

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-”

GithubConfigObjects.json explained

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

Example
{
  "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"
}

] }

How to run

Publish code into one single exe file

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,”

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages