Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Octopus Deploy - Execute Script File

I have defined a process that consists of 2 steps:

  1. Deploy an IIS WebSite
  2. Execute a script file

The first step in the process executes without any issues. I am able to upload a nuget package to Octopus Server's built-in package repository and deploy this to my IIS Web Site.

For the second step in the process, where I am asked to specify a script file to run, I am unable to upload a sql file either using the built-in package repository or using a external package repository since Octopus will not allow me to upload a .sql file type.

What is the best way of specifying the SQL Script File to be run?

Should I package it along with my nuget package and then specify the script source to 'Script file inside a package' or is it possible to upload a SQL file to a repository (external or built-in) and specify that file as the SQL script file to execute?

Is there a best practice for this?

Thanks,

Sean

like image 270
Seán Avatar asked May 04 '26 14:05

Seán


1 Answers

By "Script file" or "Script file inside a package" Octopus means a Powershell script or Bash script. If you want to execute a SQL script as part of your deployment you have two options:

  1. Install an existing task from the Octopus Community Library (https://library.octopusdeploy.com/listing) that executes SQL. Here are two of them:

    • SQL - Execute Script - https://library.octopusdeploy.com/step-templates/73f89638-51d1-4fbb-b68f-b71ba9e86720/actiontemplate-sql-execute-script,
    • SQL - Execute Script File = https://library.octopusdeploy.com/step-templates/709b5872-52e2-4cd9-9ec0-b4a135a0444c/actiontemplate-sql-execute-script-file
  2. Create a Powershell or Bash script to execute your SQL script.

like image 63
Ben Richards Avatar answered May 06 '26 06:05

Ben Richards