• 
      

    Add GitLab CI integration.

    Review Request #14459 — Created June 13, 2025 and submitted

    Information

    rbintegrations
    master

    Reviewers

    This change adds support for GitLab CI integration. This works similarly
    to how many of our integrations do, where the integration can trigger a
    new pipeline.

    Because of how pipeline configurations work, we can't completely replace
    the configuration when starting the pipeline. We therefore send
    necessary information as variables, and it's up to the user to add what
    they need to their .gitlab-ci.yml file. Documentation for how to do all
    of that will be in a separate change for the Review Board manual.

    This does have one additional feature over other CI integrations, where
    the individual job state can be posted as a review.

    Based on work by André Klitzing at /r/14211. There are a few differences
    in functionality from that change:

    • Rather than asking the user to put the API token into the GitLab
      WebHook configuration's secret field, we allow (optionally) setting a
      specific secret key for both the webhook and the integration.
    • Instead of posting job results in a review and then deleting it
      whenever there's an update, those results are put into a general
      comment (without an issue) and then the text of that comment gets
      updated. We theoretically like to treat comment text as immutable once
      published, but in this case I think it's fine.
    • I've gotten rid of the gitlab_old_pipeline setting entirely. In the
      case that pipelines are getting rerun, I think it makes sense to
      always get those updates on Review Board. In the case where a child
      pipeline is sending updates, I've just added notes in the
      documentation that triggers really should set strategy: depend so
      that parent pipelines will wait for their children to complete.
    • I've added a new dependency on pydantic for parsing the WebHook
      payload structure.
    • Added unit tests for everything.
    • Various things have been renamed and cleaned up to match our style.
    • Created a variety of GitLab CI setups, including simple jobs and
      parent/child pipelines. Verified that pipelines were triggered
      successfully and results posted back.
    • Ran unit tests.
    Summary ID
    Add GitLab CI integration.
    This change adds support for GitLab CI integration. This works similarly to how many of our integrations do, where the integration can trigger a new pipeline. Because of how pipeline configurations work, we can't completely replace the configuration when starting the pipeline. We therefore send necessary information as variables, and it's up to the user to add what they need to their .gitlab-ci.yml file. Documentation for how to do all of that will be in a separate change for the Review Board manual. This does have one additional feature over other CI integrations, where the individual job state can be posted as a review. Based on work by André Klitzing at /r/14211. There are a few differences in functionality from that change: - Rather than asking the user to put the API token into the GitLab WebHook configuration's secret field, we allow (optionally) setting a specific secret key for both the webhook and the integration. - Instead of posting job results in a review and then deleting it whenever there's an update, those results are put into a general comment (without an issue) and then the text of that comment gets updated. We theoretically like to treat comment text as immutable once published, but in this case I think it's fine. - I've gotten rid of the `gitlab_old_pipeline` setting entirely. In the case that pipelines are getting rerun, I think it makes sense to always get those updates on Review Board. In the case where a child pipeline is sending updates, I've just added notes in the documentation that triggers really should set `strategy: depend` so that parent pipelines will wait for their children to complete. - I've added a new dependency on `pydantic` for parsing the WebHook payload structure. - Added unit tests for everything. - Various things have been renamed and cleaned up to match our style. Testing Done: - Created a variety of GitLab CI setups, including simple jobs and parent/child pipelines. Verified that pipelines were triggered successfully and results posted back. - Ran unit tests.
    19c71a9c94a786814505aa1e2a2904b912cec0b3

    Description From Last Updated

    Looks like this won't fit to our workflow anymore. Is it possible to derive from this in a separate custom …

    miserymisery

    'djblets.forms.widgets.CopyableTextInput' imported but unused Column: 1 Error code: F401

    reviewbotreviewbot

    line too long (81 > 79 characters) Column: 80 Error code: E501

    reviewbotreviewbot

    continuation line under-indented for visual indent Column: 25 Error code: E128

    reviewbotreviewbot

    'djblets.util.typing.JSONDict' imported but unused Column: 5 Error code: F401

    reviewbotreviewbot

    line too long (90 > 79 characters) Column: 80 Error code: E501

    reviewbotreviewbot

    This should be in the multi-line form.

    chipx86chipx86

    It's probably worth using Django's TextChoices enum for these going forward. That gives us stable constants to refer to while …

    chipx86chipx86

    This help text doen't give a lot of useful information. We should at least give an example.

    chipx86chipx86

    This is missing a trailing period.

    chipx86chipx86

    "Git"

    chipx86chipx86

    "GitLab"

    chipx86chipx86

    We normally have required before help_text (including in the field above), so we should make this match.

    chipx86chipx86

    We never return a value from this function. in the success case.

    chipx86chipx86

    "GitLab"

    chipx86chipx86

    Missing localization.

    chipx86chipx86

    Missing localization.

    chipx86chipx86

    Instead of casting, we should pull out the variable and check its type, raising an exception if it's not a …

    chipx86chipx86

    "GitLab"

    chipx86chipx86

    Can you place this one alphabetically? All the rest seem fine.

    chipx86chipx86

    Same note as above regarding type safety.

    chipx86chipx86

    Can we make these keyword-only?

    chipx86chipx86

    If we're inlining this, we should probably prefix with a _ so it's clear it's not a public function. Ideally, …

    chipx86chipx86

    This is a little hard to read. Can we move name to the next line so it doesn't appear to …

    chipx86chipx86

    This is in the wrong import group.

    chipx86chipx86

    Can you make these keyword-only?

    chipx86chipx86

    These should all be , optional.

    chipx86chipx86

    Can you make this multi-line so it's easier to read/maintain? Also, we should pass save=False since we're setting things and …

    chipx86chipx86

    Typo: kwargrs -> kwargs

    chipx86chipx86

    Nit: You could just decorate the above with @spy_for. Same below.

    chipx86chipx86

    Can you update these for keyword-only arguments?

    chipx86chipx86

    You can just pass base_commit_id= in as a parameter and avoid the double-save.

    chipx86chipx86

    Let's keep one per line.

    chipx86chipx86

    Can we test the exact error? Here and below.

    chipx86chipx86

    Blank line between statements and comments.

    chipx86chipx86

    We access self.review_request a lot, so let's initially set it locally, set self.review_request, and then access the local copy.

    chipx86chipx86

    Can we just test the entire dictionary in one go? Avoid surprises later?

    chipx86chipx86

    we normally do one per line.

    chipx86chipx86

    line too long (90 > 79 characters) Column: 80 Error code: E501

    reviewbotreviewbot

    Why 202? It's really unclear how this is used here and below. Can we document this? I think more of …

    chipx86chipx86

    The error isn't going to be very useful by itself. Can we add to it?

    chipx86chipx86

    We're not consistent here and with the above or below logs. We should stick to a very consistent format for …

    chipx86chipx86

    While this should never fail, it'd be nice to do this check early before all the validation.

    chipx86chipx86

    We shouldn't assert, as that doesn't survive optimized builds. Good for internal usage, but for type-checking user-controllable state, we need …

    chipx86chipx86

    No need for the blank line here.

    chipx86chipx86

    I know we're using Pydantic to verify, but then why do we need to assert here? Don't we get the …

    chipx86chipx86

    This is a bit vague. Can we say "Unknown build status for <something>"?

    chipx86chipx86

    "URL"

    chipx86chipx86

    Something we need to do better at is building of URLs involving user-supplied input. Going to be commenting about this …

    chipx86chipx86

    This has user-modifiable input, so we need to handle ValueErrors here.

    chipx86chipx86

    id is a reserved function. build_id?

    chipx86chipx86

    To be consistent with above logs, we should capitalize "Unknown".

    chipx86chipx86

    You can just use GeneralComment.objects.create(...). Also, one keyword arg per line.

    chipx86chipx86

    So where I think this is going to bite us is that by having such a specific compatibility requirement here …

    chipx86chipx86

    I changed it to GitlabError because "error 404" is not an authentication error.

    miserymisery

    This is called REVIEWBOARD_REVIEW_ID in jenkins integration. That should be unified.

    miserymisery

    line too long (90 > 79 characters) Column: 80 Error code: E501

    reviewbotreviewbot

    never use "DONE_FAILURE" for gitlab-ci. There will always be a possibility that something is temporaly broken. If you use "DONE_FAILURE" …

    miserymisery

    see above

    miserymisery

    see above

    miserymisery

    So you will post the "summary" just for the initial pipeline and ignores all of child-pipeline? Well, most times the …

    miserymisery

    I used detailed_status for this. Otherwise you cannot have "success with warnings" or something like this.

    miserymisery

    Why? The child pipeline is a more interesting part. So the direct link to that pipeline should have higher priority. …

    miserymisery

    why not stage anymore?

    miserymisery

    this will use a lot of lines here... we have 51 jobs.

    miserymisery

    Can we put this in an "Instance variables" block below the fields?

    chipx86chipx86

    line too long (90 > 79 characters) Column: 80 Error code: E501

    reviewbotreviewbot
    Checks run (1 failed, 1 succeeded)
    flake8 failed.
    JSHint passed.

    flake8

    david
    Review request changed
    Commits:
    Summary ID
    Add GitLab CI integration.
    This change adds support for GitLab CI integration. This works similarly to how many of our integrations do, where the integration can trigger a new pipeline. Because of how pipeline configurations work, we can't completely replace the configuration when starting the pipeline. We therefore send necessary information as variables, and it's up to the user to add what they need to their .gitlab-ci.yml file. Documentation for how to do all of that will be in a separate change for the Review Board manual. This does have one additional feature over other CI integrations, where the individual job state can be posted as a review. Based on work by André Klitzing at /r/14211. There are a few differences in functionality from that change: - Rather than asking the user to put the API token into the GitLab WebHook configuration's secret field, we allow (optionally) setting a specific secret key for both the webhook and the integration. - Instead of posting job results in a review and then deleting it whenever there's an update, those results are put into a general comment (without an issue) and then the text of that comment gets updated. We theoretically like to treat comment text as immutable once published, but in this case I think it's fine. - I've gotten rid of the `gitlab_old_pipeline` setting entirely. In the case that pipelines are getting rerun, I think it makes sense to always get those updates on Review Board. In the case where a child pipeline is sending updates, I've just added notes in the documentation that triggers really should set `strategy: depend` so that parent pipelines will wait for their children to complete. - I've added a new dependency on `pydantic` for parsing the WebHook payload structure. - Added unit tests for everything. - Various things have been renamed and cleaned up to match our style. Testing Done: - Created a variety of GitLab CI setups, including simple jobs and parent/child pipelines. Verified that pipelines were triggered successfully and results posted back. - Ran unit tests.
    930d3a5f6192cf264f1bf8d1ebf3f342bb9db8f0
    Add GitLab CI integration.
    This change adds support for GitLab CI integration. This works similarly to how many of our integrations do, where the integration can trigger a new pipeline. Because of how pipeline configurations work, we can't completely replace the configuration when starting the pipeline. We therefore send necessary information as variables, and it's up to the user to add what they need to their .gitlab-ci.yml file. Documentation for how to do all of that will be in a separate change for the Review Board manual. This does have one additional feature over other CI integrations, where the individual job state can be posted as a review. Based on work by André Klitzing at /r/14211. There are a few differences in functionality from that change: - Rather than asking the user to put the API token into the GitLab WebHook configuration's secret field, we allow (optionally) setting a specific secret key for both the webhook and the integration. - Instead of posting job results in a review and then deleting it whenever there's an update, those results are put into a general comment (without an issue) and then the text of that comment gets updated. We theoretically like to treat comment text as immutable once published, but in this case I think it's fine. - I've gotten rid of the `gitlab_old_pipeline` setting entirely. In the case that pipelines are getting rerun, I think it makes sense to always get those updates on Review Board. In the case where a child pipeline is sending updates, I've just added notes in the documentation that triggers really should set `strategy: depend` so that parent pipelines will wait for their children to complete. - I've added a new dependency on `pydantic` for parsing the WebHook payload structure. - Added unit tests for everything. - Various things have been renamed and cleaned up to match our style. Testing Done: - Created a variety of GitLab CI setups, including simple jobs and parent/child pipelines. Verified that pipelines were triggered successfully and results posted back. - Ran unit tests.
    d98877b862d2c5366966b4b0665cc7d1c449b0e8

    Checks run (1 failed, 1 succeeded)

    flake8 failed.
    JSHint passed.

    flake8

    chipx86
    1. 
        
    2. rbintegrations/gitlabci/forms.py (Diff revision 2)
       
       
      Show all issues

      This should be in the multi-line form.

    3. rbintegrations/gitlabci/forms.py (Diff revision 2)
       
       
       
       
       
      Show all issues

      It's probably worth using Django's TextChoices enum for these going forward. That gives us stable constants to refer to while also giving us a choices attribute for fields.

    4. rbintegrations/gitlabci/forms.py (Diff revision 2)
       
       
      Show all issues

      This help text doen't give a lot of useful information. We should at least give an example.

    5. rbintegrations/gitlabci/forms.py (Diff revision 2)
       
       
      Show all issues

      This is missing a trailing period.

    6. rbintegrations/gitlabci/forms.py (Diff revision 2)
       
       
      Show all issues

      "Git"

    7. rbintegrations/gitlabci/forms.py (Diff revision 2)
       
       
      Show all issues

      "GitLab"

    8. rbintegrations/gitlabci/forms.py (Diff revision 2)
       
       
      Show all issues

      We normally have required before help_text (including in the field above), so we should make this match.

    9. rbintegrations/gitlabci/forms.py (Diff revision 2)
       
       
      Show all issues

      We never return a value from this function. in the success case.

    10. rbintegrations/gitlabci/forms.py (Diff revision 2)
       
       
      Show all issues

      "GitLab"

    11. rbintegrations/gitlabci/integration.py (Diff revision 2)
       
       
      Show all issues

      Missing localization.

      1. I don't think this should ever be localized. "GitLab CI" is effectively a trade name, and we don't wrap any of the others (Travis CI, Asana, etc.)

    12. rbintegrations/gitlabci/integration.py (Diff revision 2)
       
       
      Show all issues

      Missing localization.

    13. rbintegrations/gitlabci/integration.py (Diff revision 2)
       
       
       
      Show all issues

      Instead of casting, we should pull out the variable and check its type, raising an exception if it's not a string. That'd avoid any surprises, since we're technically dealing with user input.

    14. rbintegrations/gitlabci/integration.py (Diff revision 2)
       
       
      Show all issues

      "GitLab"

    15. rbintegrations/gitlabci/integration.py (Diff revision 2)
       
       
      Show all issues

      Can you place this one alphabetically? All the rest seem fine.

    16. rbintegrations/gitlabci/integration.py (Diff revision 2)
       
       
      Show all issues

      Same note as above regarding type safety.

    17. rbintegrations/gitlabci/integration.py (Diff revision 2)
       
       
       
       
       
       
      Show all issues

      Can we make these keyword-only?

    18. rbintegrations/gitlabci/integration.py (Diff revision 2)
       
       
      Show all issues

      If we're inlining this, we should probably prefix with a _ so it's clear it's not a public function.

      Ideally, we'd avoid inlining if we don't have to, though. Might be worth moving this out.

    19. rbintegrations/gitlabci/integration.py (Diff revision 2)
       
       
      Show all issues

      This is a little hard to read. Can we move name to the next line so it doesn't appear to be part of the lambda?

    20. rbintegrations/gitlabci/tests.py (Diff revision 2)
       
       
      Show all issues

      This is in the wrong import group.

    21. rbintegrations/gitlabci/tests.py (Diff revision 2)
       
       
       
       
      Show all issues

      Can you make these keyword-only?

    22. rbintegrations/gitlabci/tests.py (Diff revision 2)
       
       
       
       
       
       
       
       
       
       
       
       
      Show all issues

      These should all be , optional.

    23. rbintegrations/gitlabci/tests.py (Diff revision 2)
       
       
       
      Show all issues

      Can you make this multi-line so it's easier to read/maintain?

      Also, we should pass save=False since we're setting things and then saving.

    24. rbintegrations/gitlabci/tests.py (Diff revision 2)
       
       
      Show all issues

      Typo: kwargrs -> kwargs

    25. rbintegrations/gitlabci/tests.py (Diff revision 2)
       
       
       
       
       
       
       
      Show all issues

      Nit: You could just decorate the above with @spy_for.

      Same below.

    26. rbintegrations/gitlabci/tests.py (Diff revision 2)
       
       
       
       
      Show all issues

      Can you update these for keyword-only arguments?

    27. rbintegrations/gitlabci/tests.py (Diff revision 2)
       
       
       
       
      Show all issues

      You can just pass base_commit_id= in as a parameter and avoid the double-save.

    28. rbintegrations/gitlabci/tests.py (Diff revision 2)
       
       
       
      Show all issues

      Let's keep one per line.

    29. rbintegrations/gitlabci/tests.py (Diff revision 2)
       
       
      Show all issues

      Can we test the exact error?

      Here and below.

    30. rbintegrations/gitlabci/tests.py (Diff revision 2)
       
       
       
      Show all issues

      Blank line between statements and comments.

    31. rbintegrations/gitlabci/tests.py (Diff revision 2)
       
       
      Show all issues

      We access self.review_request a lot, so let's initially set it locally, set self.review_request, and then access the local copy.

    32. rbintegrations/gitlabci/tests.py (Diff revision 2)
       
       
       
       
       
       
       
       
      Show all issues

      Can we just test the entire dictionary in one go? Avoid surprises later?

    33. rbintegrations/gitlabci/urls.py (Diff revision 2)
       
       
      Show all issues

      we normally do one per line.

    34. rbintegrations/gitlabci/views.py (Diff revision 2)
       
       
       
      Show all issues

      Why 202? It's really unclear how this is used here and below. Can we document this?

      I think more of the hook could really use some documentation to make the requirements and responses more clear, especially if 202 is correct.

    35. rbintegrations/gitlabci/views.py (Diff revision 2)
       
       
      Show all issues

      The error isn't going to be very useful by itself. Can we add to it?

    36. rbintegrations/gitlabci/views.py (Diff revision 2)
       
       
      Show all issues

      We're not consistent here and with the above or below logs. We should stick to a very consistent format for these.

    37. rbintegrations/gitlabci/views.py (Diff revision 2)
       
       
       
      Show all issues

      While this should never fail, it'd be nice to do this check early before all the validation.

      1. This assert is really just here to satisfy type checkers.

    38. rbintegrations/gitlabci/views.py (Diff revision 2)
       
       
      Show all issues

      We shouldn't assert, as that doesn't survive optimized builds. Good for internal usage, but for type-checking user-controllable state, we need to do an explicit check and a raise.

    39. rbintegrations/gitlabci/views.py (Diff revision 2)
       
       
       
       
      Show all issues

      No need for the blank line here.

    40. rbintegrations/gitlabci/views.py (Diff revision 2)
       
       
       
      Show all issues

      I know we're using Pydantic to verify, but then why do we need to assert here? Don't we get the right type and the guarantee?

      1. This was left over from before I introduced pydantic.

    41. rbintegrations/gitlabci/views.py (Diff revision 2)
       
       
      Show all issues

      This is a bit vague. Can we say "Unknown build status for <something>"?

    42. rbintegrations/gitlabci/views.py (Diff revision 2)
       
       
      Show all issues

      "URL"

    43. rbintegrations/gitlabci/views.py (Diff revision 2)
       
       
      Show all issues

      Something we need to do better at is building of URLs involving user-supplied input. Going to be commenting about this on newer code more. Rather than plugging things into a path, we should be safely feeding values into URLs using quote(), so we don't risk a case where some stray / or ? risks a vulnerability.

      There may be more places in this code that need to do this.

      1. project_url shouldn't be quoted because it's the fully-qualified URL to the gitlab project, and job_id is validated to be an int when we decode the payload.

    44. rbintegrations/gitlabci/views.py (Diff revision 2)
       
       
      Show all issues

      This has user-modifiable input, so we need to handle ValueErrors here.

      1. The job IDs are validated as an int when we decode the payload.

    45. rbintegrations/gitlabci/views.py (Diff revision 2)
       
       
      Show all issues

      id is a reserved function. build_id?

    46. rbintegrations/gitlabci/views.py (Diff revision 2)
       
       
      Show all issues

      To be consistent with above logs, we should capitalize "Unknown".

    47. rbintegrations/gitlabci/views.py (Diff revision 2)
       
       
       
      Show all issues

      You can just use GeneralComment.objects.create(...).

      Also, one keyword arg per line.

    48. setup.py (Diff revision 2)
       
       
      Show all issues

      So where I think this is going to bite us is that by having such a specific compatibility requirement here in rbintegrations, we're going to collide with Review Board or eventually some other third-party dependency, and with the wider rbintegrations compatibility range for Review Board, this will ultimately affect us elsewhere.

      How wide a range can we safely apply here?

      I feel like if we're going to support pydantic, it makes sense to have that dependency as part of the Review Board platform, and keep the dependency there. Of course, that doesn't help rbintegrations on older versions, but that's where we can work around that with a wider range.

      1. Ok, looking through their changelog, in theory with my current usage we could support pydantic~=2.0, but I think pydantic~=2.5 is a good baseline.

    49. 
        
    david
    Review request changed
    Commits:
    Summary ID
    Add GitLab CI integration.
    This change adds support for GitLab CI integration. This works similarly to how many of our integrations do, where the integration can trigger a new pipeline. Because of how pipeline configurations work, we can't completely replace the configuration when starting the pipeline. We therefore send necessary information as variables, and it's up to the user to add what they need to their .gitlab-ci.yml file. Documentation for how to do all of that will be in a separate change for the Review Board manual. This does have one additional feature over other CI integrations, where the individual job state can be posted as a review. Based on work by André Klitzing at /r/14211. There are a few differences in functionality from that change: - Rather than asking the user to put the API token into the GitLab WebHook configuration's secret field, we allow (optionally) setting a specific secret key for both the webhook and the integration. - Instead of posting job results in a review and then deleting it whenever there's an update, those results are put into a general comment (without an issue) and then the text of that comment gets updated. We theoretically like to treat comment text as immutable once published, but in this case I think it's fine. - I've gotten rid of the `gitlab_old_pipeline` setting entirely. In the case that pipelines are getting rerun, I think it makes sense to always get those updates on Review Board. In the case where a child pipeline is sending updates, I've just added notes in the documentation that triggers really should set `strategy: depend` so that parent pipelines will wait for their children to complete. - I've added a new dependency on `pydantic` for parsing the WebHook payload structure. - Added unit tests for everything. - Various things have been renamed and cleaned up to match our style. Testing Done: - Created a variety of GitLab CI setups, including simple jobs and parent/child pipelines. Verified that pipelines were triggered successfully and results posted back. - Ran unit tests.
    d98877b862d2c5366966b4b0665cc7d1c449b0e8
    Add GitLab CI integration.
    This change adds support for GitLab CI integration. This works similarly to how many of our integrations do, where the integration can trigger a new pipeline. Because of how pipeline configurations work, we can't completely replace the configuration when starting the pipeline. We therefore send necessary information as variables, and it's up to the user to add what they need to their .gitlab-ci.yml file. Documentation for how to do all of that will be in a separate change for the Review Board manual. This does have one additional feature over other CI integrations, where the individual job state can be posted as a review. Based on work by André Klitzing at /r/14211. There are a few differences in functionality from that change: - Rather than asking the user to put the API token into the GitLab WebHook configuration's secret field, we allow (optionally) setting a specific secret key for both the webhook and the integration. - Instead of posting job results in a review and then deleting it whenever there's an update, those results are put into a general comment (without an issue) and then the text of that comment gets updated. We theoretically like to treat comment text as immutable once published, but in this case I think it's fine. - I've gotten rid of the `gitlab_old_pipeline` setting entirely. In the case that pipelines are getting rerun, I think it makes sense to always get those updates on Review Board. In the case where a child pipeline is sending updates, I've just added notes in the documentation that triggers really should set `strategy: depend` so that parent pipelines will wait for their children to complete. - I've added a new dependency on `pydantic` for parsing the WebHook payload structure. - Added unit tests for everything. - Various things have been renamed and cleaned up to match our style. Testing Done: - Created a variety of GitLab CI setups, including simple jobs and parent/child pipelines. Verified that pipelines were triggered successfully and results posted back. - Ran unit tests.
    d25add94f949105de3b4ad82dae5b1a63ec39c51

    Checks run (1 failed, 1 succeeded)

    flake8 failed.
    JSHint passed.

    flake8

    maubin
    1. Ship It!
    2. 
        
    misery
    1. 
        
    2. Show all issues

      Looks like this won't fit to our workflow anymore. Is it possible to derive from this in a separate custom extension and use this to rbintegrations?

      1. Yep, that's absolutely possible.

      2. So it would be nice if there are more function that can be replaced in derived class. So I can derive from it and add our custom handling without re-write the whole class.

    3. rbintegrations/gitlabci/integration.py (Diff revision 3)
       
       
      Show all issues

      This is called REVIEWBOARD_REVIEW_ID in jenkins integration. That should be unified.

      1. Unfortunately we already have different values. Jenkins uses REVIEWOBARD_REVIEW_UI but CircleCI uses REVIEWBOARD_REVIEW_REQUEST. Given that we have a choice here, I think REVIEW_REQUEST is the better name (since a "review" is its own type of object with its own IDs)

    4. rbintegrations/gitlabci/views.py (Diff revision 3)
       
       
      Show all issues

      never use "DONE_FAILURE" for gitlab-ci. There will always be a possibility that something is temporaly broken. If you use "DONE_FAILURE" you cannot RETRY the pipeline from RB.

      DONE_FAILURE is a nice concept from RB, but it doesn’t reflect the reality in production.

    5. rbintegrations/gitlabci/views.py (Diff revision 3)
       
       
      Show all issues

      see above

    6. rbintegrations/gitlabci/views.py (Diff revision 3)
       
       
      Show all issues

      see above

    7. rbintegrations/gitlabci/views.py (Diff revision 3)
       
       
      Show all issues

      So you will post the "summary" just for the initial pipeline and ignores all of child-pipeline?

      Well, most times the "initial" pipeline should be just one job to spawn a child-pipeline with all important jobs because the gitlab-ci.yaml needs to be patched first with the diff from review request.

      So this summary is pretty useless and cannot be configured anymore.

      1. Given that there can be multiple children, I really don't think it's a good idea to overwrite status/url/etc with any values coming from child pipelines. In the docs at /r/14464 I stress that if you're using child pipelines, your config needs to include strategy: depend so that the parent status depends on the child status.

      2. We always use "depend" but that won't change anything for the summary.

    8. rbintegrations/gitlabci/views.py (Diff revision 3)
       
       
      Show all issues

      I used detailed_status for this. Otherwise you cannot have "success with warnings" or something like this.

      1. I haven't been able to find a good reference for the possible values for detailed_status.

    9. rbintegrations/gitlabci/views.py (Diff revision 3)
       
       
       
       
       
       
      Show all issues

      Why? The child pipeline is a more interesting part. So the direct link to that pipeline should have higher priority. Otherwise the developer need to click into parent-pipeline and then select child-pipeline. That is really annonying.

      1. As I replied above, while it may work in your use case of a single child, the more general solution is to use strategy: depend so that the parent state mirrors the child.

        Direct links to child pipelines isn't a bad idea though. Perhaps include those along with the links to builds?

    10. rbintegrations/gitlabci/views.py (Diff revision 3)
       
       
      Show all issues

      why not stage anymore?

    11. rbintegrations/gitlabci/views.py (Diff revision 3)
       
       
      Show all issues

      this will use a lot of lines here... we have 51 jobs.

      1. I'll break this stuff out into a method so you can override it and format it however you like.

    12. 
        
    misery
    1. 
        
    2. rbintegrations/gitlabci/forms.py (Diff revision 3)
       
       
      Show all issues

      I changed it to GitlabError because "error 404" is not an authentication error.

    3. 
        
    david
    Review request changed
    Commits:
    Summary ID
    Add GitLab CI integration.
    This change adds support for GitLab CI integration. This works similarly to how many of our integrations do, where the integration can trigger a new pipeline. Because of how pipeline configurations work, we can't completely replace the configuration when starting the pipeline. We therefore send necessary information as variables, and it's up to the user to add what they need to their .gitlab-ci.yml file. Documentation for how to do all of that will be in a separate change for the Review Board manual. This does have one additional feature over other CI integrations, where the individual job state can be posted as a review. Based on work by André Klitzing at /r/14211. There are a few differences in functionality from that change: - Rather than asking the user to put the API token into the GitLab WebHook configuration's secret field, we allow (optionally) setting a specific secret key for both the webhook and the integration. - Instead of posting job results in a review and then deleting it whenever there's an update, those results are put into a general comment (without an issue) and then the text of that comment gets updated. We theoretically like to treat comment text as immutable once published, but in this case I think it's fine. - I've gotten rid of the `gitlab_old_pipeline` setting entirely. In the case that pipelines are getting rerun, I think it makes sense to always get those updates on Review Board. In the case where a child pipeline is sending updates, I've just added notes in the documentation that triggers really should set `strategy: depend` so that parent pipelines will wait for their children to complete. - I've added a new dependency on `pydantic` for parsing the WebHook payload structure. - Added unit tests for everything. - Various things have been renamed and cleaned up to match our style. Testing Done: - Created a variety of GitLab CI setups, including simple jobs and parent/child pipelines. Verified that pipelines were triggered successfully and results posted back. - Ran unit tests.
    d25add94f949105de3b4ad82dae5b1a63ec39c51
    Add GitLab CI integration.
    This change adds support for GitLab CI integration. This works similarly to how many of our integrations do, where the integration can trigger a new pipeline. Because of how pipeline configurations work, we can't completely replace the configuration when starting the pipeline. We therefore send necessary information as variables, and it's up to the user to add what they need to their .gitlab-ci.yml file. Documentation for how to do all of that will be in a separate change for the Review Board manual. This does have one additional feature over other CI integrations, where the individual job state can be posted as a review. Based on work by André Klitzing at /r/14211. There are a few differences in functionality from that change: - Rather than asking the user to put the API token into the GitLab WebHook configuration's secret field, we allow (optionally) setting a specific secret key for both the webhook and the integration. - Instead of posting job results in a review and then deleting it whenever there's an update, those results are put into a general comment (without an issue) and then the text of that comment gets updated. We theoretically like to treat comment text as immutable once published, but in this case I think it's fine. - I've gotten rid of the `gitlab_old_pipeline` setting entirely. In the case that pipelines are getting rerun, I think it makes sense to always get those updates on Review Board. In the case where a child pipeline is sending updates, I've just added notes in the documentation that triggers really should set `strategy: depend` so that parent pipelines will wait for their children to complete. - I've added a new dependency on `pydantic` for parsing the WebHook payload structure. - Added unit tests for everything. - Various things have been renamed and cleaned up to match our style. Testing Done: - Created a variety of GitLab CI setups, including simple jobs and parent/child pipelines. Verified that pipelines were triggered successfully and results posted back. - Ran unit tests.
    19c71a9c94a786814505aa1e2a2904b912cec0b3
    Added Files:

    Checks run (1 failed, 1 succeeded)

    flake8 failed.
    JSHint passed.

    flake8

    TD
    1. 
        
    2. Could you please share an update about the status of these changes?
      Is anything blocking its acceptance in a new release?

    3. 
        
    chipx86
    1. Looks great. I see one tiny thing, but otherwise it seems ready to go.

    2. rbintegrations/gitlabci/forms.py (Diff revision 4)
       
       
      Show all issues

      Can we put this in an "Instance variables" block below the fields?

    3. 
        
    maubin
    1. Ship It!
    2. 
        
    david
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to master (3c8c9a7)