mattermost-plugin-gitlab icon indicating copy to clipboard operation
mattermost-plugin-gitlab copied to clipboard

#213 Add command to run a new CI Build

Open tw-ayush opened this issue 5 years ago • 43 comments

This merge request enables the run build trigger. https://github.com/mattermost/mattermost-plugin-gitlab/issues/213

This is a WIP PR, while working on it i got lost in between with how to make this aligned with the current code and testing it so could not do it TDD way.

can someone please tell me what are the things i'm doing wrong here and what to do next?

tw-ayush avatar Oct 12 '20 08:10 tw-ayush

Hello @tw-ayush,

Thanks for your pull request! A Core Committer will review your pull request soon. For code contributions, you can learn more about the review process here.

Per the Mattermost Contribution Guide, we need to add you to the list of approved contributors for the Mattermost project.

Please help complete the Mattermost contribution license agreement? Once you have signed the CLA, please comment with /check-cla and confirm that the CLA check is green.

This is a standard procedure for many open source projects.

Please let us know if you have any questions.

We are very happy to have you join our growing community! If you're not yet a member, please consider joining our Contributors community channel to meet other contributors and discuss new opportunities with the core team.

mattermod avatar Oct 12 '20 08:10 mattermod

Codecov Report

Merging #224 (9ae31c4) into master (f96cb41) will decrease coverage by 0.35%. The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #224      +/-   ##
==========================================
- Coverage   38.18%   37.83%   -0.36%     
==========================================
  Files          16       16              
  Lines        1608     1623      +15     
==========================================
  Hits          614      614              
- Misses        923      938      +15     
  Partials       71       71              
Impacted Files Coverage Δ
server/command.go 29.14% <0.00%> (-1.22%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update f96cb41...9ae31c4. Read the comment docs.

codecov[bot] avatar Oct 12 '20 08:10 codecov[bot]

/check-cla

tw-ayush avatar Oct 12 '20 08:10 tw-ayush

@hanzei can you suggest the next set of changes?

tw-ayush avatar Oct 14 '20 18:10 tw-ayush

@tw-ayush I will take a look tomorrow.

hanzei avatar Oct 14 '20 18:10 hanzei

@hanzei please have a check now

tw-ayush avatar Oct 22 '20 18:10 tw-ayush

This PR has been automatically labelled "stale" because it hasn't had recent activity. A core team member will check in on the status of the PR to help with questions. Thank you for your contribution!

/cc @jasonblais @jfrerich @emilyacook

mattermod avatar Nov 17 '20 01:11 mattermod

This PR has been automatically labelled "stale" because it hasn't had recent activity. A core team member will check in on the status of the PR to help with questions. Thank you for your contribution!

/cc @jasonblais @jfrerich @emilyacook

last 15 days were a festival season in INDIA, so I could not spare any time along with my day job to make the changes, I'll probably do it this week 😄

tw-ayush avatar Nov 17 '20 05:11 tw-ayush

Thank you for the heads up @tw-ayush!

jasonblais avatar Nov 17 '20 12:11 jasonblais

Code LGTM, but I haven't tested the feature

hey @hanzei thanks for Quick review and test updates

tw-ayush avatar Dec 02 '20 05:12 tw-ayush

This PR has been automatically labelled "stale" because it hasn't had recent activity. A core team member will check in on the status of the PR to help with questions. Thank you for your contribution!

/cc @jasonblais @jfrerich @emilyacook

mattermod avatar Dec 13 '20 01:12 mattermod

@iomodo, kind ping for review

jfrerich avatar Dec 14 '20 19:12 jfrerich

This PR has been automatically labelled "stale" because it hasn't had recent activity. A core team member will check in on the status of the PR to help with questions. Thank you for your contribution!

/cc @jasonblais @jfrerich @emilyacook

mattermod avatar Dec 26 '20 01:12 mattermod

@DHaussermann, ping for review and welcome back from the holiday break!

jfrerich avatar Jan 04 '21 17:01 jfrerich

@tw-ayush or @hanzei I'm afraid I'm not familiar enough with GitLab pipelines to tests this. Can you please clarify what value from GitLab is passed in for reference/branch name? I have a pipeline setup on a GitLab project and it runs when I click Run Pipeline but I'm not sure what to pass into the slash command. The branch name only does not work and I don't know where to find the reference.

Can you provide some guidance and an example of what would be passed in after the project?

Also, it seems build has not been added to the help info for this new feature

DHaussermann avatar Jan 05 '21 20:01 DHaussermann

@tw-ayush or @hanzei I'm afraid I'm not familiar enough with GitLab pipelines to tests this. Can you please clarify what value from GitLab is passed in for reference/branch name? I have a pipeline setup on a GitLab project and it runs when I click Run Pipeline but I'm not sure what to pass into the slash command. The branch name only does not work and I don't know where to find the reference.

Can you provide some guidance and an example of what would be passed in after the project?

Also, it seems build has not been added to the help info for this new feature

you should be able to run the command by passing <command> <project-name> <branch-name>

tw-ayush avatar Jan 06 '21 12:01 tw-ayush

@hanzei this bring me back to my earlier doubt that we have used the create Pipeline Methods of SDK under the hood while it looks like a use case for trigger Pipeline APIs

tw-ayush avatar Jan 06 '21 12:01 tw-ayush

Thanks @tw-ayush that seems consistent with what I've been trying. I have a project named pipelinetest with a master branch so I tried /gitlab build dhaussermann/pipelinetest master But I get the response Unknown action, please use /gitlab help to see all actions available. Is there a sub-command that must be used after build?

Subscriptions to this same project are working. This branch seems to be properly deployed as I see build in the autocomplete. Also when firing it off via the GitLab UI, the test portion of my pipeline is failing but that does not seem related at all.

DHaussermann avatar Jan 07 '21 14:01 DHaussermann

Thanks @tw-ayush that seems consistent with what I've been trying. I have a project named pipelinetest with a master branch so I tried /gitlab build dhaussermann/pipelinetest master But I get the response Unknown action, please use /gitlab help to see all actions available. Is there a sub-command that must be used after build?

Subscriptions to this same project are working. This branch seems to be properly deployed as I see build in the autocomplete. Also when firing it off via the GitLab UI, the test portion of my pipeline is failing but that does not seem related at all.

The tests also seems to be working fine. I'm so far unable to set-up a sever and plugin to test these changes for myself, thus I only rely on unit/functional tests. @hanzei can you help us out here?

tw-ayush avatar Jan 17 '21 17:01 tw-ayush

@DHaussermann can you please try running it under webhook command, seems like i've placed the execution call at a wrong place. Please try this once and let me know if that works.

tw-ayush avatar Jan 17 '21 17:01 tw-ayush

@DHaussermann did that work for you?

tw-ayush avatar Jan 22 '21 08:01 tw-ayush

@tw-ayush Sorry for the late reply.

  1. Yes, it seems you're correct and this was put in the wrong place. Using the same project as above, when I run /gitlab webhook build dhaussermann/pipelinetest master it fires off my CI pipeline.

  2. It does seem like there is an issue with the ephemeral post that gets created. Can you please see what happening here? This does not look like the intended behavior and it's showing text links to visual elements. Screen Shot 2021-01-22 at 10 51 54 AM

DHaussermann avatar Jan 22 '21 15:01 DHaussermann

@tw-ayush Sorry for the late reply.

  1. Yes, it seems you're correct and this was put in the wrong place. Using the same project as above, when I run /gitlab webhook build dhaussermann/pipelinetest master it fires off my CI pipeline.
  2. It does seem like there is an issue with the ephemeral post that gets created. Can you please see what happening here? This does not look like the intended behavior and it's showing text links to visual elements. Screen Shot 2021-01-22 at 10 51 54 AM
  1. I'll try and move it to an appropriate end point. I may need to figure out how to test that end point.
  2. Writing a to string end point should probably fix this. Can you tell me which are the expected fields in the response.

Also can you please validate if the links in the response are accessible or not?

tw-ayush avatar Jan 24 '21 14:01 tw-ayush

This PR has been automatically labelled "stale" because it hasn't had recent activity. A core team member will check in on the status of the PR to help with questions. Thank you for your contribution!

/cc @jasonblais @jfrerich @emilyacook

mattermod avatar Feb 04 '21 01:02 mattermod

@DHaussermann gentle ping :)

