Schedule release using TFS

integration

(dan.hoenig) #1

I setup TFS 2017 to build and deploy my app using Octo. I used the Octo created tasks in TFS to package, publish the packages to octo and create/deply the app. Everything works really good. Now I’d like to have it do this but instead of deploying the app immediately I’d like it to schedule the deployment. I can get it to work by adding the “deployAt” option to the “Create Octopus Release” task. But, the problem is I can only seem to put a static datetime in. I’d like this to take the current date and add one day to it. Is there a way to do this?


(Shaun Marx) #4

Hi Dan, thanks for getting in touch.

You are not limited to static dates for the argument as you can use variables as provided by VSTS/TFS. I don’t think the fields themselves support expressions, but you can definitely create the variable as part of another step.

You should be able to set the output variable using something like the following:

$releaseDate= ([System.DateTimeOffset]::Now).AddDays(1).ToString()
Write-Host "##vso[task.setvariable variable=releaseDate]$releaseDate"

You can then user the variable in the additional arguments field of the Octopus create release task similar to any other variable:

--deployAt="$(releaseDate)"

Hope that helps!

Regards,
Shaun Marx


(dan.hoenig) #6

Shaun,
This worked perfectly for what I needed to do. Thank you for the help, I appreciate it!

Thanks,
Dan


(system) #7

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.