Open IanAtPico opened 2 weeks ago
UPDATE: I've got this working.
In CreateDependencyTrackChildProject
, I changed the body for Invoke-RestMethod
from:
$body = (@{
name = $ProjectName
classifier = "APPLICATION"
active = [bool]::Parse('True')
author = ""
version = $version
parent = {
name = $OEM
uuid = $ParentUuid
active = [bool]::Parse('True')
}
} | ConvertTo-Json)
to:
$body = @"
{"name": "$ProjectName","classifier":"APPLICATION","active":true, "parent":{"uuid":"$ParentUuid"}}
"@
$response = Invoke-RestMethod -Uri $url -Method Put -Headers $headers -Body $body
Current Behavior
DependencyTrack 4.11.7
When I create, from PowerShell a DependencyTrack project, and then create a child project with the parent set to the first project's uuid, I get an error ""An inactive Parent cannot be selected as parent". I have checked, with breakpoints so I can check in the DependencyTrack UI that the parent project has been created, and that it is active. The answer is 'yes' to both. Previous instances of this error in the issues appear to be marked as closed.
The aim is to have a script that goes into our Azure DevOps pipeline, so that when we build we automatically get a SBoM in DependencyTrack. The reason for needing the project tree structure is so that we can have nested projects in DependencyTrack based on customer build, platform, main release etc.
I've searched the issues here and seen that you have to specify the project as active. I do. Same problem. I've also seen someone suggest using POST calls to set it inactive and then active. I do. Same problem. I've also done this using breakpoints, so that I can check the DependencyTrack UI to ensure that the data is correct.
The parent project is created exactly as I'd expect, however the child isn't. The parent is shown as active in the DependencyTrack UI.
Is this still a bug, or am I doing something wrong? I'm really not sure what to try next.
Here's my code to create the parent project:
Here's my code to toggle the active state of the project:
Here's my code to create the child project:
This is the raw error I get:
Invoke-RestMethod : An inactive Parent cannot be selected as parent
Steps to Reproduce
CreateDependencyTrackProject
- SUCCESSCreateDependencyTrackChildProject
function to create the child project - ERRORExpected Behavior
Child project to be created.
Dependency-Track Version
4.11.x
Dependency-Track Distribution
Container Image
Database Server
N/A
Database Server Version
No response
Browser
Google Chrome
Checklist