Issues with Jenkins and Redgate Deployment to Octopus

Hi, I have a RedGate Deployment that is having issues. Below you’ll see a reference to “Jira: Username/password not configured” I’m not using Jira in this instance.
I see the nuget package in the package manager, but can’t get past this error.
Thank you for any assistance.
Harlan Stanley

Detected automation environment: “Jenkins”
Found space: Default (Spaces-1)
Space name specified, process is now running in the context of space: Default
Handshaking with Octopus Server: http://octopus.companyname.local
GET http://octopus.companyname.local/api
Handshake successful. Octopus version: 2022.3.10828; API version: 3.0.0
GET http://octopus.companyname.local/api/Spaces-1
GET http://octopus.companyname.local/api/users/me
Authenticated as: Jenkins (a service account)
GET http://octopus.companyname.local/api/Spaces-1/environments?name=DEV
Found environment: DEV (Environments-1)
This Octopus Server supports channels
GET http://octopus.companyname.local/api/Spaces-1/projects?name=RedGateDB
Found project: RedGateDB (Projects-121)
Automatically selecting the best channel for this release…
GET http://octopus.companyname.local/api/Spaces-1/projects/Projects-121/channels
Building a release plan for Channel ‘Default’…
Finding deployment process…
GET http://octopus.companyname.local/api/Spaces-1/deploymentprocesses/deploymentprocess-Projects-121
Finding release template…
GET http://octopus.companyname.local/api/Spaces-1/projects/Projects-121/deploymentprocesses/template?channel=Channels-121
Selected the release plan for Channel ‘Default’ - it is a perfect match
Using version number provided on command-line: 0.2023.27.1
Release plan for RedGateDB 0.2023.27.1
Channel: ‘Default’ (this is the default channel)

Name Version Source Version rules


1 Deploy a Package 0.2023.27.1 User specified Allow any version

Creating release…
GET http://octopus.companyname.local/api/Spaces-1/projects/Projects-121/deploymentsettings
POST http://octopus.companyname.local/api/Spaces-1/releases?ignoreChannelRules=False
There was a problem with your request.

  • Jira: Username/password not configured

Error from Octopus Server (HTTP 400 BadRequest)
Exit code: -7
INFO: Octopus CLI exit code: -7
ERROR: Unable to create or deploy release. Please check the build log for details on the error.
Build step ‘Octopus Deploy: Create Release’ changed build result to FAILURE
[ATLASSIAN CLOUD PLUGIN] [WARN] Not a WorkflowRun, onCompleted() won’t be propagated to listeners
Finished: FAILURE

Hi Harlan,

Thank you for reaching out, and welcome to the Octopus Deploy community forum!

I’m sorry you are having trouble with your Redgate build/deployment process from Jenkins to Octopus Deploy, but I would be happy to help take a closer look at things.

As an initial step, could you upload the complete build log from Jenkins for me to review? Here is a secure link where you can upload this, so you don’t have to post it to the community forum. Can you also let me know if this process has worked in the past, and if it has, when it started failing (if you know)?

Outside of the build log, can you let me know if you can manually create and deploy a release for this project via the Octopus Deploy web UI, or does this also fail? Feel free to upload any supporting logs/screenshots from this test.

I know you mentioned not using JIRA in this instance, but can you clarify if you mean you are not using JIRA across this Octopus Deploy server or just this particular project? You should be able to check the settings for this integration on your Octopus Deploy server by navigating to Configuration > Settings > Jira Integration via the server web UI - I recommend checking these values to ensure they are set as expected for your Octopus Deploy instance, as you should be able to safely disable this integration if you aren’t using it at all. I’ll also link our baseline configuration documentation for this integration for your review, in case it helps in highlighting where this issue is stemming from:

Also, I did find an issue on our side that seems to line up with the behavior you’re experiencing (a bad request from JIRA causing release creation failure in Octopus Deploy), but this wouldn’t explain why you are seeing the JIRA message in the first place if you don’t intend to use this integration.

I hope this initial information helps investigate things further, but let me know what you find out, and I would be glad to assist further if needed.

Regards,

Britton

uploaded, thanks!

I am not using any Jira plugins, have them disabled. I don’t know if the Octopus plugin is causing the error, but this seems to be the case?

I did have Jira Integration enabled on Octopus, as you suggested. I have since turned it off and will attempt the build again.

ok disabling the Jira integration on the Octopus server worked! Now I’m presented with the following message on the Octopus server:

