Whether it's to warm up a web server or simply to smoke test a fresh deployment, hitting a URL and verifying the result is a pretty common thing to see in the deployment processes for web apps.
While it's always been possible to write a PowerShell step for this with Octopus Deploy, Sporting Solutions have been kind enough to package this up in an easy-to-reuse template for the Octopus Deploy Library.
Since this is the first time we've featured a contributed step template on the Octopus Deploy blog, let's walk through how to bring this into your Octopus projects.
Importing the template
The first thing to do is visit the library and find the template. You can find the HTTP - Test URL template here.
The library itself gives a quick overview of the template so that you can determine whether it suits your requirements; the important thing on this page, unsurprisingly given its prominence, is the big green "Copy to Clipboard" button.
Press it now to retrieve the JSON document describing the template.
Next, sign in to your Octopus Deploy server, and visit Library > Step templates. At the top right of the page there's an Import link - click it, and paste in the JSON you just copied from the website.
Once you've hit Import the template will be displayed - you can now tweak the parameters or script if you like, but otherwise, the template's ready to use in your deployment process.
Using the template
Assuming you have a project with a deployment process that installs a web app, the first step is to open the Project > Process tab, and select the Add step button. At the bottom of the list that is shown, you'll see the name of the template that was just imported.
When you click the name of the template to create a new step, you'll be presented with input fields for each of the template's parameters. In the case of HTTP - Test URL, that's the URL to test, the status code that's expected, and a timeout value.
Step template parameters like the URL in this example work just like regular Octopus step parameters - they can be bound using
and each parameter itself is exposed as a variable that can be used elsewhere, for example in PowerShell scripts.
Finally - and this is the most exciting part :) - when you create and deploy a new release of your project, the step will run and the results printed into the deployment log.
We really like the HTTP - Test URL template since though it's very simple, it is a great example of what can be done using step templates and the Octopus Deploy Library. If you haven't browsed the library yet, you might be surprised to find out just how many templates are already available.
If you're already writing step templates and want to share those with the Octopus community, it's not too late to enter our library competition; if you submit a template and it's accepted before the end of June, you could be the proud owner of an Octopus Deploy mug!
Octopus Deploy is used by thousands of developers across the globe, from small companies to large enterprises. Find out if it meets your deployment automation needs by taking advantage of our free 30-day trial. You can spin up an instance with just a few clicks!