tomasbjerre / violation-comments-to-bitbucket-cloud-command-line

Report static code analysis to Bitbucket Cloud

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exception due to 'subrepo conflict'

mdealer opened this issue · comments

I want to try this with JUnit results, but it stumbles over a conflict with the target branch. Is the PR required to be merge-conflict free? We can see some scenarios where it's not desirable or not achievable. I don't think we can avoid conflicts as we are also working on submodules and need to update the .gitmodules in every branch separately, which can also mean that the main branch gets a different commit than the PR source branch in parallel. Eventually this conflict will resolve itself as we close the submodule PRs and point master parent module and our branch to the new commit hash, but on the way, it has to also work without merging...

The output:

+ npx violation-comments-to-bitbucket-cloud-command-line -show-debug-info -create-comment-with-all-single-file-comments true -u **** -p **** -ws **** -rs **** -prid **** -v JUNIT /var/lib/jenkins/reportViolations .*results/5dYi6rA0RieffPGOj_0mvA/result.xml$ JUnit
npx: installed 20 in 5.281s
Given parameters:
-show-debug-info, -create-comment-with-all-single-file-comments, true, -u, ****, -p, ****, -ws, ****, -rs, ****, -prid, ****, -v, JUNIT, /var/lib/jenkins/reportViolations, .*results/5dYi6rA0RieffPGOj_0mvA/result.xml$, JUnit

Parsed parameters:
Runner [violations=[[JUNIT, /var/lib/jenkins/reportViolations, .*results/5dYi6rA0RieffPGOj_0mvA/result.xml$, JUnit]], createCommentWithAllSingleFileComments=true, createSingleFileComments=true, minSeverity=INFO, keepOldComments=false, commentTemplate=, pullRequestId=****, projectKey=****, repoSlug=****, username=****, password=true, shouldCommentOnlyChangedContent=true, maxNumberOfViolations=2147483647]
FINE .*results(?:/|\\)5dYi6rA0RieffPGOj_0mvAPrinting(?:/|\\)result.xml$ matches /var/lib/jenkins/reportViolations/results/5dYi6rA0RieffPGOj_0mvA/result.xml
INFO Found 1 reports in /var/lib/jenkins/reportViolations with pattern .*results(?:/|\\)5dYi6rA0RieffPGOj_0mvA(?:/|\\)result.xml$
INFO     - /var/lib/jenkins/reportViolations/results/5dYi6rA0RieffPGOj_0mvA/result.xml
FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

FINE Cannot determine file and line in:

