Octopus.Script exported 2016-09-15 by PeterOsterdahl belongs to ‘Wait’ category.
Pauses the process until a given time
Parameters
When steps based on the template are included in a project’s deployment process, the parameters below can be set.
Time to deploy
DefaultTargetTime =
Will deploy within the next 24 hours if only time is specified or at a specific date if that is specified A time set here will be used unless the project has a variable TargetTime. Examples:
03:00 Will deploy within 24 hours when the time is 03:00 in the morning
2099-09-14 05:00 Will deploy at that day and time
2025-10-01 Will deploy at 00:00 the first of october 2025
If the deployment time changes often it is suggested to create a variable named TargetTime and make it promptable. This will force the user to set the deployment time before the build process starts.
Script body
Steps based on this template will execute the following PowerShell script.
if(($DefaultTargetTime -eq $null-or $DefaultTargetTime -eq '') -and ($TargetTime -eq $null -or $TargetTime -eq'') ){
Write-Output 'Deploy will start immediately because neither TargetTime or DefaultTargetTime is set'
}else{
if($TargetTime -eq $null){
$deployTime = get-date($DefaultTargetTime)
Write-Output 'DeployTime is set to DefaultTargetTime since TargetTime is not configured as a variable for this build scope.'
}else{
$deployTime = get-date($TargetTime)
}
if((get-date) -ge $deployTime){
$deployTime = $deployTime.AddDays(1)
}
Write-Output ('Deploy will pause until ' + $deployTime)
do {
Start-Sleep 1
}
until ((get-date) -ge $deployTime)
}
Provided under the Apache License version 2.0.
To use this template in Octopus Deploy, copy the JSON below and paste it into the Library → Step templates → Import dialog.
{
"Id": "c8781255-615a-4092-99f1-82ddefdb6d6b",
"Name": "Wait until time",
"Description": "Pauses the process until a given time",
"Version": 25,
"ExportedAt": "2016-09-15T10:46:20.183+00:00",
"ActionType": "Octopus.Script",
"Author": "PeterOsterdahl",
"Parameters": [
{
"Name": "DefaultTargetTime",
"Label": "Time to deploy",
"HelpText": "Will deploy within the next 24 hours if only time is specified or at a specific date if that is specified\nA time set here will be used unless the project has a variable TargetTime.\nExamples:\n\n\t03:00\t\t\t\tWill deploy within 24 hours when the time is 03:00 in the morning\n\t2099-09-14 05:00\tWill deploy at that day and time\n\t2025-10-01\t\t\tWill deploy at 00:00 the first of october 2025\n\nIf the deployment time changes often it is suggested to create a variable named TargetTime and make it promptable. This will force the user to set the deployment time before the build process starts.",
"DefaultValue": "",
"DisplaySettings": {
"Octopus.ControlType": "SingleLineText"
}
}
],
"Properties": {
"Octopus.Action.Script.ScriptBody": "if(($DefaultTargetTime -eq $null-or $DefaultTargetTime -eq '') -and ($TargetTime -eq $null -or $TargetTime -eq'') ){\n Write-Output 'Deploy will start immediately because neither TargetTime or DefaultTargetTime is set' \n}else{\n \n if($TargetTime -eq $null){\n $deployTime = get-date($DefaultTargetTime)\n Write-Output 'DeployTime is set to DefaultTargetTime since TargetTime is not configured as a variable for this build scope.'\n }else{\n $deployTime = get-date($TargetTime)\n }\n if((get-date) -ge $deployTime){\n $deployTime = $deployTime.AddDays(1)\n }\n Write-Output ('Deploy will pause until ' + $deployTime)\n\n \n do {\n \tStart-Sleep 1\n }\n until ((get-date) -ge $deployTime)\n}",
"Octopus.Action.Script.Syntax": "PowerShell"
},
"Category": "Wait",
"HistoryUrl": "https://github.com/OctopusDeploy/Library/commits/master/step-templates//opt/buildagent/work/75443764cd38076d/step-templates/Wait-until-time.json",
"Website": "/step-templates/c8781255-615a-4092-99f1-82ddefdb6d6b",
"Logo": "iVBORw0KGgoAAAANSUhEUgAAAMkAAADICAIAAADN+FL3AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAACxMAAAsTAQCanBgAABAYSURBVHhe7Z3Rb1RVHsdxI0Sg4FAioCV0mnVM1iEyk2hLAtQ2VBJxE0Z345qNSYe3zT5sq/8AY/ZtfaC87CtDYvbBxLVmFROsYaSQQNfNDAnVxLrpsIGVxVBHLLhpTdiv3GPTbeeec+6953fuuTO/T4jeU0y98zuf+Z3fOffcex+4d+/eGoYh4Gfi3wxjGnaLoYLdYqhgtxgq2C2GCnaLoYLdYqhgtxgq2C2GCnaLoYLdYqhgtxgq2C2GCnaLoYLdYqhgtxgq2C2GCnaLoYLdYqhgtxgq2C2GCnaLoYLdYqhgtxgq+N7XNb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