Lighthouse in GitLab CI - docker

I'm trying to use Lighthouse in GitLab CI to run a scan against a remote website after a deploy. The job keeps throwing an error.
My job configuration looks like this:
lighthouse:
stage: scan
image: markhobson/node-chrome
script:
- npm install -g lighthouse lighthouse-plugin-field-performance --unsafe-perm
- lighthouse $URL --plugins=lighthouse-plugin-field-performance --chrome-flags=”--headless --no-sandbox” --verbose
I've also tried with image: buildkite/puppeteer. In both instances I get a similar error when I try to invoke Lighthouse, which looks like this:
Wed, 09 Oct 2019 20:22:42 GMT ChromeLauncher:verbose created /tmp/lighthouse.KXhqWF0
Wed, 09 Oct 2019 20:22:42 GMT ChromeLauncher:verbose Launching with command:
"/usr/bin/google-chrome-stable" --disable-translate --disable-extensions --disable-background-networking --disable-sync --metrics-recording-only --disable-default-apps --mute-audio --no-first-run --remote-debugging-port=44495 --disable-setuid-sandbox --user-data-dir=/tmp/lighthouse.KXhqWF0 about:blank
Wed, 09 Oct 2019 20:22:42 GMT ChromeLauncher:verbose Chrome running with pid 36 on port 44495.
Wed, 09 Oct 2019 20:22:42 GMT ChromeLauncher Waiting for browser.
Wed, 09 Oct 2019 20:22:42 GMT ChromeLauncher Waiting for browser...
Wed, 09 Oct 2019 20:22:43 GMT ChromeLauncher Waiting for browser.....
Wed, 09 Oct 2019 20:22:43 GMT ChromeLauncher Waiting for browser.......
Wed, 09 Oct 2019 20:22:44 GMT ChromeLauncher Waiting for browser.........
Wed, 09 Oct 2019 20:22:44 GMT ChromeLauncher Waiting for browser...........
etc
Wed, 09 Oct 2019 20:23:07 GMT ChromeLauncher:error connect ECONNREFUSED 127.0.0.1:44495
Wed, 09 Oct 2019 20:23:07 GMT ChromeLauncher:error Logging contents of /tmp/lighthouse.KXhqWF0/chrome-err.log
Wed, 09 Oct 2019 20:23:07 GMT ChromeLauncher:error
(google-chrome-stable:36): Gtk-WARNING **: cannot open display:
[1009/202244.656645:ERROR:nacl_helper_linux.cc(310)] NaCl helper process running without a sandbox!
Most likely you need to configure your SUID sandbox correctly
Unable to connect to Chrome
I'm not entirely sure what I need to do at this point. I'm questioning whether or not to try a more basic node image and try installing what I need manually, which I tried originally and found that managing Chrome/Chromium with Lighthouse was not quite as straight-forward as I wanted. Any thoughts or suggestions?

You could try using this image which has both everything installed ready to execute a report https://hub.docker.com/r/femtopixel/google-lighthouse/

Related

Change timestamp on bitbucket

I have made a file and add it on 08 Jul 2019 14:00:00 +0000
but I wanted to show in Bitbucket repository this timestamp: Mon, 08 Jul 2019 11:42:00 +0000.
so I did:
$ git commit -m"try444" --date="Mon, 08 Jul 2019 11:42:00 +0000"
then after the push the Bitbucket still show:08 Jul 2019 14:00:00 +0000
How to change the hour in Bitbucket server??
I have made a file and add it on 08 Jul 2019 14:00:00 +0000
but I wanted to show in Bitbucket repository this timestamp: Mon, 08 Jul 2019 11:42:00 +0000.
so I did:
$ git commit -m"try444" --date="Mon, 08 Jul 2019 11:42:00 +0000"
$ git commit -m"try444" --date="Mon, 08 Jul 2019 11:42:00 +0000"
Bitbucket still show:08 Jul 2019 14:00:00 +0000

Rails - Change TimeWithZone Timezone

