jfrog / jfrog-cli

JFrog CLI is a client that provides a simple interface that automates access to the JFrog products.
https://www.jfrog.com/confluence/display/CLI/JFrog+CLI
Apache License 2.0
520 stars 223 forks source link

publish build failing with "Could not insert build BuildWrapper" randomly #2129

Open Pymann opened 11 months ago

Pymann commented 11 months ago

Describe the bug

The answer of REST-API gives every information: cli version and what has be done

{

[2023-08-11T04:39:21.465Z] "errors": [

[2023-08-11T04:39:21.465Z] {

[2023-08-11T04:39:21.465Z] "status": 400,

[2023-08-11T04:39:21.465Z] "message": "Could not insert build BuildWrapper(build=Build{version='1.0.1', name='jenkins-EOX6-frontend-PullRequest', number='188', buildAgent=GENERIC/1.54.0, agent=jfrog-cli-go/1.54.0, started='2023-08-11T04:39:19.476+0000', durationMillis=0, principal='null', artifactoryPrincipal='rbg-jenkins-flash', artifactoryPluginVersion='null', url='null', parentName='null', parentNumber='null', vcs='[revision='6f0f33b46f3b5c9d6651d6afdb67110b522f4bd5', commit message=Add 'general/' from commit 'f7a92f517e4fdaa2f29b6bed9d550748e1250ce8'\n\ngit-subtree-dir: general\ngit-subtree-mainline: 652675c9ab1c5edd4c918171efee0f7be993dec1\ngit-subtree-split: f7a92f517e4fdaa2f29b6bed9d550748e1250ce8', branch='', url='https://production.github.bshg.com/EOX6/frontend.git']', parentBuildId='null', buildRetention=null, runParameters=null, modules=[org.jfrog.build.api.Module@9944b3be], statuses=null, buildDependencies=null, issues=null}, buildRepo=artifactory-build-info)"

[2023-08-11T04:39:21.465Z] }

[2023-08-11T04:39:21.465Z] ]

[2023-08-11T04:39:21.465Z] }

Current behavior

The build is tried to be published, but API answers with 400. I have hundreads of builds using same commandline/code and it never fails. But for one build it does randomly with this error received.

Reproduction steps

I dont know how to reproduce a random error. I normaly do like this:

        jfrog_bce_cmd = (
            f'{jfrog_bin} rt bce {build_name} {os.getenv("BUILD_NUMBER", "1")}'
        )
        if int(self.execute_cmd(jfrog_bce_cmd)) != 0:
            print(f"Error: jfrog collecting env failed {build_name}")
            return False
        jfrog_bag_cmd = (
            f'{jfrog_bin} rt bag {build_name} {os.getenv("BUILD_NUMBER", "1")}'
        )
        if int(self.execute_cmd(jfrog_bag_cmd)) != 0:
            print(f"Error: jfrog collecting git failed {build_name}")
            return False
        jfrog_bp_cmd = f'{jfrog_bin} rt bp --apikey {os.getenv("JFROG_TOKEN", "NoToken")} --url {self.jfrog_url} \
        {build_name} {os.getenv("BUILD_NUMBER", "1")}'
        if int(self.execute_cmd(jfrog_bp_cmd)) != 0:
            print(f"Error: jfrog publish build failed {build_name}")
            return False
        print(f"Uploading: {pkg_path} -> {self.jfrog_url}/{up_path}")
        jfrog_u_cmd = f'{jfrog_bin} rt u --apikey {os.getenv("JFROG_TOKEN", "NoToken")} --url {self.jfrog_url} \
        --build-name {build_name} --build-number {os.getenv("BUILD_NUMBER", "1")} \
        --target-props JENKINS_AGENT_NAME={os.getenv("PL_AGENT", "LocalBuild")};JENKINS_URL={os.getenv("JENKINS_URL", "LocalBuild")};BUILD_TAG={os.getenv("BUILD_TAG", "LocalBuild")} \
        {pkg_path} {up_path}'

Expected behavior

Publish the build

JFrog CLI version

jfrog-cli-go/1.54.0

Operating system type and version

ubuntu 20.04

JFrog Artifactory version

maybe this one: Enterprise Plus 7.39.4 rev

JFrog Xray version

cant find.

Pymann commented 10 months ago

tried jfrog v2, same problem:

[2023-08-30T06:10:06.672Z] {

[2023-08-30T06:10:06.672Z] "errors": [

[2023-08-30T06:10:06.672Z] {

[2023-08-30T06:10:06.672Z] "status": 400,

[2023-08-30T06:10:06.672Z] "message": "Could not insert build BuildWrapper(build=Build{version='1.0.1', name='jenkins-EOX6-frontend-PR2', number='1', buildAgent=GENERIC/2.46.2, agent=jfrog-cli-go/2.46.2, started='2023-08-30T06:10:04.960+0000', durationMillis=0, principal='null', artifactoryPrincipal='rbg-jenkins-flash', artifactoryPluginVersion='null', url='null', parentName='null', parentNumber='null', vcs='[revision='d571b72aa42fe18513e1147daaed78bca5372809', commit message=Add 'general/' from commit 'f7a92f517e4fdaa2f29b6bed9d550748e1250ce8'\n\ngit-subtree-dir: general\ngit-subtree-mainline: 22469a96b9409abaeaaaea0470ec193b72e9429c\ngit-subtree-split: f7a92f517e4fdaa2f29b6bed9d550748e1250ce8', branch='', url='https://production.github.bshg.com/EOX6/frontend.git', revision='d571b72aa42fe18513e1147daaed78bca5372809', commit message=Add 'general/' from commit 'f7a92f517e4fdaa2f29b6bed9d550748e1250ce8'\n\ngit-subtree-dir: general\ngit-subtree-mainline: 22469a96b9409abaeaaaea0470ec193b72e9429c\ngit-subtree-split: f7a92f517e4fdaa2f29b6bed9d550748e1250ce8', branch='', url='https://production.github.bshg.com/EOX6/frontend.git', revision='d571b72aa42fe18513e1147daaed78bca5372809', commit message=Add 'general/' from commit 'f7a92f517e4fdaa2f29b6bed9d550748e1250ce8'\n\ngit-subtree-dir: general\ngit-subtree-mainline: 22469a96b9409abaeaaaea0470ec193b72e9429c\ngit-subtree-split: f7a92f517e4fdaa2f29b6bed9d550748e1250ce8', branch='', url='https://production.github.bshg.com/EOX6/frontend.git', revision='d571b72aa42fe18513e1147daaed78bca5372809', commit message=Add 'general/' from commit 'f7a92f517e4fdaa2f29b6bed9d550748e1250ce8'\n\ngit-subtree-dir: general\ngit-subtree-mainline: 22469a96b9409abaeaaaea0470ec193b72e9429c\ngit-subtree-split: f7a92f517e4fdaa2f29b6bed9d550748e1250ce8', branch='', url='https://production.github.bshg.com/EOX6/frontend.git']', parentBuildId='null', buildRetention=null, runParameters=null, modules=null, statuses=null, buildDependencies=null, issues=null}, buildRepo=artifactory-build-info)"

[2023-08-30T06:10:06.672Z] }

[2023-08-30T06:10:06.672Z] ]

ShrutiTalewad commented 6 months ago

Any update on this please? I am getting the similar error

adamtenna commented 6 months ago

same error here