Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ jobs:
channel: ${{ steps.ReleaseNum.outputs.OCTOPUS_CHANNEL }}
release_number: ${{ steps.ReleaseNum.outputs.APP_VERSION }}
package_version: ${{ steps.ReleaseNum.outputs.APP_VERSION }}
git_ref: ${{ github.ref }}

- name: deploy release
uses: OctopusDeploy/deploy-release-action@v3
Expand Down
196 changes: 196 additions & 0 deletions .octopus/deployment_process.ocl
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
step "calculate-deployment-mode" {
name = "Calculate Deployment Mode"

action {
properties = {
Octopus.Action.RunOnServer = "true"
Octopus.Action.Template.Id = "ActionTemplates-5"
Octopus.Action.Template.Version = "5"
}
worker_pool_variable = ""
}
}

step "run-configure-sql-server-runbook" {
condition = "Variable"
name = "Run Configure SQL Server Runbook"
properties = {
Octopus.Step.ConditionVariableExpression = "#{unless Octopus.Deployment.Error}#{Octopus.Action[Calculate Deployment Mode].Output.RunOnDeploy}#{/unless}"
}

action {
properties = {
Octopus.Action.Template.Id = "ActionTemplates-4"
Octopus.Action.Template.Version = "17"
Run.Runbook.Api.Key = "#{Project.Runbook.Api.Key}"
Run.Runbook.AutoApproveManualInterventions = "No"
Run.Runbook.Base.Url = "#{Octopus.Web.ServerUri}"
Run.Runbook.CancelInSeconds = "1800"
Run.Runbook.CustomNotes.Toggle = "False"
Run.Runbook.DateTime = "N/A"
Run.Runbook.Environment.Name = "#{Octopus.Environment.Name}"
Run.Runbook.Machines = "N/A"
Run.Runbook.ManualIntervention.EnvironmentToUse = "#{Octopus.Environment.Name}"
Run.Runbook.Name = "Configure SQL Server"
Run.Runbook.Project.Name = "#{Octopus.Project.Name}"
Run.Runbook.Space.Name = "#{Octopus.Space.Name}"
Run.Runbook.UsePublishedSnapShot = "True"
Run.Runbook.Waitforfinish = "True"
}
worker_pool = "hosted-windows"
}
}

step "generate-what-if-report" {
condition = "Variable"
name = "Generate What If Report"
properties = {
Octopus.Step.ConditionVariableExpression = "#{unless Octopus.Deployment.Error}#{Octopus.Action[Calculate Deployment Mode].Output.RunOnDeploy}#{/unless}"
}

action {
properties = {
Database.Deploy.ConnectionString = "#{Project.Connection.String}"
Database.Deploy.Package = "{\"PackageId\":\"Trident.Database\",\"FeedId\":\"octopus-server-built-in\"}"
Database.Deploy.PathToDBUpExe = ".\\Octopus.Trident.Database.DbUp"
Database.Deploy.ReportPath = "#{Project.Database.Report.Path}"
Database.Deploy.WhatIf = "True"
Octopus.Action.Template.Id = "ActionTemplates-2"
Octopus.Action.Template.Version = "1"
}
worker_pool = "hosted-windows"

packages "Database.Deploy.Package" {
acquisition_location = "Server"
feed = "octopus-server-built-in"
package_id = "Trident.Database"
properties = {
Extract = "True"
PackageParameterName = "Database.Deploy.Package"
Purpose = ""
SelectionMode = "deferred"
}
}
}
}

step "dba-review-delta-script" {
condition = "Variable"
name = "DBA Review Delta Script"
properties = {
Octopus.Step.ConditionVariableExpression = "#{unless Octopus.Deployment.Error}#{Octopus.Action[Calculate Deployment Mode].Output.RunOnDeploy}#{/unless}"
}

action {
action_type = "Octopus.Manual"
environments = ["staging"]
properties = {
Octopus.Action.Manual.BlockConcurrentDeployments = "False"
Octopus.Action.Manual.Instructions = "Please review generated script."
Octopus.Action.Manual.ResponsibleTeamIds = "global/octopus-managers"
}
}
}

step "deploy-db-changes" {
condition = "Variable"
name = "Deploy DB Changes"
properties = {
Octopus.Step.ConditionVariableExpression = "#{unless Octopus.Deployment.Error}#{Octopus.Action[Calculate Deployment Mode].Output.RunOnDeploy}#{/unless}"
}

action {
properties = {
Database.Deploy.ConnectionString = "#{Project.Connection.String}"
Database.Deploy.Package = "{\"PackageId\":\"Trident.Database\",\"FeedId\":\"octopus-server-built-in\"}"
Database.Deploy.PathToDBUpExe = ".\\Octopus.Trident.Database.DbUp"
Database.Deploy.ReportPath = "#{Project.Database.Report.Path}"
Database.Deploy.WhatIf = "False"
Octopus.Action.Template.Id = "ActionTemplates-2"
Octopus.Action.Template.Version = "1"
}
worker_pool = "hosted-windows"

packages "Database.Deploy.Package" {
acquisition_location = "Server"
feed = "octopus-server-built-in"
package_id = "Trident.Database"
properties = {
Extract = "True"
PackageParameterName = "Database.Deploy.Package"
Purpose = ""
SelectionMode = "deferred"
}
}
}
}

