Skip to content

Commit 7cf6cca

Browse files
authored
Improve dependency tree for poetry in non-workspace mode (#1817)
* Improve dependency tree for poetry in non-workspace mode Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com> * Improve dependency tree for poetry in non-workspace mode Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com> * Improve dependency tree for poetry in non-workspace mode Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com> --------- Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
1 parent 9baea84 commit 7cf6cca

File tree

5 files changed

+197
-190
lines changed

5 files changed

+197
-190
lines changed

.github/workflows/image-build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ jobs:
8383
labels: ${{ steps.cdxgen-metadata.outputs.labels }}
8484
- name: Build and push Docker cdxgen-image for tag
8585
uses: docker/build-push-action@v5
86-
if: ${{ startsWith(github.ref, 'refs/tags/') && ! fromJSON(inputs.image).cdxgen-image.skip-tags }}
86+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
8787
with:
8888
context: .
8989
file: ci/base-images/cdxgen/${{ fromJSON(inputs.image).distro }}/Dockerfile.${{ fromJSON(inputs.image).lang }}
@@ -121,7 +121,7 @@ jobs:
121121
oras discover --format tree ${{ fromJSON(steps.cdxgen-metadata.outputs.json).tags[0] }}
122122
node bin/verify.js -i ${{ fromJSON(steps.cdxgen-metadata.outputs.json).tags[0] }} --public-key contrib/bom-signer/public.key
123123
continue-on-error: true
124-
if: ${{ startsWith(github.ref, 'refs/tags/') && ! fromJSON(inputs.image).cdxgen-image.skip-tags }}
124+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
125125
env:
126126
SBOM_SIGN_ALGORITHM: RS512
127127
SBOM_SIGN_PRIVATE_KEY: ${{ github.workspace }}/private.key

ci/base-images/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Below table summarizes all available container image versions. These images incl
3535
| Ruby | 1.8.x | ghcr.io/cyclonedx/debian-ruby18:master | Base image for `bundle install` only. No cdxgen equivalent with Ruby 1.8.x. `--deep` mode and research profile unsupported. |
3636
| Swift | 6.0.x | ghcr.io/cyclonedx/cdxgen-debian-swift:v11 |
3737
| golang | 1.24 | ghcr.io/cyclonedx/cdxgen-debian-golang124:v11, ghcr.io/cyclonedx/cdxgen-debian-golang:v11 | Golang 1.24 |
38-
| golang | 1.23 | ghcr.io/cyclonedx/cdxgen-debian-golang123:v11 | Golang 1.23
38+
| golang | 1.23 | ghcr.io/cyclonedx/cdxgen-debian-golang123:v11 | Golang 1.23 |
3939

4040
Replace `:v11` with a release version tag or sha256 hash for fine-grained control over the image tag.
4141

lib/helpers/utils.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5029,6 +5029,7 @@ export async function parsePyLockData(lockData, lockFile, pyProjectFile) {
50295029
let parentComponent;
50305030
let workspacePaths;
50315031
let workspaceWarningShown = false;
5032+
let hasWorkspaces = false;
50325033
// Keep track of any workspace components to be added to the parent component
50335034
const workspaceComponentMap = {};
50345035
const workspacePyProjMap = {};
@@ -5053,6 +5054,9 @@ export async function parsePyLockData(lockData, lockFile, pyProjectFile) {
50535054
parentComponent = pyProjMap.parentComponent;
50545055
workspacePaths = pyProjMap.workspacePaths;
50555056
if (workspacePaths?.length) {
5057+
if (!hasWorkspaces) {
5058+
hasWorkspaces = true;
5059+
}
50565060
// Parent component is going to have children
50575061
parentComponent.components = [];
50585062
for (const awpath of workspacePaths) {
@@ -5136,6 +5140,9 @@ export async function parsePyLockData(lockData, lockFile, pyProjectFile) {
51365140
// Check for workspaces
51375141
if (lockTomlObj?.manifest?.members) {
51385142
const workspaceMembers = lockTomlObj.manifest.members;
5143+
if (workspaceMembers && !hasWorkspaces) {
5144+
hasWorkspaces = true;
5145+
}
51395146
for (const amember of workspaceMembers) {
51405147
if (amember === parentComponent.name) {
51415148
continue;
@@ -5286,7 +5293,7 @@ export async function parsePyLockData(lockData, lockFile, pyProjectFile) {
52865293
}
52875294
if (
52885295
directDepsKeys[pkg.name] ||
5289-
!Object.keys(workspaceComponentMap).length
5296+
(hasWorkspaces && !Object.keys(workspaceComponentMap).length)
52905297
) {
52915298
rootList.push(pkg);
52925299
}

0 commit comments

Comments
 (0)