F# |> Octopus Deploy loves

Octopus welcomes F# to the family!

This post is a part of our Octopus 3.4 blog series. Follow it on our blog or our twitter feed.

Octopus Deploy 3.4 has shipped! Read the blog post and download it today!

The upcoming release of Octopus 3.4 will include F# 4.0 support which means that both custom and standalone scripts (*.fsx) can be written in it.

How do I get started?

  1. Create a new project
  2. Add a variable called MyVariableName and set its value to World
  3. Add a "Run a script" step
  4. Type your F# script. F# is white-space sensitive so indentation matters. You can copy and paste a sample script from here. Step details
  5. Create a new release and deploy it
  6. Click on Task log and you should see the following output: Log

You can also set output variables and create artifacts.

Why F#?

We already support Bash, PowerShell and ScriptCS so you might wonder why we need another language. Firstly, because you asked for it and you asked quite a few times. :) Secondly, each of the languages supported by Octopus offers different features:

  • Bash operates on text
  • PowerShell operates on objects but their type is not known until runtime
  • ScriptCS offers static compilation
  • F# is compact, has a great type inference and forces you to deal with edge cases explicitly (e.g. lack of value)

From our perspective, more choice is better as it helps you find the right tool for the job.

I would like to learn a bit more

If you haven't used F# before and want to learn more about it then have a look at resources provided by F# Foundation and Scott Wlaschin's site. He is a great educator.

If you always wanted to use F# in your development workflow but couldn't find a low risk way of introducing it then deployment scripts in F# might be what you were looking for.

And don't forget that you can always execute arbitrary F# code on any number of targets by using Script Console. It is a like REPL, but distributed.

And last but not least, I wanted to thank Jorge Fioranelli for his help with making our API F# friendly.