Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

flacocobot support for fault-localization in Repairnator #1243

Merged
merged 41 commits into from
Jan 22, 2022

Conversation

andre15silva
Copy link
Contributor

@andre15silva andre15silva commented Oct 18, 2021

Adds support for running flacocobot on PRs and as a runnable

Signed-off-by: André Silva <andre15andre@hotmail.com>
Signed-off-by: André Silva <andre15andre@hotmail.com>
@andre15silva
Copy link
Contributor Author

andre15silva commented Oct 20, 2021

Next steps:

@andre15silva andre15silva changed the title GitHub Actions support for Flacoco Bot flacocobot support for pull-requests and realtime Oct 20, 2021
andre15silva and others added 5 commits October 20, 2021 13:39
Signed-off-by: André Silva <andre15andre@hotmail.com>
Signed-off-by: Davide Ginelli <ginellidavide@gmail.com>
Signed-off-by: Davide Ginelli <ginellidavide@gmail.com>
…ibrary

The exception occurs when the API does not manage to retrieve the head commit of a pull request.

Signed-off-by: Davide Ginelli <ginellidavide@gmail.com>
Signed-off-by: Davide Ginelli <ginellidavide@gmail.com>
@andre15silva
Copy link
Contributor Author

We should update github-api: https://mvnrepository.com/artifact/org.kohsuke/github-api

Signed-off-by: André Silva <andre15andre@hotmail.com>
Signed-off-by: André Silva <andre15andre@hotmail.com>
Signed-off-by: André Silva <andre15andre@hotmail.com>
@andre15silva
Copy link
Contributor Author

@dginelli I don't remember if I've told you this, but please keep in mind that the personal access token you use must have the public_repo scope to be able to create pull request reviews.

It's really easy to forget that it is the case, and the error message is really unclear.

See: https://github.heygears.community/t/404-while-creating-new-pr-review/196660

@andre15silva
Copy link
Contributor Author

andre15silva commented Oct 29, 2021

I've pushed a new version of the repairnator/pipeline image, 3.4.

It now supports the fault localization mode: docker run -e REPAIR_MODE=FAULT_LOCALIZATION -e GITHUB_URL=https://github.com/repairnator/failingProject -e GITHUB_PR=7 -e FLACOCO_THRESHOLD=0.12 -e GITHUB_OAUTH=$GITHUB_OAUTH repairnator/pipeline:3.4

WIP on Adapt DockerPipelineRunner to the new GithubInputBuild format for PRs

Signed-off-by: André Silva <andre15andre@hotmail.com>
image

Signed-off-by: André Silva <andre15andre@hotmail.com>
@dginelli
Copy link
Contributor

dginelli commented Nov 2, 2021

@dginelli I don't remember if I've told you this, but please keep in mind that the personal access token you use must have the public_repo scope to be able to create pull request reviews.

It's really easy to forget that it is the case, and the error message is really unclear.

See: https://github.heygears.community/t/404-while-creating-new-pr-review/196660

Thank you for the information!

Signed-off-by: André Silva <andre15andre@hotmail.com>
@andre15silva
Copy link
Contributor Author

@dginelli You should now be able to run flacocobot.

This comment, repairnator/failingProject#7 (review), was generated through the FlacocoScanner.

Let me know if you need help or have any doubt.

Signed-off-by: Davide Ginelli <ginellidavide@gmail.com>
Signed-off-by: Davide Ginelli <ginellidavide@gmail.com>
Signed-off-by: Davide Ginelli <ginellidavide@gmail.com>
@dginelli
Copy link
Contributor

dginelli commented Nov 4, 2021

@dginelli You should now be able to run flacocobot.

This comment, repairnator/failingProject#7 (review), was generated through the FlacocoScanner.

Let me know if you need help or have any doubt.

Hi @andre15silva,

Thank you for the work, I managed to run flacocobot and to push its suggestions on a pull request, but I have a couple of doubts about its functioning.

The first one is related to the volumes: I had to change this part of the source code adding these lines

final Volume repairnatorWorkspace = Volume.builder()
        .name("repairnator_workspace")
        .driver("local")
        .build();
final Volume repairnatorWorkspaceCreated = docker.createVolume(repairnatorWorkspace);

final Volume repairnatorLogs = Volume.builder()
        .name("repairnator_logs")
        .driver("local")
        .build();
final Volume repairnatorLogsCreated = docker.createVolume(repairnatorLogs);

before the ones that I linked above in order to create the volumes, otherwise the pipeline was not able to run since it was not able to find the volumes. I don’t know if it is a problem that occurs only to me or not (I tried it on my Mac and on a clean virtual machine with Ubuntu 18.04). Before running flacocobot, I downloaded the repairnator/pipeline image.

The second aspect is related to the projects that have more than one failed open pull requests. When such a situation occurs, I noticed that the pipeline crashes. I think this is related to the fact that the pipeline tries to work on the same folder (since the repository is the same), and it fails to clone the repository.

Attached to this comment, you can find an example of the stack trace that I get when two pull requests for the same repository are available.

Also in this case, I don’t know if you already tried this test case without having errors or I’m doing anything wrong. If you have the error too, maybe a possible solution would to clone a repository in a folder that has the name of the repository followed by the id of the commit associated with the pull request, so that the folders have always unique names.

exception.txt

Thank you!

@andre15silva
Copy link
Contributor Author

andre15silva commented Nov 4, 2021

Hi @andre15silva,

Hi @dginelli !

