Lighthouse-ci: Gitlab with Github App - "No GitHub remote found"

Created on 22 Mar 2020  Â·  4Comments  Â·  Source: GoogleChrome/lighthouse-ci

I run lighthouse-ci successfully via Gitlab but it fails to send Github status reports via your app. It finds the token provided but it can't infer the remote. If it needs to have the app built within the same job - I would like to avoid that. This is done by another job but inside of a different docker image and hence, I am afraid, not accessible.

# gitlab-ci.yml
image: docker:latest
services:
    - cypress/browsers:node10.16.0-chrome77
variables:
    LHCI_GITHUB_APP_TOKEN: foo
lighthouse-test:
    stage: monitor
    image: cypress/browsers:node10.16.0-chrome77
    script:
        - lhci autorun --config=./lighthouse.json --collect.puppeteer-launch-options.args=--no-sandbox
{
  "ci": {
    "assert": {
      "preset": "lighthouse:no-pwa"
    },
    "collect": {
      "puppeteerLaunchOptions": {
        "args": ["noSandbox"]
      },
      "numberOfRuns": 3,
      "puppeteerScript": "./lighthouse-login.js",
      "settings": {
        "disableStorageReset": "true"
      },
      "url": "foo.com"
    },
    "upload": {
      "target": "temporary-public-storage"
    }
  }
}
 $ npm run test-lighthouse
 > ...
 > lhci autorun --config=./lighthouse.json --collect.puppeteer-launch-options.args=--no-sandbox
 ✅  .lighthouseci/ directory writable
 ✅  Configuration file found
 ✅  Chrome installation found
 Healthcheck passed!
 Running Lighthouse 3 time(s) on foo.com
 Run #1...done.
 Run #2...done.
 Run #3...done.
 Done running Lighthouse!
 Checking assertions against 1 URL(s), 3 total run(s)
 All results processed!
 Uploading median LHR of foo.com...success!
 Open the report at https://storage.googleapis.com/lighthouse-infrastructure.appspot.com/reports/....report.html
 GitHub token found, attempting to set status...
 No GitHub remote found, skipping.
 Done running autorun.
question

All 4 comments

Thanks for filing @PaulKujawa! I'm a little confused though. Are you using Gitlab or Github?

The github app and status checks are only for github. If you're using gitlab you'll need to rely on the exit code of lhci assert to fail the build through your CI without a separate dedicated status check for Lighthouse CI.

@patrickhulce the project is hosted on Github and only mirrored to Gitlab - for reasons unknown to me.
I believe this setup should, in theory, still work with the Github app.

Ah OK, then it must be cloned from the mirror instead of from GitHub.

You have two options:

  • Set the LHCI_BUILD_CONTEXT__GIT_REMOTE environment variable to the value of your GitHub remote (e.g. [email protected]:GoogleChrome/lighthouse-ci.git)
  • Clone the repo from GitHub instead of Gitlab in CI (maybe not possible since you're using Gitlab's CI?)

Option number one worked! That is amazing! Thank you so much 🙇

Was this page helpful?
0 / 5 - 0 ratings