The step failed: Activity Deploy a Package on Redgate failed with error ‘The remote script failed with exit code 1’.

Redgate

Ran for 20 seconds

July 6th 2023 12:03:19

Info

Deploying package: C:\Octopus\Files\RedGateDB@S0.2023.27.1@DE231853C7DD8F4FB9D535EB6CAB1EA0.nupkg

July 6th 2023 12:03:29

Error

InvalidOperation: You cannot call a method on a null-valued expression.

July 6th 2023 12:03:29

Error

At C:\Octopus\Applications\DEV\RedGateDB\0.2023.27.1\Octopus.Features.RedGateDatabase_BeforePostDeploy.ps1:20 char:1

July 6th 2023 12:03:29

Error

  • $connectionArray = $connectionStrings.Split(“`n”)

July 6th 2023 12:03:29

Error

  • 
    

July 6th 2023 12:03:29

Error

at , C:\Octopus\Applications\DEV\RedGateDB\0.2023.27.1\Octopus.Features.RedGateDatabase_BeforePostDeploy.ps1: line 20

July 6th 2023 12:03:29

Error

at , : line 1

July 6th 2023 12:03:29

Error

at , C:\Octopus\Applications\DEV\RedGateDB\0.2023.27.1\Octopus.FunctionAppenderContext.ps1: line 211

July 6th 2023 12:03:29

Error

at , C:\Octopus\Applications\DEV\RedGateDB\0.2023.27.1\Bootstrap.Octopus.FunctionAppenderContext.ps1: line 3090

July 6th 2023 12:03:29

Error

at , : line 1

July 6th 2023 12:03:29

Error

at , : line 1

July 6th 2023 12:03:29

Error

Running rollback conventions…

July 6th 2023 12:03:29

Error

Script ‘C:\Octopus\Applications\DEV\RedGateDB\0.2023.27.1\Octopus.Features.RedGateDatabase_BeforePostDeploy.ps1’ returned non-zero exit code: 1

July 6th 2023 12:03:29

Fatal

The remote script failed with exit code 1

July 6th 2023 12:03:29

Fatal

The action Deploy a Package on Redgate failed

Hi Harlan,

Thank you for the updates, and I’m happy to hear you were able to make some progress on things!

In taking a look at the latest output, it looks like the script being referenced from Octopus.Features.RedGateDatabase_BeforePostDeploy.ps1 is returning a non-zero exit code, which is causing the deployment to fail:

July 6th 2023 12:03:29   Error
Script ‘C:\Octopus\Applications\DEV\RedGateDB\0.2023.27.1\Octopus.Features.RedGateDatabase_BeforePostDeploy.ps1’ returned non-zero exit code: 1

July 6th 2023 12:03:29   Fatal   The remote script failed with exit code 1

And in taking a deeper dive into the log, it looks like this issue is happening on line 20 of the script:

At C:\Octopus\Applications\DEV\RedGateDB\0.2023.27.1\Octopus.Features.RedGateDatabase_BeforePostDeploy.ps1:20 char:1

Which corresponds to the following code in the log output:

Error
$connectionArray = $connectionStrings.Split(“`n”)

Based on this, it looks like there may be a problem within the BeforePostDeploy.ps1 script in your process - can you let me know if you are using a custom script in your deployment process?

If so, for this, you might pull the script out and manually walk through things to ensure things are populating as expected, or alternatively, add error handling (i.e., Try…Catch blocks, Write-Output statements, etc.) to see what all gets outputted at each step along the way within Octopus Deploy.

Outside of this, we do have a good baseline blog post on this functionality that could be useful in validating your configuration at a higher level, and this blog post also links out to an example process on our samples site that you can review in real-time.

I hope this additional information helps, but let me know if I can be of any more assistance after reviewing the information I’ve provided above.

Regards,

Britton

Hmm I see the folder, but I don’t see the .ps1 file in there, only see AutomationMetaData.json

C:\Octopus\Applications\DEV\RedGateDB\0.2023.27.1_1\Octopus.Features.RedGateDatabase_BeforePostDeploy.ps1:

This is on the Redgate server

Hi Harlan,

Thank you for the update regarding the investigation on your side!

I was able to dive into this a little more, and it appears that the script where your process is erroring out is happening within the built-in Redgate deployment script for this particular step template (and not within a custom script, as I had originally asked about), which you can see within our GitHub Calamari repository at the following link:

