Skip to content
This repository has been archived by the owner on Apr 18, 2020. It is now read-only.

osoykan-archive/Cake.OctoVariapus

Repository files navigation

Cake.OctoVariapus Build status NuGet version

Cake

Cake integration for Octopus variable management

#addin nuget:?package=Cake.OctoVariapus

Usage

Passing Collection

OctoImportVariables(octopusUrl,
                octoProjectName,
                octoApiKey,
                new List<OctoVariable>
                {
                    new OctoVariable
                    {
                        Name = "ConnectionString",
                        IsSensitive = false,
                        IsEditable = true,
                        Value = "DataSource:localhost25",
                        Scopes = new List<OctoScope>
                        {
                            new OctoScope
                            {
                                Name = "Environment",
                                Values = new List<string> { "Development", "Stage" }
                            },
                            new OctoScope
                            {
                                Name = "Role",
                                Values = new List<string> { "Development" }
                            }
                        }
                    }
                })

With Json File

[
  {
    "Name": "ProductApiEndPoint",
    "Value": "http://www.developmentProductApi.com",
    "IsSensitive": false,
    "IsEditable": true,
    "Scopes": [
      {
        "Name": "Environment",
        "Values": [
          "Development"
        ]
      }
    ]
  },
  {
    "Name": "ProductApiEndPoint",
    "Value": "http://www.stageProductApi.com",
    "IsSensitive": false,
    "IsEditable": true,
    "Scopes": [
      {
        "Name": "Environment",
        "Values": [
          "Stage"
        ]
      }
    ]
  },
  {
    "Name": "ProductApiEndPoint",
    "Value": "http://www.productionProductApi.com",
    "IsSensitive": false,
    "IsEditable": true,
    "Scopes": [
      {
        "Name": "Environment",
        "Values": [
          "Production"
        ]
      }
    ]
  },
  {
    "Name": "ConnectionIsSafe",
    "Value": "true",
    "IsSensitive": false,
    "IsEditable": true,
    "Scopes": [
      {
        "Name": "Environment",
        "Values": [
          "Development",
          "Stage",
          "Production"
        ]
      },
      {
        "Name": "Role",
        "Values": [
          "Development"
        ]
      },
      {
        "Name": "Machine",
        "Values": [
          "Oguzhan's Machine Group"
        ]
      },
      {
        "Name": "Step",
        "Values": [
          "1. Initial"
        ]
      }
    ]
  }
]

Execution:

OctoImportVariables(octopusUrl,
                octoProjectName,
                octoApiKey,
                "./variables.json")