blackducksoftware / hub-rest-api-python

HUB REST API Python bindings
Apache License 2.0
89 stars 104 forks source link

How to submit multiple tags? Results in 412 Precondition Failed #224

Closed marcellodesales closed 1 year ago

marcellodesales commented 1 year ago

I'd like to submit a new scan and tag the project scan with different tags at every scan as part of our CI/CD pipeline... We need to inform current versions and env where the version is intended to be deployed, among other tags...

I'm using tags to try to differentiate scans from multiple branches as part of the limitation on the number of versions to be submitted... Developers need to know if they have actually fixed a bug or not according to the reports...

- --detect.project.tags=branch=feature/upgrade-component,pip-version=1.2.3,env=staging,segment=DevSecOps

This call fails with the following:

devsecops-client-blackduck-sca  | 2022-10-13 14:00:53 PDT ERROR [main] --- Detect run failed.
devsecops-client-blackduck-sca  | 2022-10-13 14:00:53 PDT ERROR [main] --- An unrecoverable error occurred - most likely this is due to your environment and/or configuration. Please double check the Detect documentation: https://detect.synopsys.com/doc/
devsecops-client-blackduck-sca  | 2022-10-13 14:00:53 PDT ERROR [main] --- Input string is not valid. [HTTP Error]: There was a problem trying to POST https://blackduck.company.com/api/projects/2e996f01-b5b0-4854-abb8-93875d951bf0/tags, response was 412 Precondition Failed.
devsecops-client-blackduck-sca  | 2022-10-13 14:00:53 PDT DEBUG [main] --- {core.validation.pattern}
devsecops-client-blackduck-sca  | 2022-10-13 14:00:53 PDT ERROR [main] --- There was a problem trying to POST https://blackduck.company.com/api/projects/2e996f01-b5b0-4854-abb8-93875d951bf0/tags, response was 412 Precondition Failed.
devsecops-client-blackduck-sca  | 2022-10-13 14:00:53 PDT DEBUG [main] --- An exception was thrown during the detect run.
devsecops-client-blackduck-sca  | 
devsecops-client-blackduck-sca  | com.synopsys.integration.detect.lifecycle.OperationException: com.synopsys.integration.blackduck.exception.BlackDuckApiException: Input string is not valid. [HTTP Error]: There was a problem trying to POST https://blackduck.company.com/api/projects/2e996f01-b5b0-4854-abb8-93875d951bf0/tags, response was 412 Precondition Failed.
devsecops-client-blackduck-sca  |       at com.synopsys.integration.detect.lifecycle.run.step.utility.OperationWrapper.wrapped(OperationWrapper.java:46) ~[classes!/:na]
devsecops-client-blackduck-sca  |       at com.synopsys.integration.detect.lifecycle.run.step.utility.OperationWrapper.wrapped(OperationWrapper.java:20) ~[classes!/:na]
devsecops-client-blackduck-sca  |       at com.synopsys.integration.detect.lifecycle.run.step.utility.OperationWrapper.wrapped(OperationWrapper.java:13) ~[classes!/:na]
devsecops-client-blackduck-sca  |       at com.synopsys.integration.detect.lifecycle.run.step.utility.OperationAuditLog.namedInternal(OperationAuditLog.java:44) ~[classes!/:na]
devsecops-client-blackduck-sca  |       at com.synopsys.integration.detect.lifecycle.run.step.utility.OperationAuditLog.namedInternal(OperationAuditLog.java:39) ~[classes!/:na]
devsecops-client-blackduck-sca  |       at com.synopsys.integration.detect.lifecycle.run.operation.OperationFactory.addTags(OperationFactory.java:968) ~[classes!/:na]
devsecops-client-blackduck-sca  |       at com.synopsys.integration.detect.lifecycle.run.step.BlackDuckProjectVersionStepRunner.runAll(BlackDuckProjectVersionStepRunner.java:74) ~[classes!/:na]
devsecops-client-blackduck-sca  |       at com.synopsys.integration.detect.lifecycle.run.step.IntelligentModeStepRunner.lambda$runOnline$3(IntelligentModeStepRunner.java:84) ~[classes!/:na]
devsecops-client-blackduck-sca  |       at com.synopsys.integration.detect.lifecycle.run.step.utility.OperationWrapper.wrapped(OperationWrapper.java:29) ~[classes!/:na]
devsecops-client-blackduck-sca  |       at com.synopsys.integration.detect.lifecycle.run.step.utility.OperationWrapper.wrapped(OperationWrapper.java:20) ~[classes!/:na]
devsecops-client-blackduck-sca  |       at com.synopsys.integration.detect.lifecycle.run.step.utility.StepHelper.runAsGroup(StepHelper.java:84) ~[classes!/:na]
devsecops-client-blackduck-sca  |       at com.synopsys.integration.detect.lifecycle.run.step.IntelligentModeStepRunner.runOnline(IntelligentModeStepRunner.java:81) ~[classes!/:na]
devsecops-client-blackduck-sca  |       at com.synopsys.integration.detect.lifecycle.run.DetectRun.run(DetectRun.java:75) ~[classes!/:na]
devsecops-client-blackduck-sca  |       at com.synopsys.integration.detect.Application.runApplication(Application.java:193) ~[classes!/:na]
devsecops-client-blackduck-sca  |       at com.synopsys.integration.detect.Application.run(Application.java:126) ~[classes!/:na]
devsecops-client-blackduck-sca  |       at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:773) ~[spring-boot-2.6.8.jar!/:2.6.8]
devsecops-client-blackduck-sca  |       at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:763) ~[spring-boot-2.6.8.jar!/:2.6.8]
devsecops-client-blackduck-sca  |       at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) ~[spring-boot-2.6.8.jar!/:2.6.8]
devsecops-client-blackduck-sca  |       at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:164) ~[spring-boot-2.6.8.jar!/:2.6.8]
devsecops-client-blackduck-sca  |       at com.synopsys.integration.detect.Application.main(Application.java:81) ~[classes!/:na]
devsecops-client-blackduck-sca  |       at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
devsecops-client-blackduck-sca  |       at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
devsecops-client-blackduck-sca  |       at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
devsecops-client-blackduck-sca  |       at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
devsecops-client-blackduck-sca  |       at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) ~[synopsys-detect-7.14.0.jar:na]
devsecops-client-blackduck-sca  |       at org.springframework.boot.loader.Launcher.launch(Launcher.java:108) ~[synopsys-detect-7.14.0.jar:na]
devsecops-client-blackduck-sca  |       at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) ~[synopsys-detect-7.14.0.jar:na]
devsecops-client-blackduck-sca  |       at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88) ~[synopsys-detect-7.14.0.jar:na]
devsecops-client-blackduck-sca  | Caused by: com.synopsys.integration.blackduck.exception.BlackDuckApiException: Input string is not valid. [HTTP Error]: There was a problem trying to POST https://blackduck.company.com/api/projects/2e996f01-b5b0-4854-abb8-93875d951bf0/tags, response was 412 Precondition Failed.

