This is an extension for Cake framework. It allows running scripts e.x. az-cli
using Cake.
Cake (C# Make) is a cross-platform build automation system. It is built on top of the Roslyn compiler which enables you to write your build scripts in C#. You can create tasks such as compiling code, copying files and folders, running unit tests, compressing files and building NuGet packages.
- Make sure Azure CLI is installed (version 2.0.81 or later).
- Make sure npm is installed.
- (Optional) Use VSCode extension markdownlint to markdown file linting and style checking.
./deploy.ps1
./deploy.ps1 -Target Az-Login
./deploy.ps1 --env="dev" --subscription= '*****' -Target Az-Login-With-Set-Subscription
Parameters:
--env
: environment (ex.default
,dev
)--subscription
: name or ID of subscription
az.Run(a => {
a.Append("login");
});
Script command: az login
az.Run(a => {
a.Append("login");
}, exceptionOnError: false);
Script command: az login
az.Run(a => {
a.Append("account");
a.Append("set");
a.AppendSwitchQuoted("--subscription", ReleaseVariable("subscription"));
});
Script command: az account set --subscription "xxxxx"
az.Run(a => {
a.Append("testSecretCommand");
a.AppendSwitchQuotedSecret("--secretVariable", ReleaseVariable("secretVariable"));
});
Script command: az testSecretCommand --secretVariable "*****"
script with one parameter with special characters with special parsing token
az.Run(a => {
a.Append("testCommand");
a.AppendSwitch("--%");
a.AppendSwitchQuotedSecret("--variableWithSpecialCharacters", ReleaseVariable("variableWithSpecialCharacters"));
});
Script command: az testCommand --% --variableWithSpecialCharacters "#@$%^|&"
Bootstrapper script - it will automatically download Cake and other tools from NuGet and run main deploy.cake
script with parameters.
Main script with logic - set available command runners (ex. az
(azure-cli) and ps
(Powershell) in the Setup()
).
Base class for all runners. It contains logic that starts powershell scripts with specified settings and arguments.
Class for basic command runner - is uses script command (toolName
, ex. az
) that should be available from the console.
Class for command runners installed in a specified location ("./node_modules/.bin/*.cmd").
File with task to install npm packages.
File with sample tasks using az-cli.
Configuration file with nuget and tools paths - should not be modified.
Configuration file with list of packages (ex. Cake) that should be installed.
Configuration file with list of external npm packages.
Configuration file with release variables (template, default one) for base environment. Documentation
Configuration file with release variables for dev
environment (override variables from base environment). Documentation