PR: ****/****/****
FINE 
>> GET /2.0/repositories/****/****/pullrequests/**** 


FINE 
<< 200 OK


FINE 
>> GET /2.0/repositories/****/****/diffstat/****..**** 


FINE 
<< 200 OK


javax.ws.rs.client.ResponseProcessingException: javax.ws.rs.ProcessingException: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `se.bjurr.bitbucketcloud.gen.model.Diffstat$StatusEnum`, problem: Unexpected value 'subrepo conflict'
 at [Source: (org.jboss.resteasy.specimpl.AbstractBuiltResponse$InputStreamWrapper); line: 1, column: 430] (through reference chain: se.bjurr.bitbucketcloud.gen.model.PaginatedDiffstats["values"]->java.util.ArrayList[1]->se.bjurr.bitbucketcloud.gen.model.Diffstat["status"])
	at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.extractResult(ClientInvocation.java:198)
	at org.jboss.resteasy.client.jaxrs.internal.proxy.extractors.BodyEntityExtractor.extractEntity(BodyEntityExtractor.java:60)
	at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invokeSync(ClientInvoker.java:152)
	at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invoke(ClientInvoker.java:113)
	at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientProxy.invoke(ClientProxy.java:76)
	at com.sun.proxy.$Proxy29.repositoriesWorkspaceRepoSlugDiffstatSpecGet(Unknown Source)
	at se.bjurr.violations.comments.bitbucketcloud.lib.BitbucketCloudCommentsProvider.getDiffstat(BitbucketCloudCommentsProvider.java:215)
	at se.bjurr.violations.comments.bitbucketcloud.lib.BitbucketCloudCommentsProvider.getFiles(BitbucketCloudCommentsProvider.java:110)
	at se.bjurr.violations.comments.lib.CommentsCreator.<init>(CommentsCreator.java:51)
	at se.bjurr.violations.comments.lib.CommentsCreator.createComments(CommentsCreator.java:38)
	at se.bjurr.violations.comments.bitbucketcloud.lib.ViolationCommentsToBitbucketCloudApi.toPullRequest(ViolationCommentsToBitbucketCloudApi.java:191)
	at se.bjurr.violations.main.Runner.main(Runner.java:252)
	at se.bjurr.violations.main.Main.main(Main.java:6)
Caused by: javax.ws.rs.ProcessingException: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `se.bjurr.bitbucketcloud.gen.model.Diffstat$StatusEnum`, problem: Unexpected value 'subrepo conflict'
 at [Source: (org.jboss.resteasy.specimpl.AbstractBuiltResponse$InputStreamWrapper); line: 1, column: 430] (through reference chain: se.bjurr.bitbucketcloud.gen.model.PaginatedDiffstats["values"]->java.util.ArrayList[1]->se.bjurr.bitbucketcloud.gen.model.Diffstat["status"])
	at org.jboss.resteasy.client.jaxrs.internal.ClientResponse.readFrom(ClientResponse.java:263)
	at org.jboss.resteasy.specimpl.BuiltResponse.readEntity(BuiltResponse.java:88)
	at org.jboss.resteasy.specimpl.AbstractBuiltResponse.readEntity(AbstractBuiltResponse.java:256)
	at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.extractResult(ClientInvocation.java:162)
	... 12 more
Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `se.bjurr.bitbucketcloud.gen.model.Diffstat$StatusEnum`, problem: Unexpected value 'subrepo conflict'
 at [Source: (org.jboss.resteasy.specimpl.AbstractBuiltResponse$InputStreamWrapper); line: 1, column: 430] (through reference chain: se.bjurr.bitbucketcloud.gen.model.PaginatedDiffstats["values"]->java.util.ArrayList[1]->se.bjurr.bitbucketcloud.gen.model.Diffstat["status"])
	at com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(InvalidDefinitionException.java:67)
	at com.fasterxml.jackson.databind.DeserializationContext.instantiationException(DeserializationContext.java:1608)
	at com.fasterxml.jackson.databind.DeserializationContext.handleInstantiationProblem(DeserializationContext.java:1073)
	at com.fasterxml.jackson.databind.deser.std.FactoryBasedEnumDeserializer.deserialize(FactoryBasedEnumDeserializer.java:146)
	at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
	at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:286)
	at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:245)
	at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:27)
	at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
	at com.fasterxml.jackson.databind.ObjectReader._bind(ObjectReader.java:1574)
	at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:965)
	at com.fasterxml.jackson.jaxrs.base.ProviderBase.readFrom(ProviderBase.java:815)
	at org.jboss.resteasy.core.interception.jaxrs.AbstractReaderInterceptorContext.readFrom(AbstractReaderInterceptorContext.java:102)
	at org.jboss.resteasy.core.interception.jaxrs.AbstractReaderInterceptorContext.proceed(AbstractReaderInterceptorContext.java:81)
	at org.jboss.resteasy.client.jaxrs.internal.ClientResponse.readFrom(ClientResponse.java:226)
	... 15 more
Caused by: java.lang.IllegalArgumentException: Unexpected value 'subrepo conflict'
	at se.bjurr.bitbucketcloud.gen.model.Diffstat$StatusEnum.fromValue(Diffstat.java:53)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.fasterxml.jackson.databind.introspect.AnnotatedMethod.callOnWith(AnnotatedMethod.java:122)
	at com.fasterxml.jackson.databind.deser.std.FactoryBasedEnumDeserializer.deserialize(FactoryBasedEnumDeserializer.java:138)
	... 30 more

Yes. If the merge cannot be done. You cannot run the tests on the merge. And you cannot get the results of those tests. And you cannot report them.

We run the tests and get results just fine, as we do not enforce a merge. We sync the PR source branch with master manually as soon as we actually need it. What do you think about this scenario? I am not sure we are on the same page.

Try with "createSingleFileComments" as false.

Should be possible to support this. But also sounds like a rare use case.

Still fails with the same error but at a different location with createSingleFileComments as false.