mattermost-plugin-gitlab
mattermost-plugin-gitlab copied to clipboard
#213 Add command to run a new CI Build
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?
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.
Codecov Report
Merging #224 (9ae31c4) into master (f96cb41) will decrease coverage by
0.35%. The diff coverage is0.00%.
@@ 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 dataPowered by Codecov. Last update f96cb41...9ae31c4. Read the comment docs.
/check-cla
@hanzei can you suggest the next set of changes?
@tw-ayush I will take a look tomorrow.
@hanzei please have a check now
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
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 😄
Thank you for the heads up @tw-ayush!
Code LGTM, but I haven't tested the feature
hey @hanzei thanks for Quick review and test updates
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
@iomodo, kind ping for review
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
@DHaussermann, ping for review and welcome back from the holiday break!
@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
@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 clickRun Pipelinebut 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 thereference.Can you provide some guidance and an example of what would be passed in after the project?
Also, it seems
buildhas 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>
@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
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.
Thanks @tw-ayush that seems consistent with what I've been trying. I have a project named
pipelinetestwith a master branch so I tried/gitlab build dhaussermann/pipelinetest masterBut I get the responseUnknown action, please use /gitlab help to see all actions available.Is there a sub-command that must be used afterbuild?Subscriptions to this same project are working. This branch seems to be properly deployed as I see
buildin 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?
@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.
@DHaussermann did that work for you?
@tw-ayush Sorry for the late reply.
-
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 masterit fires off my CI pipeline. -
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.

@tw-ayush Sorry for the late reply.
- 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 masterit fires off my CI pipeline.- 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.
- I'll try and move it to an appropriate end point. I may need to figure out how to test that end point.
- 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?
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
@DHaussermann gentle ping :)
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
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
buildcommand
thanks for the update. Due to some personal commitments this is getting delayed. I'll update you soon on the changes.
@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.
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
@DHaussermann Pinging for QA review. Thanks.