public void Serialize_Bash_File_Task_Test() { var task = new BashFileTask("some/script.sh") { Arguments = "foo bar", ContinueOnError = true, FailOnStderr = true, BashEnv = "~/.bash_profile", DisplayName = "Test task" }; string yaml = SharplinerSerializer.Serialize(task); yaml.Trim().Should().Be( "" " task: Bash@3 displayName: Test task inputs: targetType: filePath filePath: some/script.sh arguments: foo bar failOnStderr: true bashEnvValue: ~/.bash_profile continueOnError: true " ""); }
public void Canary_Strategy_Test() { var strategy = new CanaryStrategy { Increments = { 10, 1000, 25000 }, RouteTraffic = { Steps = { new CurrentDownloadTask(), } }, PostRouteTraffic = { Pool = new HostedPool("MacOS-latest"), Steps = { new CurrentDownloadTask(), } }, OnFailure = { Steps = { new InlineBashTask("echo 'failure!' && exit 1") } } }; string yaml = SharplinerSerializer.Serialize(strategy); yaml.Trim().Should().Be( "" " canary: increments: - 10 - 1000 - 25000 routeTraffic: steps: - download: current postRouteTraffic: pool: name: MacOS-latest steps: - download: current on: failure: steps: - bash: |- echo 'failure!' && exit 1 " ""); }
public void Serialize_Bash_File_Task_With_Defaults_Test() { var task = new BashFileTask("some/script.sh").DisplayAs("Test task"); string yaml = SharplinerSerializer.Serialize(task); yaml.Trim().Should().Be( "" " task: Bash@3 displayName: Test task inputs: targetType: filePath filePath: some/script.sh " ""); }
public void Serialize_Powershell_File_Task_With_Defaults_Test() { var task = new PowershellFileTask("some\\script.ps1").DisplayAs("Test task"); string yaml = SharplinerSerializer.Serialize(task); yaml.Trim().Should().Be( "" " task: PowerShell@2 displayName: Test task inputs: targetType: filePath filePath: some\script.ps1 " ""); }
public void Serialize_Powershell_File_Task_Test() { var task = new PowershellFileTask("some\\script.ps1") { Arguments = "foo bar", ContinueOnError = true, ErrorActionPreference = ActionPreference.Inquire, WarningPreference = ActionPreference.Stop, InformationPreference = ActionPreference.Break, DebugPreference = ActionPreference.Suspend, VerbosePreference = ActionPreference.Break, FailOnStderr = true, IgnoreLASTEXITCODE = true, DisplayName = "Test task" }; string yaml = SharplinerSerializer.Serialize(task); yaml.Trim().Should().Be( "" " task: PowerShell@2 displayName: Test task inputs: targetType: filePath filePath: some\script.ps1 arguments: foo bar errorActionPreference: Inquire warningPreference: Stop informationPreference: Break verbosePreference: Break debugPreference: Suspend failOnStderr: true ignoreLASTEXITCODE: true continueOnError: true " ""); }
public void Rolling_Strategy_Test() { var strategy = new RollingStrategy { MaxParallel = 4, PreDeploy = { Steps = { new CurrentDownloadTask(), } }, Deploy = { Pool = new HostedPool("MacOS-latest"), Steps = { new CurrentDownloadTask(), } }, }; string yaml = SharplinerSerializer.Serialize(strategy); yaml.Trim().Should().Be( "" " rolling: maxParallel: 4 preDeploy: steps: - download: current deploy: pool: name: MacOS-latest steps: - download: current " ""); }
public string Serialize() => SharplinerSerializer.Serialize(Pipeline);