The first one is related to the volumes: I had to change this part of the source code adding these lines

final Volume repairnatorWorkspace = Volume.builder()
        .name("repairnator_workspace")
        .driver("local")
        .build();
final Volume repairnatorWorkspaceCreated = docker.createVolume(repairnatorWorkspace);

final Volume repairnatorLogs = Volume.builder()
        .name("repairnator_logs")
        .driver("local")
        .build();
final Volume repairnatorLogsCreated = docker.createVolume(repairnatorLogs);

before the ones that I linked above in order to create the volumes, otherwise the pipeline was not able to run since it was not able to find the volumes. I don’t know if it is a problem that occurs only to me or not (I tried it on my Mac and on a clean virtual machine with Ubuntu 18.04).

Oh, I created the volumes manually when I ran it. I forgot to tell you, sorry.

The second aspect is related to the projects that have more than one failed open pull requests. When such a situation occurs, I noticed that the pipeline crashes. I think this is related to the fact that the pipeline tries to work on the same folder (since the repository is the same), and it fails to clone the repository.

Attached to this comment, you can find an example of the stack trace that I get when two pull requests for the same repository are available.

Also in this case, I don’t know if you already tried this test case without having errors or I’m doing anything wrong. If you have the error too, maybe a possible solution would to clone a repository in a folder that has the name of the repository followed by the id of the commit associated with the pull request, so that the folders have always unique names.

I didn't try it with project with more than 1 failing PR.

I'll fix that in a moment, to have a unique directory name everytime we clone.

@dginelli
Copy link
Contributor

dginelli commented Nov 4, 2021

Oh, I created the volumes manually when I ran it. I forgot to tell you, sorry.

No problem, don't worry! ;-) I didn't push the changes to create the volumes on the repo, but I can add them if you think that it is a good idea.

I didn't try it with project with more than 1 failing PR.

I'll fix that in a moment, to have a unique directory name everytime we clone.

Ok, great! :-) Meanwhile, I continue to test the scanner with other possible cases that come to my mind.

Signed-off-by: André Silva <andre15andre@hotmail.com>
@andre15silva
Copy link
Contributor Author

@dginelli Conflict fixed!

I've updated the docker image too. The code should pull the new image automatically, otherwise just pull it again: docker pull repairnator/pipeline:3.4

Anything else let me know :)

…th FlacocoScanner.

Signed-off-by: Davide Ginelli <ginellidavide@gmail.com>
Signed-off-by: Davide Ginelli <ginellidavide@gmail.com>
…repository

Signed-off-by: Davide Ginelli <ginellidavide@gmail.com>
…diff

Signed-off-by: Davide Ginelli <ginellidavide@gmail.com>
The fix is related to the file generated by Flacocobot when it is set to push the data in a repository instead of adding a review comment to a pull request.

Signed-off-by: Davide Ginelli <ginellidavide@gmail.com>
Signed-off-by: Davide Ginelli <ginellidavide@gmail.com>
Signed-off-by: Davide Ginelli <ginellidavide@gmail.com>
Signed-off-by: Davide Ginelli <ginellidavide@gmail.com>
Signed-off-by: Davide Ginelli <ginellidavide@gmail.com>
Signed-off-by: Davide Ginelli <ginellidavide@gmail.com>
Signed-off-by: Davide Ginelli <ginellidavide@gmail.com>
… variables.

These parameters are: the scan period, the total time of execution and the number of days before the current date to select only the pull requests opened in that period.

Signed-off-by: Davide Ginelli <ginellidavide@gmail.com>
@dginelli
Copy link
Contributor

Hi @andre15silva,

I finished the implementation part and I updated the documentation related to the use of Flacocobot. I also added a couple of test cases to test the GithubPullRequestScanner, that is the scanner used by Flacocobot to detect the pull requests associated with the projects under analysis.

When you have time, you can check if everything is ok :-)

@monperrus
Copy link
Contributor

monperrus commented Jan 10, 2022 via email

@andre15silva
Copy link
Contributor Author

Great, thanks Davide! @andre15silva <@andre15silva> WDYT?

Oh my, this thread got buried sorry @dginelli !

I'm busy until Friday, but as soon as I'm done I'll go over the changes and finish what's left (tests and docker at least).

Signed-off-by: André Silva <andre15andre@hotmail.com>
Signed-off-by: André Silva <andre15andre@hotmail.com>
Signed-off-by: André Silva <andre15andre@hotmail.com>
Signed-off-by: André Silva <andre15andre@hotmail.com>
@andre15silva
Copy link
Contributor Author

andre15silva commented Jan 18, 2022

  • tests to be updated

Signed-off-by: André Silva <andre15andre@hotmail.com>
@andre15silva andre15silva force-pushed the flacoco-github branch 2 times, most recently from 0f428ae to 5c9dc32 Compare January 19, 2022 16:26
Signed-off-by: André Silva <andre15andre@hotmail.com>
@andre15silva andre15silva marked this pull request as ready for review January 20, 2022 09:39
@andre15silva
Copy link
Contributor Author

andre15silva commented Jan 20, 2022

Ready for review @monperrus , the remaining tasks need to be done after we merge this (#1248)

@monperrus monperrus changed the title flacocobot support for pull-requests and realtime flacocobot support for fault-localization in Repairnator Jan 22, 2022
@monperrus monperrus merged commit af3023f into eclipse-repairnator:master Jan 22, 2022
@monperrus
Copy link
Contributor

Great, thanks a lot!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants