GithubHelp home page GithubHelp logo

ci-droid-tasks-consumer's People

Contributors

chandrasekharpanigrahy avatar dependabot[bot] avatar juliette-derancourt avatar santhoshkkk avatar vincent-fuchs avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

ci-droid-tasks-consumer's Issues

when logging event, MDC "leaks"

Summary

In Event

, there's a problem with how we reset MDC the first time :

the copyOfMdc we do the first time is null, so MDC doesn't get cleaned, while it has been modified

Type of Issue

It is a :

  • bug

Current Behavior

MDC content is not cleaned properly the first time it's used, so its content "leaks" to subsequent calls

Expected Behavior

MDC should be cleaned properly, so that each call is actually independent and we don't end up logging MDC attribute of previous event(s)

  • Version used: 1.0.9

When PR already exists, no notification is sent

Summary

When PR already exists but we still try to create one, an exception is thrown. commit has happen, but we don't receive any notification

Ideally, we should use a DirectPush instead of PullRequestGitHubInteraction, but in case we didn't we should still receive a notification

Type of Issue

It is a :

  • [X ] bug
  • request
  • question regarding the documentation

Motivation

Current Behavior


2018-08-14 15:02:25.761 []  WARN 22828 --- [github-events-1] c.s.c.t.c.i.ActionToPerformListener      : some unexpected error happened

feign.FeignException: status 422 reading FeignRemoteGitHub#createPullRequest(String,PullRequestToCreate); content:
{"message":"Validation Failed","errors":[{"resource":"PullRequest","code":"custom","message":"A pull request already exists for ItecFccOsd:sonarMigrationAugust."}],"documentation_url":"https://developer.github.com/enterprise/2.13/v3/pulls/#create-a-pull-request"}
	at feign.FeignException.errorStatus(FeignException.java:62)
	at feign.codec.ErrorDecoder$Default.decode(ErrorDecoder.java:91)
	at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:138)
	at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:76)
	at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:103)
	at com.sun.proxy.$Proxy104.createPullRequest(Unknown Source)
	at com.societegenerale.cidroid.tasks.consumer.services.ActionToPerformService.createPrOnBranch(ActionToPerformService.java:207)
	at com.societegenerale.cidroid.tasks.consumer.services.ActionToPerformService.createPullRequest(ActionToPerformService.java:90)
	at com.societegenerale.cidroid.tasks.consumer.services.ActionToPerformService.perform(ActionToPerformService.java:74)
	at com.societegenerale.cidroid.tasks.consumer.infrastructure.ActionToPerformListener.onActionToPerform(ActionToPerformListener.java:70)
	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:483)
	at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:180)


Expected Behavior

Exception should be caught (logged as warn), and flow should continue normally so that notification is sent.

Steps to Reproduce (for bugs)

Your Environment

  • Version used: 1.03
  • OS and version:
  • Version of libs used:

can't upgrade to Spring Cloud Hoxton

Summary

Following Spring Boot 2.2 upgrade, we're supposed to use Spring Cloud Hoxton M3. However, when upgrading Spring Cloud, build fails

Motivation

we should keep dependencies up to date, according to Spring recommendations

Current Behavior

Build fails because of test failure in PRtitleShouldBeReceivedAsSent :

09:25:52.857 [main] DEBUG org.springframework.context.annotation.AnnotationConfigApplicationContext - Closing FeignContext-github, started on Sat Oct 19 09:25:48 CEST 2019, parent: org.springframework.context.s
upport.GenericApplicationContext@7158a28c
09:25:52.860 [main] ERROR org.springframework.test.context.TestContextManager - Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionLi
stener@24b9c037] to prepare test instance [com.societegenerale.cidroid.tasks.consumer.infrastructure.FeignRemoteGitHubTest@570f2cf7]
java.lang.IllegalStateException: Failed to load ApplicationContext
        at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:132)
        at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:123)
        at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:118)
        at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83)
        at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:244)
...
...
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'actions-to-perform' available
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:805)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1278)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:297)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:207)

