Skip to content
This repository has been archived by the owner on Nov 6, 2019. It is now read-only.

Dockerize WPT runs & add Jenkins k8s specs #153

Merged
merged 3 commits into from
Nov 7, 2017
Merged

Dockerize WPT runs & add Jenkins k8s specs #153

merged 3 commits into from
Nov 7, 2017

Conversation

jeffcarp
Copy link
Contributor

@jeffcarp jeffcarp commented Oct 13, 2017

This PR introduces a number of big changes:

  • Adds a Dockerfile for generating a container capable of running any browser of WPT we currently run
    • It does not bundle a version of FF, it uses --install-browser
    • Currently this does not include Chrome
    • The whole running setup is end-to-end tested in Travis CI (FF only for now)
  • Adds Kubernetes specs (in k8s/) for setting up a Jenkins instance (https://ci.wpt.fyi)

Future work after this lands (I will make bugs for these):

  • Get Chrome running in the container (this might involve writing --install-browser for Chrome)
  • Delete run/run.py once Chrome support lands
  • Further investigate sharding FF builds

More context around this work is described in this comment: #164 (comment)

@jeffcarp jeffcarp self-assigned this Oct 13, 2017
@jeffcarp jeffcarp force-pushed the docker branch 5 times, most recently from 42eb5c3 to e39e1f9 Compare October 17, 2017 02:49
@jeffcarp jeffcarp changed the title WIP idea: containerize builds and run in short-lived VMs WIP: Dockerize builds Oct 30, 2017
@jeffcarp jeffcarp changed the title WIP: Dockerize builds WIP: Dockerize WPT runs Oct 30, 2017
@jeffcarp jeffcarp changed the title WIP: Dockerize WPT runs Dockerize WPT runs & add Jenkins k8s specs Nov 1, 2017
@jeffcarp jeffcarp force-pushed the docker branch 2 times, most recently from 889b7b2 to ef904ad Compare November 1, 2017 22:42
@lukebjerring
Copy link
Collaborator

@mdittmer has ramped up on Docker recently - will get him to eyeball this.

Copy link
Collaborator

@mdittmer mdittmer left a comment

Choose a reason for hiding this comment

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

Mostly requests for documentation and admissions of ignorance on my part.

ci_container.sh Outdated
@@ -0,0 +1,8 @@
IMAGE_NAME=wptd-testrun-jenkins

docker build -t $IMAGE_NAME .
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: "${IMAGE_NAME}"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Why is the bare $IMAGE_NAME undesirable?

Copy link
Collaborator

Choose a reason for hiding this comment

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

If it ever contained spaces or special characters, then the meaning of the command would change.

ci_container.sh Outdated

docker run \
-p 4445:4445 \
--entrypoint "/bin/bash" $IMAGE_NAME \
Copy link
Collaborator

Choose a reason for hiding this comment

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

ditto

libdbus-glib-1-2

RUN mkdir /wptdashboard
ADD . /wptdashboard
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think our base image should only include dependency installation and possibly some general environment setup (i.e., exclude ADD here and RUN below). Could we have a Dockerfile.jenkins or something for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What would the base image be used for other than test runs?

Copy link
Collaborator

Choose a reason for hiding this comment

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

To test our code, to run a dev server for compiling protos, and/or to deploy modules to other environments.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Splitting into multiple Dockerfiles sounds reasonable, but for the sake of simplicity let's start with this one and as the scope is expanded with each PR we can split them up as necessary.

ci_container.sh Outdated
@@ -0,0 +1,8 @@
IMAGE_NAME=wptd-testrun-jenkins

docker build -t $IMAGE_NAME .
Copy link
Collaborator

Choose a reason for hiding this comment

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

May need more flags if we want to build from Dockerfile.jenkins or similar.

ci_container.sh Outdated
@@ -0,0 +1,8 @@
IMAGE_NAME=wptd-testrun-jenkins

docker build -t $IMAGE_NAME .
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we incorporate a version number here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The image we push for the Jenkins bots to pull needs to have a constant name (otherwise updating the image will require changing the version in Jenkins).

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the standard practice for this is to version images, and then use a :latest version/tag for use cases such as that. We could also use a version name like :jenkins if we want.

p.communicate(input=patch)


def get_and_validate_platform(wptd_path):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Documentation plz 😸

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

run/jenkins.py Outdated


def report_to_summary(wpt_report):
test_files = {}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ditto: Show me the docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

run/jenkins.py Outdated


def report_to_summary(wpt_report):
test_files = {}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should there be code sharing between this file and run.py?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(see above - this file is meant to replace run.py)

run/jenkins.py Outdated
for result in wpt_report['results']:
test_file = result['test']
assert test_file not in test_files, (
'Assumption that each test_file only shows up once broken!')
Copy link
Collaborator

Choose a reason for hiding this comment

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

More context? Which key showed up twice?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a comment.

Copy link
Collaborator

Choose a reason for hiding this comment

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

My apologies; my comment wasn't clear. My intention was that the assertion error message should contain more context (such as the value of test_file).

run/jenkins.py Outdated
assert test_file not in test_files, (
'Assumption that each test_file only shows up once broken!')

if result['status'] in ('OK', 'PASS'):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a schema somewhere we could lift legitimate values from? (I'm assuming not, but on the off chance there is...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A schema for the possible test results? I'm not sure. This line in particular should probably have a discussion bug filed for it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, that is what I was asking: does WPT define the data format for its results (including this particular bit of the results).

@jeffcarp
Copy link
Contributor Author

jeffcarp commented Nov 2, 2017

Addressed your feedback, thanks for taking a look @mdittmer

@@ -6,6 +6,8 @@ export WPT_PATH=/web-platform-tests

git clone --depth 1 https://github.com/w3c/web-platform-tests $WPT_PATH

sudo chown -R $(whoami):$(whoami) $HOME
Copy link
Collaborator

Choose a reason for hiding this comment

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

Prefer $(id -u $USER):$(id -g $USER) in case group not named after user.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, thanks

@jeffcarp
Copy link
Contributor Author

jeffcarp commented Nov 7, 2017

Ok - I addressed the latest round of feedback. I'm going to go ahead and land this so we have something common to build off of. This is a massive change to our running infra and I think landing this now and following up with incremental improvement PRs is the way to go. 💯

@jeffcarp jeffcarp merged commit 17eb327 into master Nov 7, 2017
foolip added a commit that referenced this pull request Nov 28, 2017
This reverts commit 17eb327.

Conflicts in run/jenkins.py resolved by deleting it (some commits
touching jenkins.py after the reverted commit not reverted.)
@foolip foolip deleted the docker branch December 1, 2017 22:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants