Skip to content
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

[server][github] fix file provider for self-managed GHE #13108

Merged
merged 1 commit into from
Sep 20, 2022

Conversation

AlexTugarev
Copy link
Member

@AlexTugarev AlexTugarev commented Sep 20, 2022

Description

This PR removes URL construction for reading file contents, instead rely on supported REST API.

Related Issue(s)

Fixes #9253

How to test

Though this claims to fix an GHE issue, it can be verified with GitHub SaaS as well, because the core issue was that we'd used to craft the download URL, but here we're changing to supported means of fetching contents via REST API. That said, if should be sufficient to test .gitpod.yml being read from any GitHub repo in a prebuild of a project.

Release Notes

Fix reading .gitpod.yml for self-managed GHE instances.

Documentation

Werft options:

  • /werft with-preview
  • /werft with-integration-tests=all
    Valid options are all, workspace, webapp, ide

@AlexTugarev AlexTugarev requested a review from a team September 20, 2022 07:33
@github-actions github-actions bot added the team: webapp Issue belongs to the WebApp team label Sep 20, 2022
@werft-gitpod-dev-com
Copy link

started the job as gitpod-build-alex-adjust-url-being-used-to-fetch-9253.0 because the annotations in the pull request description changed
(with .werft/ from main)

@werft-gitpod-dev-com
Copy link

started the job as gitpod-build-alex-adjust-url-being-used-to-fetch-9253.1 because the annotations in the pull request description changed
(with .werft/ from main)

@geropl geropl self-assigned this Sep 20, 2022
@geropl
Copy link
Member

geropl commented Sep 20, 2022

@AlexTugarev During testing, while creating a project from my personal repo in GH, I see this error message:
image

As a result, the project seems to be there, but it does not receive any prebuild triggers... any idea why? 🤔

@AlexTugarev
Copy link
Member Author

AlexTugarev commented Sep 20, 2022

As a result, the project seems to be there, but it does not receive any prebuild triggers... any idea why? 🤔

Unfortunately, not.

I tried to reproduce with a fork of that repo, but it worked fine.

@geropl, please repeat, as I just enabled debug logging for server.

/hold

Because of this report, and I'm not able to tell if this is unrelate, though it seems. And because I forgot to remove dead code.

@geropl
Copy link
Member

geropl commented Sep 20, 2022

@AlexTugarev seeing this in the logs:

{
  "@type": "type.googleapis.com/google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent",
  "serviceContext": {
    "service": "server",
    "version": "alex-adjust-url-being-used-to-fetch-9253.0"
  },
  "stack_trace": "GitHubApiError: GitHub API Error. Status: 422
    at GitHubRestApi.<anonymous> (/app/node_modules/@gitpod/server/dist/src/github/api.js:198:27)
    at Generator.throw (<anonymous>)
    at rejected (/app/node_modules/@gitpod/server/dist/src/github/api.js:20:65)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)",
  "component": "server",
  "severity": "ERROR",
  "time": "2022-09-20T12:33:47.225Z",
  "context": { "userId": "5c510231-73e4-4650-993d-644ba9b21745" },
  "message": "Request createProject failed with internal server error",
  "error": "GitHubApiError: GitHub API Error. Status: 422
    at GitHubRestApi.<anonymous> (/app/node_modules/@gitpod/server/dist/src/github/api.js:198:27)
    at Generator.throw (<anonymous>)
    at rejected (/app/node_modules/@gitpod/server/dist/src/github/api.js:20:65)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)",
  "payload": {
    "method": "createProject",
    "args": [
      {
        "name": "gitpod-test-repo",
        "slug": "gitpod-test-repo",
        "cloneUrl": "https://github.com/geropl/gitpod-test-repo.git",
        "teamId": "5b65b970-9b57-4857-a6f8-3c953f6d04d7",
        "appInstallationId": "undefined"
      },
      { "_isCancelled": false }
    ]
  }
}

@AlexTugarev
Copy link
Member Author

AlexTugarev commented Sep 20, 2022

@geropl, could you please try again and use a different repo? I guess your test repo had see a lot of webhooks already 🤷🏻‍♂️

The error event is likely fired from there, thus not related to this PR. Let's tell the issues apart 🙏🏻

Screen Shot 2022-09-20 at 16 00 52

Copy link
Member

@geropl geropl left a comment

Choose a reason for hiding this comment

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

With different repository I see prebuilds working as expected

/hold in case any other check is required 🙃

@AlexTugarev
Copy link
Member Author

With different repository I see prebuilds working as expected

This is then subject to a bug with webhook installation on GH repos.

cc. @jankeromnes, in cause you've encountered 422 error codes before?

@AlexTugarev
Copy link
Member Author

/hold cancel

@roboquat roboquat merged commit f28e996 into main Sep 20, 2022
@roboquat roboquat deleted the alex/adjust-url-being-used-to-fetch-9253 branch September 20, 2022 14:30
@roboquat roboquat added deployed: webapp Meta team change is running in production deployed Change is completely running in production labels Sep 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployed: webapp Meta team change is running in production deployed Change is completely running in production release-note size/L team: webapp Issue belongs to the WebApp team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adjust URL Being Used To Fetch .gitpod.yml Files From GitHub Enterprise Instances
3 participants