Expected Behavior

Test should not fail and build should pass ;-)

Steps to Reproduce (for bugs)

check out branch withSpringCloudHoxtonM3 (https://github.com/societe-generale/ci-droid-tasks-consumer/tree/withSpringCloudHoxtonM3) and run mvn clean install

Your Environment

Maven home: C:\Program Files\dev\apache-maven-3.5.4\bin..
Java version: 1.8.0_171, vendor: Oracle Corporation, runtime: C:\Program Files\dev\jdk8_171\jre
Default locale: fr_FR, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

Upgrade to Spring Boot 2.2.0.M1

Summary

I recently noticed that Spring Boot released their first milestone for the v2.2.0.
This new version has updated the JUnit Jupiter dependency from 5.3.2 to 5.4.0.
It could be a good thing to upgrade to this version since we had version conflicts for JUnit Jupiter in #61 and #65 (spring was pulling 5.3.2 which forced us to explicitly add the junit-jupiter-api artifact instead of relying entirely on the junit-jupiter aggregate).
Only question is, should we use the milestone or wait for a more stable release?

Type of Issue

It is a :

  • bug
  • request
  • question regarding the documentation

use class attribute instead of type when processing the message

Summary

Tasks consumer still looks at @type to find the action type, but it has changed to "class" - this causes a NullPointerException when message is processed.

Type of Issue

It is a :

  • [ X] bug
  • request
  • question regarding the documentation

Steps to Reproduce (for bugs)

Using CI-droid and tasks consumer v1.0.1, we get a NullPointerException in tasks consumer when the message is processed.

Your Environment

  • Version used: 1.0.1

should use provided pullRequestTitle when creating the PR

Summary

Related to societe-generale/ci-droid#6 : new "pullRequestTitle" field needs to be taken into account when creating the PR

Type of Issue

It is a :

  • bug
  • request
  • question regarding the documentation

Motivation

Current Behavior

the PR is created, but takes the commitMessage as title : now that a dedicated field (pullRequestTitle) has been introduced in the model, we should use it

Expected Behavior

use pullRequestTitle if provided - otherwise use the branch name as PR title

Steps to Reproduce (for bugs)

Your Environment

  • Version used: 1.0.5
  • OS and version:
  • Version of libs used:

When using PullRequestGitHubInteraction on a resource with branch X, the PR gets created on the default branch

Summary

When using a bulk action with PullRequestGitHubInteraction, the branch for the PR should be created on top of the branch we mention for each resource.

Type of Issue

It is a :

  • bug
  • request
  • question regarding the documentation

Current Behavior

it seems to be creating the branch for the PR on top of the default branch of the repository, not the branch we mention for each resource

Expected Behavior

If I post below action

  "gitHubInteractionType": {
    "@c": ".PullRequestGitHubInteraction",
"branchNameToCreate":"DTRchange",
"pullRequestTitle":"DTR change to proper value"

  },
  "resourcesToUpdate": [
 {"repoFullName": "myOrg/myProject","filePathOnRepo": "docker-stack.yaml","branchName": "prd"}
  ]

we expect the "DTRchange" branch to be created on top of "prd" branch

Your Environment

  • Version used: 1.0.6
  • OS and version:
  • Version of libs used:

PR size analyzer

Summary

Giving feedback to developers on the size of their PR (too many files/lines modified) would be very helpful :

Type of Issue

It is a :

  • bug
  • request
  • question regarding the documentation

Motivation

Small, focused PRs are easier to review and are more likely to be accepted. Having PRs that are big beyond a certain threshold, is usually a smell : either the story slicing is not fine enough, or developers is not able to break down the tasks himself.

Expected Behavior

We implement a PullRequestEventHandler that can be configured with max number of files and lines. if the PR size is bigger than the configured threshold, CI-droid should post a comment on the PR, warning the developer that his/her PR is too big and that it's not a good practice. can he/she try to split his/her change in smaller PRs ? If not, explain why in comments.

have a look at https://github.com/societe-generale/ci-droid-tasks-consumer/blob/master/ci-droid-tasks-consumer-services/src/main/java/com/societegenerale/cidroid/tasks/consumer/services/actionHandlers/BestPracticeNotifierHandler.java to get an idea of what a PullRequestEventHandler looks like

Your Environment

  • Version used: 1.0.7

BitBucket and GitHub won't start in synchronous mode

it seems GitHub and BitBucket (at least) won't start in synchronous mode, because of

Ambiguous mapping. Cannot map 'sourceControlEventController' method

The controller is both scanned (because annotated with @RestController) and instantiated in the respective configs.

see failing tests in https://github.com/societe-generale/ci-droid-tasks-consumer/tree/issue98

Need to find a way to manage both while enabling tests to pass (BitBucketSourceControlEventControllerTest expects the scanning to happen for instance)

close automatically old PRs ?

Summary

It would be nice to close automatically old PRs.

https://github.com/societe-generale/ci-droid-tasks-consumer/blob/master/ci-droid-tasks-consumer-services/src/main/java/com/societegenerale/cidroid/tasks/consumer/services/actionHandlers/RebaseHandler.java

perfoms rebase automatically, so a PR event will be generated.

When that PR event is generated, we could listen to it and close the PR if it's too old

Type of Issue

It is a :

  • request

Motivation

When developers don't close PRs , rebasing several old open PRs can be expensive

implementing a https://github.com/societe-generale/ci-droid-tasks-consumer/blob/master/ci-droid-tasks-consumer-services/src/main/java/com/societegenerale/cidroid/tasks/consumer/services/actionHandlers/PullRequestEventHandler.java would be fairly simple

if runtimeException during an event processing, other handlers are skipped

Summary

PushEvents are handled by a list of PushEventOnDefaultBranchHandler. If one of them throws a RuntimeException, then others are not called.

Type of Issue

It is a :

  • bug

Expected Behavior

we should catch runtime exceptions when calling handlers, so that other handlers can be called.

Your Environment

  • Version used: 1.0.8

refactor tests to use mock-server instead of code-story

Summary

As mentionned by @juliette-derancourt in #45 , we need to move out of https://github.com/CodeStory/fluent-http which is not actively supported anymore, and use http://www.mock-server.com/ instead.

Mock-server has already been added, so we just need to migrate the tests using fluent-http to mock-server, and remove the dependency.

Type of Issue

It is a :

  • request

Motivation

consistency and clarity : both libs are equivalent, one has more features and is maintained, the other isn't.

NPE thrown is repo doesn't exist while processing bulkAction

Summary

It may happen that user doesn't provide correct repository name when perfomring bulkAction, for instance, he/she may forget the organizationName.

This will result in a NullPointeException in

Reference masterCommitReference = remoteGitHub.fetchHeadReferenceFrom(repoFullName,branchFromWhichToCreatePrBranch );
Reference branchToUseForPr = null;
try {
branchToUseForPr = remoteGitHub.createBranch(repoFullName, branchNameForPR, masterCommitReference.getObject().getSha(),
action.getGitHubOauthToken());
} catch (BranchAlreadyExistsException e) {

Type of Issue

It is a :

  • bug

Expected Behavior

this case should be anticipated and mapped to a specific com.societegenerale.cidroid.api.ResourceToUpdate.UpdateStatus

Your Environment

  • Version used: 1.0.11

Make it work with github.com, not only Github enterprise edition

Summary

Currently, CI-droid works only with Github Enterprise Edition (GHE). We need to make it compatible with github.com

Type of Issue

It is a :

  • bug
  • [ X] request
  • question regarding the documentation

Motivation

To favor the usage outside corporates

Current Behavior

interactions with Github.com fail because some calls to the API are hardcoded, and the URL pattern is different between github.com and GHE

Probably need a change similar to societe-generale/github-crawler@8eeb050

Your Environment

  • Version used: 1.0.2

Providing a PullRequestEventHandler shouldn't be mandatory

Summary

When commenting the config for PullRequestEventHandler, the application fails to start

Type of Issue

It is a :

  • [ X] bug
  • request
  • question regarding the documentation

Current Behavior

When commenting below config

bestPracticeNotifier.enabled: true
patternToResourceMapping:
  "**/*Dto.java": "https://sgithub.fr.world.socgen/raw/ItecFccOsd/financing-platform-documentation/master/ci-droid-best-practices/noDtoClass.md"

Application fails to start

•	Jul 03 15:54:57 ci-droid-tasks-consumer: WARN | | Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'pushOnMasterListener' defined in class path resource [com/societegenerale/cidroid/tasks/consumer/infrastructure/config/InfraConfig.class]: Unsatisfied dependency expressed through method 'pushOnMasterListener' parameter 1; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'pullRequestEventService' defined in class path resource [com/societegenerale/cidroid/tasks/consumer/infrastructure/config/InfraConfig.class]: Unsatisfied dependency expressed through method 'pullRequestEventService' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'java.util.List<com.societegenerale.cidroid.tasks.consumer.services.actionHandlers.PullRequestEventHandler>' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {} | org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext

Expected Behavior

this part of the config shouldn't be mandatory. If no PullRequestEventHandler is defined, a default NoOp one should be instantiated.

Your Environment

  • Version used: 1.0.1

we should receive a notification when unexpected error happens during bulkAction processing

Summary

If an unexpected error happen (a null pointer exception for instance), the bulkAction processing will fail, but no notification is sent, leaving the requestor in the unknown.

Type of Issue

It is a :

  • bug
  • request
  • question regarding the documentation

Motivation

More clarity for end user

Expected Behavior

send the exception content through notification to the user.

Your Environment

  • Version used: 1.0.11

need a healthcheck, when deployed as a container

Summary

When the app is deployed in a container, it needs to provide a healthcheck so that container can be killed if it's unhealthy.

Type of Issue

It is a :

  • request

Current Behavior

since there's no healthcheck, when deployed as a container, it gets killed every few minutes

Expected Behavior

Expose an endpoint (through Spring Boot actuator) that can be queried for healthcheck

Steps to Reproduce (for bugs)

Your Environment

  • Version used: 1.1.0

PR not created anymore when sending PullRequestGitHubInteraction message

Summary

When sending below action, branch is created, but not the PR :

{
  "gitLogin": "vincent-fuchs",
  "gitHubOauthToken": "XXXXXXXXXXXXXX",
  "email": "[email protected]",
  "commitMessage": "removing maven-source-plugin",

  "updateAction": {
    "@class": "com.societegenerale.cidroid.extensions.actionToReplicate.RemoveMavenDependencyOrPluginAction",
    "artifactId": "maven-source-plugin"
  },

  "gitHubInteractionType": {
    "@c": ".PullRequestGitHubInteraction",
    "branchNameToCreate": "removingMavenSourcePlugin"
  },
  "resourcesToUpdate": [
    {"repoFullName": "myOrga/myRepo","filePathOnRepo": "pom.xml","branchName": "master"}
  ]
}

No error in logs either..

Type of Issue

It is a :

  • [ X] bug

Expected Behavior

PR should be created

Your Environment

  • Version used: 1.0.4

add monitoring events for CI-droid bulk actions

Summary

it would be nice to get easily some usage KPIs on CI-droid bulk actions, ie how many commits, PR have been performed, etc using https://github.com/societe-generale/ci-droid-tasks-consumer/blob/master/ci-droid-tasks-consumer-services/src/main/java/com/societegenerale/cidroid/tasks/consumer/services/monitoring/Event.java

Type of Issue

It is a :

  • request

Motivation

get a better view of how the tool is used, by whom, etc

Your Environment

  • Version used: 1.0.10
  • OS and version:
  • Version of libs used:

Need to use OAuth token when posting comment on PR

Summary

we should be able to configure OAuth token for comments to be posted on PRs.

Type of Issue

It is a :

  • bug

Current Behavior

Right now we're getting :

feign.FeignException: status 401 reading 
FeignRemoteGitHub#addCommentDescribingRebase(String,int,Comment)
  at feign.FeignException.errorStatus(FeignException.java:62)
  at feign.codec.ErrorDecoder$Default.decode(ErrorDecoder.java:91)

Expected Behavior

comments should be posted through API.

Your Environment

  • Version used: 1.0.7

[bulk actions] add the possibility to delete a resource

Summary

current bulk action only allow to modify/create a given resource, not to delete it

Type of Issue

It is a :

  • request

Motivation

It's convenient in some cases, to perform some clean-up

Expected Behavior

the current flow doesn't allow to integrate this feature seamlessly as a regular ActionToReplicate. So we may need to perform some ugly type check at some point, so that if the ActionToReplicate is of type DeleteResourceAction, then don't fetch the content and try to modify it, just delete it.

We'll see later if there are other similar actions that don't "fit" if we can create a better abstraction. But for now, let's manage it like this.

Your Environment

  • Version used: 1.0.11

bulk actions : don't create a new PR if same title / same branch

Summary

When we post a bulk action, it can happen that we want to create pull request (using .PullRequestGitHubInteraction), but the provided list of resources contains more than 1 resource on the same repository.

Type of Issue

It is a :

  • request

Current Behavior

What will happen in that case is that the commits will end up in the same branch, but several PRs will be created, on top of same branch.

Expected Behavior

Before creating a PR, check if there's not already one created on top of same branch, with same title. If that's the case, don't create a PR.

Your Environment

  • Version used: 1.0.9

not calling proper version of provideContent on actionToReplicate

Summary

in

, we call the shorter version of provideContent on actionToReplicate, but some implementations of ActionToReplicate (like TemplateBasedContentAction) need the method version with the resourceToUpdate being passed.

Because of that, actions like TemplateBasedContentAction fail to be performed.

Type of Issue

It is a :

  • bug

Expected Behavior

we should be able to send a TemplateBasedContentAction and expect it to be processed correctly, not throw a NullPointerException

Your Environment

  • Version used: 1.0.7

PR size analyzer

Summary

Some teams may want to have an additional gate keeper checking the size of a PR (nb of files and lines modified), to give feedback to developers when PRs are too big

Type of Issue

It is a :

  • bug
  • request
  • question regarding the documentation

Motivation

Current Behavior

Expected Behavior

Steps to Reproduce (for bugs)

Your Environment

  • Version used:
  • OS and version:
  • Version of libs used:

need some dummy classes

Summary

we recently removed dummy classes (DummyPullRequestEventHandler and DummyPushEventOnDefaultBranchHandler) :

faa22bc

but they are actually required.

Type of Issue

It is a :

  • bug

Current Behavior

if there's no other PullRequestEventHandler class instanciated at startup, then the application fails to start :

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'java.util.List<com.societegenerale.cidroid.tasks.consumer.services.actionHandlers.PullRequestEventHandler>' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}

Expected Behavior

application should start correctly, even if no PullRequestEventHandler is configured in properties

Your Environment

  • Version used: 1.0.9

rework and write unit tests for PR 37

Summary

In #37, we fixed an urgent bug after testing manually.

Type of Issue

It is a :

  • [ X ] request

Motivation

We need to rework the code a bit and add unit tests for the bug we fixed.

Your Environment

  • Version used: 1.0.11
  • OS and version:
  • Version of libs used:

when credentials are incorrect, send a KO email

right now, it fails with :

feign.FeignException: status 401 reading ContentClient#updateContent(DirectCommit) at feign.FeignException.errorStatus(FeignException.java:62) at feign.codec.ErrorDecoder$Default.decode(ErrorDecoder.java:91) at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:138) at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:76) at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:103) at com.societegenerale.cidroid.tasks.consumer.infrastructure.$Proxy136.updateContent(Unknown Source) at com.societegenerale.cidroid.tasks.consumer.infrastructure.FeignRemoteGitHub.updateContent(FeignRemoteGitHub.java:97)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.