emilyacook avatar Feb 05 '21 00:02 emilyacook

Hi @tw-ayush sorry for the late reply. I took a look at the post and all the links are reachable and look valid.

Regarding what fields are expected in the response - We don't exactly have a matching use case to compare this to so I do not have a list of what fields we should include in the post. I'd say there's some room for discretion here. In my opinion, we don't need all the fields that are currently included. 0/5 Maybe these details would be enough: for the pipeline: gitlab.Pipeline{ID:252742578, Status:"pending", Ref:"master", For the user who triggered it: Username:"dhaussermann" For the link: The Url to the pipeline build details https://gitlab.com/dhaussermann/pipelinetest/-/pipelines/252742578 @aaronrothschild any thoughts on this ☝️ ? You can see from the screen above the post that get's created when the pipline is triggered would be a bit messy and it would be difficult top format this all into an obvious and clear piece of information.

Also @tw-ayush please let me know when you have a chance to move the build command

DHaussermann avatar Feb 08 '21 03:02 DHaussermann

Hi @tw-ayush sorry for the late reply. I took a look at the post and all the links are reachable and look valid.

Regarding what fields are expected in the response - We don't exactly have a matching use case to compare this to so I do not have a list of what fields we should include in the post. I'd say there's some room for discretion here. In my opinion, we don't need all the fields that are currently included. 0/5 Maybe these details would be enough: for the pipeline: gitlab.Pipeline{ID:252742578, Status:"pending", Ref:"master", For the user who triggered it: Username:"dhaussermann" For the link: The Url to the pipeline build details https://gitlab.com/dhaussermann/pipelinetest/-/pipelines/252742578 @aaronrothschild any thoughts on this ☝️ ? You can see from the screen above the post that get's created when the pipline is triggered would be a bit messy and it would be difficult top format this all into an obvious and clear piece of information.

Also @tw-ayush please let me know when you have a chance to move the build command

thanks for the update. Due to some personal commitments this is getting delayed. I'll update you soon on the changes.

tw-ayush avatar Feb 08 '21 15:02 tw-ayush

@DHaussermann i've moved the command to appropriate place. @hanzei it won't be possible to keep the tests now, since the method call some configuration code. I believe that's the reason there are no tests written for ExecuteCommand method.

tw-ayush avatar Feb 09 '21 12:02 tw-ayush

This PR has been automatically labelled "stale" because it hasn't had recent activity. A core team member will check in on the status of the PR to help with questions. Thank you for your contribution!

/cc @jasonblais @jfrerich @emilyacook

mattermod avatar Feb 21 '21 01:02 mattermod

@DHaussermann Pinging for QA review. Thanks.

hahmadia avatar Feb 21 '21 06:02 hahmadia