step "deploy-trident-web-application" {
name = "Deploy Trident Web Application"
properties = {
Octopus.Action.TargetRoles = "trident-web"
}

action {
action_type = "Octopus.TentaclePackage"
properties = {
Octopus.Action.EnabledFeatures = "Octopus.Features.JsonConfigurationVariables"
Octopus.Action.Package.DownloadOnTentacle = "False"
Octopus.Action.Package.FeedId = "octopus-server-built-in"
Octopus.Action.Package.JsonConfigurationVariablesTargets = "appSettings.json"
Octopus.Action.Package.PackageId = "Trident.Web"
}
worker_pool_variable = ""

packages {
acquisition_location = "Server"
feed = "octopus-server-built-in"
package_id = "Trident.Web"
properties = {
SelectionMode = "immediate"
}
}
}
}

step "verify-application" {
name = "Verify Application"

action {
action_type = "Octopus.Script"
properties = {
Octopus.Action.Script.ScriptBody = "Write-Highlight \"The app has been successfully verified!\""
Octopus.Action.Script.ScriptSource = "Inline"
Octopus.Action.Script.Syntax = "PowerShell"
OctopusUseBundledTooling = "False"
}
worker_pool = "hosted-windows"
}
}

step "notify-team-of-deployment-status" {
condition = "Always"
name = "Notify team of deployment status"
properties = {
Octopus.Action.TargetRoles = "trident-web"
}

action {
properties = {
Octopus.Action.RunOnServer = "false"
Octopus.Action.Template.Id = "ActionTemplates-1"
Octopus.Action.Template.Version = "2"
PowerAutomatePostAdaptiveCard.BodyColor = "default"
PowerAutomatePostAdaptiveCard.ButtonTitle = "See deployment"
PowerAutomatePostAdaptiveCard.ButtonUrl = "#{Octopus.Web.ServerUri}/app#/#{Octopus.Space.Id}/tasks/#{Octopus.Task.Id}"
PowerAutomatePostAdaptiveCard.HookUrl = "#{Notification.Slack.Webhook.Url}"
PowerAutomatePostAdaptiveCard.RetryCount = "1"
PowerAutomatePostAdaptiveCard.RetryDelay = "100"
PowerAutomatePostAdaptiveCard.RetryPosting = "False"
PowerAutomatePostAdaptiveCard.Timeout = "60"
PowerAutomatePostAdaptiveCard.Title = "#{Notification.Subject.Text}"
PowerAutomatePostAdaptiveCard.TitleColor = "accent"
}
worker_pool_variable = ""
}
}
9 changes: 9 additions & 0 deletions .octopus/deployment_settings.ocl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
default_guided_failure_mode = "On"

connectivity_policy {
allow_deployments_to_no_targets = true
}

versioning_strategy {
template = "#{Octopus.Version.LastMajor}.#{Octopus.Version.LastMinor}.#{Octopus.Version.NextPatch}"
}
47 changes: 47 additions & 0 deletions .octopus/runbooks/configure-sql-server.ocl
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name = "Configure SQL Server"
default_guided_failure_mode = "EnvironmentDefault"
description = ""

connectivity_policy {
allow_deployments_to_no_targets = true
}

run_retention_policy {
quantity_to_keep = 100
}

process {
step "install-sql-server" {
name = "Install SQL Server"

action {
action_type = "Octopus.Script"
properties = {
Octopus.Action.Script.ScriptBody = <<-EOT
Write-Host "Installing SQL Server Localdb"
choco install sqllocaldb -y
EOT
Octopus.Action.Script.ScriptSource = "Inline"
Octopus.Action.Script.Syntax = "PowerShell"
OctopusUseBundledTooling = "False"
}
worker_pool = "hosted-windows"
}
}

step "sql-create-database-if-not-exists" {
name = "SQL - Create Database If Not Exists"

action {
properties = {
createCommandTimeout = "30"
createDatabaseName = "#{Project.Database.Name}"
createSqlDatabaseRetryAttempts = "0"
createSqlServer = "#{Project.Database.Server.Name}"
Octopus.Action.Template.Id = "ActionTemplates-3"
Octopus.Action.Template.Version = "5"
}
worker_pool = "hosted-windows"
}
}
}
1 change: 1 addition & 0 deletions .octopus/schema_version.ocl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version = 9
33 changes: 33 additions & 0 deletions .octopus/variables.ocl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
variable "ConnectionStrings:Database" {
value "#{Project.Connection.String}" {}
}

variable "Project.Connection.String" {
value "Server=#{Project.Database.Server.Name};Integrated Security=true;Database=#{Project.Database.Name}" {}
}

variable "Project.Database.Name" {
value "Trident" {
environment = ["production"]
}

value "Trident_Development" {
environment = ["development"]
}

value "Trident_Staging" {
environment = ["staging"]
}

value "Trident_Test" {
environment = ["test"]
}
}

variable "Project.Database.Report.Path" {
value "C:\\DatabaseReports\\\\#{Octopus.Environment.Name}" {}
}

variable "Project.Database.Server.Name" {
value "(localdb)\\MSSQLLocalDB" {}
}
Loading