Skip to content

Update GitLab REST client library #18523

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Aug 28, 2023
Merged

Update GitLab REST client library #18523

merged 7 commits into from
Aug 28, 2023

Conversation

AlexTugarev
Copy link
Member

@AlexTugarev AlexTugarev commented Aug 16, 2023

Description

  • Execute gitlab tests manually
Summary generated by Copilot

🤖 Generated by Copilot at a8ec98a

Updated @gitbeaker/node dependency to fix GitLab pagination bug and moved package.json file to components/server directory to simplify workspace setup and dependency management.

Related Issue(s)

Fixes #

How to test

Documentation

Preview status

Gitpod was successfully deployed to your preview environment.

Build Options

Build
  • /werft with-werft
    Run the build with werft instead of GHA
  • leeway-no-cache
  • /werft no-test
    Run Leeway with --dont-test
Publish
  • /werft publish-to-npm
  • /werft publish-to-jb-marketplace
Installer
  • analytics=segment
  • with-dedicated-emulation
  • workspace-feature-flags
    Add desired feature flags to the end of the line above, space separated
Preview Environment / Integration Tests
  • /werft with-local-preview
    If enabled this will build install/preview
  • /werft with-preview
  • /werft with-large-vm
  • /werft with-gce-vm
    If enabled this will create the environment on GCE infra
  • with-integration-tests=all
    Valid options are all, workspace, webapp, ide, jetbrains, vscode, ssh. If enabled, with-preview and with-large-vm will be enabled.
  • with-monitoring

/hold

@geropl
Copy link
Member

geropl commented Aug 16, 2023

@AlexTugarev I checked last time, and all versions of gitbeaker/node still pull the outdated packages.
IMO we need to switch to gitbeaker/rest (or however it was called).

@socket-security
Copy link

socket-security bot commented Aug 16, 2023

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Packages Version New capabilities Transitives Size Publisher
@gitbeaker/rest 39.12.0 network +0 94.6 kB jdalrymple

🚮 Removed packages: @gitbeaker/[email protected]

@AlexTugarev
Copy link
Member Author

@gitbeaker/rest is requiring to update to node 18.

@roboquat roboquat added size/XL and removed size/M labels Aug 24, 2023
@jeanp413 jeanp413 force-pushed the at/bump-gitlab-client branch from b2a13f4 to b64cead Compare August 24, 2023 15:42
@roboquat roboquat added size/L and removed size/XL labels Aug 24, 2023
@jeanp413
Copy link
Member

jeanp413 commented Aug 24, 2023

/gh run recreate-vm

Comment triggered a workflow run

Started workflow run: 5967083536

  • recreate_vm: true

@jeanp413
Copy link
Member

jeanp413 commented Aug 24, 2023

/gh run recreate-vm

Comment triggered a workflow run

Started workflow run: 5968021546

  • recreate_vm: true

@jeanp413 jeanp413 marked this pull request as ready for review August 24, 2023 19:55
@jeanp413
Copy link
Member

What does it mean to Execute gitlab tests manually? connect with gitlab from dashboard and open some repo?

@akosyakov
Copy link
Member

akosyakov commented Aug 25, 2023

/gh run recreate-vm

Comment triggered a workflow run

Started workflow run: 5973428167

  • recreate_vm: true

@akosyakov akosyakov requested a review from mustard-mh August 25, 2023 09:36
Copy link
Contributor

@mustard-mh mustard-mh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM, tried with project / workspace create, prebuild webhook worked well too
image

@mustard-mh
Copy link
Contributor

What does it mean to Execute gitlab tests manually? connect with gitlab from dashboard and open some repo?

@jeanp413 Maybe is that in those *.spec.ts files related to Gitlab, most of them will skip if we don't provide a test token, so you can export this var if you want to Execute gitlab tests manually

skip(ifEnvVarNotSet("GITPOD_TEST_TOKEN_GITLAB")

@mustard-mh
Copy link
Contributor

mustard-mh commented Aug 25, 2023

Once want to try with it, but test cases repo are owned by Alex, so I can't do test manually. Would be good to have test cases under gitpod accounts?

@AlexTugarev
Copy link
Member Author

npx mocha --opts mocha.opts './**/gitlab-*.spec.js'

I'm looking into failing tests right now.

  22 passing (14s)
  2 pending
  7 failing

  1) TestGitlabContextParser
       testTreeContext_03:
     Uncaught Error: Not Found

@AlexTugarev
Copy link
Member Author

AlexTugarev commented Aug 28, 2023

Just realized that branches are not retrievable.

When trying to parse the following context, it fails fetching branch wip
https://gitlab.com/AlexTugarev/gp-test/-/blob/wip/README.md

Update: this might be cause by a change of the error shape of the library. It is not expected to throw on 404, but return a Not Found error object. It looks like the weak detected broke, thus all kind of similar cases could be broken. See attached screenshot.

Screenshot 2023-08-28 at 14 11 16

Several places relied on a particular shape of errors.
@AlexTugarev AlexTugarev marked this pull request as ready for review August 28, 2023 12:49
@AlexTugarev AlexTugarev requested a review from mustard-mh August 28, 2023 12:49
@@ -128,16 +115,16 @@ export namespace GitLab {
return !!something && something.name === "GitLabApiError";
}
export function isNotFound(error: ApiError): boolean {
return !!error.httpError?.description.startsWith("404");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've seen the startsWith of undefined before, and it was related to GitLab contexts. 🙏🏻 hopefully that's the cause

@AlexTugarev
Copy link
Member Author

/unhold

@roboquat roboquat merged commit 5efb011 into main Aug 28, 2023
@roboquat roboquat deleted the at/bump-gitlab-client branch August 28, 2023 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants