System variables (Date and time)

Hi Guys,

is it possible to get current time values also from system variable? I only find the #{Octopus.Date.*} variables but it would be great to get the current time for versioning. Is it possible to do an Octopus.Time group with (hours, mintues, seconds)?

Or is there any way to configure the versioning to use the current time. When our CI creates a release (with octo.exe) the versioning pattern is 1.0.Date.Time (eg. 1.0.20151014.160432). But when we create a new release by hand i have to set the time part manually. Not a big deal but it would be better to fill it automatically.

Thanks for you help!
Attila

Hi Attila,

Thanks for the question.

At the moment there is no way to get the current time, you will need to do it manually.
I’ve added variables for retrieving the time, they should be out in Octopus 3.1.5.

Cheers,
Shane

Great news!

Thanks!

Hi Shane,

Now that the ver 3.1.5 is already out, can you let us know how we can add current time as a variable?

Thanks,

Sunny

Hi

We have version 3.1.5 installed and I’ve tried using the variables #{Octopus.Time.Hour} and #{Octopus.Time.Minute} as per here;

https://github.com/OctopusDeploy/Issues/issues/2078

They don’t seem to work and are not resolved to the hour or minute.

Any help would be appreciated.

Thanks

Jared

Hi,

The variables are for version templates. In project settings you should be able to enter #{Octopus.Time.Hour} into the version template field and when creating a new release it will resolve to the current hour.

I’ve tried in Octopus Server 3.1.5 and Hour, Minute and Second resolve as expected.

Hope this helps.

Cheers,
Shane

Ah, ok that makes sense now. I assumed they could be used anywhere. I was trying to use them for naming artifacts. I’ve worked round it with PowerShell.

Thanks for the quick response.

Any chance to make these variables available in other places? In particular, trying to send out an automated email letting people know deployment will happen at Current.Time + 1 in the email text, I automated all our deployment process except the email.

Sunny

I just tried using the #{Octopus.Time.Second} syntax using version 3.3.26 and it’s not working. Was this feature removed?

Hi Daniel,

Thanks for reaching out. The variables #{Octopus.time.hour}.#{Octopus.time.minute} & #{Octopus.time.second} are still available (see attached gif). Do keep in mind that they are only available for your project’s versioning template, and not like a regular variable during a deployment.

Thanks,
Dalmiro

attaching GIF

Notice:

This issue has been closed due to inactivity. If you encounter the same or a similar issue and require help, please open a new discussion (if we asked for logs or extra details in this thread, consider including them in the new thread). If you are the creator of this thread and believe it should not be closed let us know via our support email.