❓ What's the actual format allowed?

OffBy0x01 commented 1 year ago

This repo is specifically for the python API client, I suggest you reach out to Synopsys support directly. You can raise a ticket via community.synopsys.com

Aniketvaidhya commented 8 months ago

Hello @marcellodesales

Did you get the resolution for the above problem? Recently I am also facing the similar problem with my repository. Let me know if you are able to solve the issue.

marcellodesales commented 8 months ago

@Aniketvaidhya :) Yes, I switched to Dependabot

Aniketvaidhya commented 8 months ago

@marcellodesales Ok, thanks!

Since, we use aws code commit, I think this is not the expected solution for me.

OffBy0x01 commented 8 months ago

As I suggested before, you should really reach our to synopsys support for anything product related.

This repo is for the community built & supported python client, nothing else.

On Mon, 11 Dec 2023, 07:49 Aniketvaidhya, @.***> wrote:

@marcellodesales https://github.com/marcellodesales Ok, thanks!

Since, we use aws code commit, I think this is not the expected solution for me.

— Reply to this email directly, view it on GitHub https://github.com/blackducksoftware/hub-rest-api-python/issues/224#issuecomment-1849490969, or unsubscribe https://github.com/notifications/unsubscribe-auth/AETT4XJB3TBQQLHZMPGWM5TYI23IRAVCNFSM6AAAAAAREVGEKWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNBZGQ4TAOJWHE . You are receiving this because you modified the open/close state.Message ID: @.*** com>

Aniketvaidhya commented 8 months ago

Hello

I have found the root cause of the issue. The issue was due to the compatibility between the sigma versions and the detect version. I was using the latest sigma version which was not compatible. I am now using the sigma 2022.6.0 version, which has resolved the issue!