I've been banging my head against this for a while and I can't seem to understand how rails timezones and in_time_zone works.
Here is some rails c output that I'd like to understand:
[26] VMM(bby - main - dev)> Time.zone.now
=> Wed, 14 Mar 2018 09:13:17 CDT -05:00
[27] VMM(bby - main - dev)> MyModel.first.started_at
=> Fri, 09 Mar 2018 09:17:00 CST -06:00
[28] VMM(bby - main - dev)> MyModel.first.started_at.in_time_zone(Time.zone)
=> Fri, 09 Mar 2018 09:17:00 CST -06:00
So:
From the first line, the Time.zone seems to be CDT -5.
From the second line, the started_at attribute seem to be CST -6
On the third line, my intention is to change that atribute to use CDT -5, so I'd expect an output of Fri, 09 Mar 2018 10:17:00 CDT -05:00
Why does this behave as it does instead of how I expect it to?
Thanks in advance!

Ruby how to get a date to the default format as it's stored in the db

My db is by default storing times as such:
Object.last.created_at
# => Fri, 03 Jul 2015 23:27:50 UTC +00:00
I looked at the strftime docs and I can build that myself, but it seems there must be an easy way to get a regular Date object to that format? Just wondering if there is...
to_datetime gets really close, but not exactly all the way there.
Date.today.to_datetime
# => Sat, 04 Jul 2015 00:00:00 +0000
Any other ideas?
Try this
Time.zone.now
#=> Sat, 04 Jul 2015 20:32:44 UTC +00:00
UPDATE
DateTime.now.in_time_zone
#=> Sat, 04 Jul 2015 20:43:57 UTC +00:00
Oh silly me... it's just
Date.today.in_time_zone
# => Mon, 06 Jul 2015 00:00:00 UTC +00:00

Rails 2.3.11 shows a datetime wrong at server

I got this error and makes me crazy.
My desired output is shows the week starting at sunday and after that calculate 10 weeks ago based on that.
Example:
[Sun, 12 Aug 2012, Sun, 05 Aug 2012, Sun, 29 Jul 2012, Sun, 22 Jul
2012, Sun, 15 Jul 2012, Sun, 08 Jul 2012, Sun, 01 Jul 2012, Sun, 24
Jun 2012, Sun, 17 Jun 2012, Sun, 10 Jun 2012, Sun, 03 Jun 2012]
But at my machine it's correctly and return the array above, however at the server is wrong :(
The output at server is:
[Sat, 11 Aug 2012, Sat, 04 Aug 2012, Sat, 28 Jul 2012, Sat, 21 Jul
2012, Sat, 14 Jul 2012, Sat, 07 Jul 2012, Sat, 30 Jun 2012, Sat, 23
Jun 2012, Sat, 16 Jun 2012, Sat, 09 Jun 2012, Sat, 02 Jun 2012]
If I access the app and call the controller from script/console shows wrong but If I recalculate at script/console shows correctly.
My environment:
OS X 10.7.4, ruby 1.8.7 (2012-04-14 patchlevel 361)
[i686-darwin11.3.0], rvm 1.10.2, Seg 13 Ago 2012 09:27:46 BRT (system
date)
And server environment:
Ubuntu 12.04, ruby 1.8.7 (2012-02-08 MBARI 8/0x8770 on patchlevel 358)
[i686-linux], MBARI 0x8770, Ruby Enterprise Edition 2012.02, rvm
1.14.0 (stable), Mon Aug 13 13:29:13 WEST 2012
Probably a time zone mismatch on your server, try setting your time zone explicitly in config/appliction.rb:
config.time_zone = "Pacific Time (US & Canada)"
A popular solution to this issue is setting a before_filter on your controller that configures the right time zone per user. See: http://railscasts.com/episodes/106-time-zones-in-rails-2-1 for a starting point.

rails declare absolute time in a specific timezone

how can I get a variable which is holding always Today midnight in my timezone?
The hosting server is several hours behind me, both Time.now.midnight and Date.today are on yesterday date for good part of the day.
Thanks
Found the solution.
now=DateTime.now
=> Fri, 03 Feb 2012 21:57:21 EST -05:00
now.in_time_zone('London').midnight
=> Sat, 04 Feb 2012 00:00:00 GMT +00:00
now.in_time_zone('Hawaii').midnight
=> Fri, 03 Feb 2012 00:00:00 HST -10:00

Resources