In taking a look at the script, it appears that the $connectionArray variable is populated via the $connectionStrings variable, which is instantiated on line 11 based on the Octopus Deploy parameter "Octopus.Action.RedGateDatabase.ConnectionStrings".

Based on this and your log output, it seems like something isn’t connecting quite right in the background for this variable evaluation.

With this being the case, could you temporarily enable variable debugging for this deployment process, create a new release based on these new variables, and then upload the resulting debug task log to the same secure link I provided previously? Enabling variable debugging for a deployment process will force all variables to be printed to the task log, which can sometimes make identifying issues such as this easier. I attached some documentation on this process above, but let me know if you run into any trouble.

Here is that secure upload link again as well, for your convenience:

Octopus Deploy Support Files | Secure Upload Link

Regards, and looking forward to hearing back from you,

Britton

Ok I’ made it a little further today, uploaded a log, but here’s the meat of the problem:
Path: C:\Octopus\Files\RedGateDB\Projects-144\0.2023.27.12\RedGateDB

July 7th 2023 13:01:32

Error

ObjectNotFound: The specified path either doesn’t exist or can’t be accessed by the current Windows account: ‘C:\Octopus\Files\RedGateDB\Projects-144\0.2023.27.12\RedGateDB’

July 7th 2023 13:01:32

Error

At C:\Octopus\Work\20230707175633-15888-208\Script.ps1:361 char:1

Hi Harlan,

Thank you for the update, and I’m glad you were able to make some more progress against this issue!

In taking a look at the new logs, I’m wondering if this error has to do with this Export Path value within the Redgate step template:

Can you let me know if anything is populated within this field in your step?

I also noticed our blog mentions the following about this field:

Project.Redgate.ExportPath: Where the tooling will create and export the database release to. Because this process uses workers, you need to save the files to a file share (or have one worker).

And also the message on the field itself:

The path that the database deployment resources will be exported to.

This path is used in the "Redgate - Deploy from Database Release" step, and must be accessible to all tentacles used in database deployment steps.

So from this, it looks like the location specified here should be accessible to all Tentacles/Workers in your Redgate deployment process, and this value also feeds into other steps as an input variable.

I hope this additional information helps in tracking down the issue, but if not, feel free to upload your complete deployment process JSON to that same secure link, and I would be happy to look over it for anything that looks relevant to this problem.

Best,

Britton

C:\Octopus\Applications#{Octopus.Environment.Name}#{Octopus.Project.Name}

the above is the path set on the export path. This path is on the Redgate server and is also where the Tentacle is located.
I’ll see if I can figure out how to export our config to JSON
Thank you very much for your help!

2 Likes

I am uploading the JSON config now.
the prior snip C:\Octopus\Applications#{Octopus.Environment.Name}#{Octopus.Project.Name} should map out to C:\Octopus\Applications\DEV\RedGateDb\ but it does not for some reason… I don’t know how “Project -144” gets in there

I did enable all the steps, but I don’t believe that they are all needed - unsure.

Hi Harlan,

Thanks for uploading the JSON for me to review!

In taking a look, I noticed that Step 3 (Redgate - Create Database Release) looks to be referencing Step 1 for its database package location (Transfer a Package), while Step 4 (Redgate - Deploy from Database Release) is referencing Step 2 for its database package location (Deploy a Package) - is this the expected configuration for these sections?

From my initial read of the new file, it seems like you might be getting that pathing (with Projects-144) from the default package installation location in Step 2 (Deploy a Package), but let me know what you find out in investigating this more on your side.

Regards,

Britton

Hi, I got it to work. I created a complete end to end document it you would like to see how we got it working, with screenshots too!

1 Like

Hi Harlan,

That’s awesome to hear - I’m glad you were able to get things up and running on your side! :smile:

Regarding sharing your documentation, yes, that sounds great! If it doesn’t contain your company/personal information, you could share it here on the forum so it can help other users that come across similar problems (if you’d like).

Thanks again for working with me on investigating the issue further, and I’m happy things are working as expected for you now.

Regards,

Britton

Here’s my full write up on how to configure change automation with Octopus, RedGate and Bitbucket.
DB Change Automation Upload.pdf (6.3 MB)

2 Likes

Hey @harlanstanley,

I know some of us have hearted your comment but I just wanted to come on and personally thank you for sharing that write up. That will not only help us to support our customers but it will also allow customers to come on here and view it for themselves!

We love it when our fellow Octopus users come on here and give each other help so thank you very much for providing that user guide!

If there is anything else you need in future please reach out as we are always here to help!

Kind Regards,
Clare

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.