Project gone bad...?!?

We have a self hosted Octopus cluster. We are on version 2021.3.8275. When we try to retrieve one project either in the UI or via the api we get this message



This ‘AWS Backup Jobs Status check’ seems to be related to a runbook that we added a few days ago. it isn’t the name of the runbook. however, looking in the database at the [RunbookProcess] table. I see this in the json
{
“Steps”: [
{
“Id”: “be16f6f5-7178-45a7-87d5-126a1b3581c0”,
“Name”: “AWS Backup Jobs Status check”,
“Condition”: “Success”,
“StartTrigger”: “StartAfterPrevious”,
“PackageRequirement”: “LetOctopusDecide”,

Which is the name of the first step in the runbook.
Executing this:
SELECT *
FROM [OctopusDeploy].[dbo].[RunbookProcess]
WHERE OwnerId = ‘Runbooks-2761’
ORDER BY Version DESC
I see this:


Is there a better way than manually updating the database to revert to version 68 to fix this issue?

A side effect of this is a lot of our automation is currently broken because it relies on /api/projects/all, which returns the same error as the api call above.

Hi Leslie,

Thank you for getting in touch, though I’m sorry to see it’s due to you encountering this annoying bug. Fortunately this looks like a known and open issue that I’ll link below.

TL;DR we’ve reproduced it via these steps:

  1. Have a deployment process with a package step
  2. Set the project versioning strategy to that step
  3. Create a runbook with a package step using the same package
  4. Update the name of the runbook step

We also did notice the side effect you mentioned with API calls failing. Does this sound like it lines up with your scenario? If it does, I’m hoping the following script which we were able to use as a workaround would also work in your case.

https://github.com/OctopusDeploy/SupportTools/blob/master/OctopusApi/ResetBrokenDeploymentSettings.ps1

Please let me know how you go!

Best regards,

Kenny

I get a 404 when I follow that link

Hi Leslie,

Oh shoot, my bad, it was located in a private repo which I didn’t notice. Sorry about that! I’ll paste it inline below.

# Create Script Variables
$octopusUrl = "https://OctopusURL"
$octopusAPIKey = "API-XXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
$header = @{ "X-Octopus-ApiKey" = $octopusAPIKey }

# Case Specific Variables | Customise Lifecycle Name and Project Group if necessary.
$spaceId = "Spaces-1"
$newProjectName = "Project_For_Template"
$newProjectDescription = "Project created for version template to fix broken references. Will be deleted after."
$projectGroupName = "Default Project Group"
$lifecycleName = "Default lifecycle"

# BROKEN PROJECT ID
$brokenProjectId = "Projects-XX"

# Get Project Group Id
$projectGroup = (Invoke-RestMethod -Method Get "$octopusURL/api/$($spaceId)/projectgroups/all" -Headers $header) | Where-Object {$_.Name -eq $projectGroupName}

# Get Lifecycle Id
$lifeCycle = (Invoke-RestMethod -Method Get "$octopusURL/api/$($spaceId)/lifecycles/all" -Headers $header) | Where-Object {$_.Name -eq $lifecycleName}

# JSON Payload for template project
$jsonPayload = @{
    Name = $newProjectName
    ProjectGroupId = $projectGroup.Id
    LifeCycleId = $lifeCycle.Id
}

# Create new project
$newProject = Invoke-RestMethod -Method Post -Uri "$octopusURL/api/$($spaceId)/projects" -Body ($jsonPayload | ConvertTo-Json -Depth 10) -Headers $header

# Gather deployment settings template
$depTemplate = Invoke-RestMethod -Method Get -Uri "$octopusURL$($newProject.Links.DeploymentSettings)" -Headers $header

# Copy and modify template to match broken project
$newDepSettings = $depTemplate
$newDepSettings.Id = $newDepSettings.Id.replace($newProject.Id, $brokenProjectId)
$newDepSettings.ProjectId = $newDepSettings.ProjectId.replace($newProject.Id, $brokenProjectId)

# Determine deployment settings URL for broken project
$newUrl = $newProject.Links.DeploymentSettings.replace($newProject.Id, $brokenProjectId)

# Upload newly created default deployment settings to broken project
Invoke-RestMethod -Method Put -Uri "$octopusURL$($newUrl)" -Headers $header -Body ($newDepSettings | ConvertTo-Json -Depth 10)

# Delete Template Project
Invoke-RestMethod -Method Delete -Uri "$octopusURL/api/$($spaceId)/projects/$($newProject.Id)" -Headers $header

Let me know how you go!

Best regards,

Kenny

That did the trick. Thank You

Hi Leslie,

Awesome to hear, thank you for confirming!

Let us know if we can try to help with anything else in the future.

Best regards,

Kenny

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