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

Meta: move deploy process to Travis #2941

Merged
merged 2 commits into from
Aug 19, 2017
Merged

Meta: move deploy process to Travis #2941

merged 2 commits into from
Aug 19, 2017

Conversation

domenic
Copy link
Member

@domenic domenic commented Aug 17, 2017

Meta: move deploy process to Travis

This builds and validates the spec entirely on Travis, and then deploys
it to the WHATWG servers. Previously Travis was only running build and
validation steps, but then throwing away the results, letting custom
deploy architecture handle the actual deploy. This replaces the custom
deploy architecture with something in source control and
web-host-agnostic.

This deploy is Docker-based, for two main reasons:

  • It is not easy to install FreePascal 3.x onto Travis CI's default
    Ubuntu configuration, which is fairly old (even with recent Trusty
    updates). It is simpler to create a Docker container with a recent OS
    and install FreePascal 3.x there.
  • Docker has a good mechanism for caching previous results and not doing
    unnecessary work until the cache is invalidated. This is important as
    it allows us to avoid reinstalling prerequisite packages and
    recompiling Wattsi on every build. Travis CI has some caching support,
    but it is not as full-featured as Docker's. The intermediate
    containers created for this caching are stored on Docker Hub; see
    https://hub.docker.com/r/whatwg/html-deploy.

While here, we update the Travis configuration to no longer runs Travis
on both pull requests and branches, but instead only on pull requests.


After about a day of working on this I am pretty happy with it. As you can see from e.g. https://travis-ci.org/whatwg/html/builds/265797292 build times are pretty fast (less than 2 minutes) and don't do a lot of unnecessary work.

Although the actual deploy part is untested, I am hoping that works pretty straightforwardly. Maybe I should test it by temporarily disabling the "if on a pull request, bail out" logic.

Code review appreciated, although it's fine if it's not in depth. Also I'm curious if people think deploy.sh and the Dockerfile should belong in html-build; it's not a problem to move them.

@domenic domenic added do not merge yet Pull request must not be merged per rationale in comment spec tooling labels Aug 17, 2017
Dockerfile Outdated

# Get Wattsi and html-build; compile Wattsi and put it in the PATH.
RUN apt-get update && \
apt-get install -y ca-certificates curl git unzip fp-compiler-3.0.0 && \
Copy link

@sainaen sainaen Aug 17, 2017

Choose a reason for hiding this comment

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

You probably want fp-compiler (virtual package) or fp-compiler-3.0.2 (concrete version) instead of fp-compiler-3.0.0 (outdated, spark64-only version)

Copy link
Member Author

Choose a reason for hiding this comment

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

That explains it...

deploy.sh Outdated
./html-build/build.sh

# Conformance-check the result
/usr/lib/jvm/java-8-oracle/jre/bin/java -jar vnu.jar --skip-non-html ./html-build/output
Copy link

@sainaen sainaen Aug 17, 2017

Choose a reason for hiding this comment

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

I'm not sure debian:sid image has this by default. You'd need to install java too.

Copy link
Member Author

Choose a reason for hiding this comment

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

Any thoughts on the right package name? Apparently we want Oracle Java 8...

Dockerfile Outdated

# Get Wattsi and html-build; compile Wattsi and put it in the PATH.
RUN apt-get update && \
apt-get install -y ca-certificates curl git unzip fp-compiler oracle-java8-installer && \
Copy link

Choose a reason for hiding this comment

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

Oh, I'm sorry, I might have misled you! There's no Oracle's Java package in Debian. You'll need to use PPA (or some other way) and, somehow, accept their license.

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, happy to use not-Debian; any suggestions?

Copy link

Choose a reason for hiding this comment

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

Sorry, don't know any. Oracle has a scary license with a no-distribution thing. So Ubuntu doesn't have it either (only in PPAs.)

Copy link

@sainaen sainaen Aug 17, 2017

Choose a reason for hiding this comment

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

With Ubuntu's PPA, though, it's possible:

add-apt-repository ppa:webupd8team/java &&
apt-get update &&
apt-get install oracle-java8-installer

but it will ask you to accept the license on first install.

To workaround that (not sure about legal side of this though):

echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections

source

deploy.sh Outdated
ENCRYPTED_KEY_VAR="encrypted_${ENCRYPTION_LABEL}_key"
ENCRYPTED_IV_VAR="encrypted_${ENCRYPTION_LABEL}_iv"
ENCRYPTED_KEY=${!ENCRYPTED_KEY_VAR}
ENCRYPTED_IV=${!ENCRYPTED_IV_VAR}
Copy link

Choose a reason for hiding this comment

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

One last thing: I strongly suspect these env variables will not be visible from within the container, you'll need to pass them in.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I think the dockerfile does that successfully

Copy link

Choose a reason for hiding this comment

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

Oh, ok.

This builds and validates the spec entirely on Travis, and then deploys
it to the WHATWG servers. Previously Travis was only running build and
validation steps, but then throwing away the results, letting custom
deploy architecture handle the actual deploy. This replaces the custom
deploy architecture with something in source control and
web-host-agnostic.

This deploy is Docker-based, for two main reasons:

* It is not easy to install FreePascal 3.x onto Travis CI's default
  Ubuntu configuration, which is fairly old (even with recent Trusty
  updates). It is simpler to create a Docker container with a recent OS
  and install FreePascal 3.x there.
* Docker has a good mechanism for caching previous results and not doing
  unnecessary work until the cache is invalidated. This is important as
  it allows us to avoid reinstalling prerequisite packages and
  recompiling Wattsi on every build. Travis CI has some caching support,
  but it is not as full-featured as Docker's. The intermediate
  containers created for this caching are stored on Docker Hub; see
  https://hub.docker.com/r/whatwg/html-deploy.

While here, we update the Travis configuration to no longer runs Travis
on both pull requests and branches, but instead only on pull requests.
@domenic domenic removed the do not merge yet Pull request must not be merged per rationale in comment label Aug 18, 2017
deploy.sh Outdated
TRAVIS_PULL_REQUEST=${TRAVIS_PULL_REQUEST:-false}

# Work in the parent directory
cd ..
Copy link
Contributor

Choose a reason for hiding this comment

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

cd ..

Nit: If cd fails for some reason (though yeah I realize that in this particular case it almost certainly can’t…), it’s always best to instead do:

cd .. || exit

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 think the errexit at the top takes care of that

@annevk
Copy link
Member

annevk commented Aug 18, 2017

It seems slightly cleaner to move the files if it's not a problem. The other thing I was wondering about is that here .travis.yml looks a little different from elsewhere. There's no ENCRYPTION_LABEL and DEPLOY_USER. Also, did you add the public key to the server already?

@annevk
Copy link
Member

annevk commented Aug 18, 2017

This ends up fixing whatwg/html-build#103 by the way, once it lands.

deploy.sh Outdated

# scp to the WHATWG server
echo "$SERVER $SERVER_PUBLIC_KEY" > known_hosts
scp -r -o UserKnownHostsFile=known_hosts html-build/output "$DEPLOY_USER@$SERVER:$WEB_ROOT"
Copy link
Member

Choose a reason for hiding this comment

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

Should we use whatwg/html-build#99 (comment) instead? Or better as a follow-up?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, yeah, perhaps I'll try that.

@domenic
Copy link
Member Author

domenic commented Aug 18, 2017

There's no ENCRYPTION_LABEL

ENCRYPTION_LABEL got inlined into some of the commands in .travis.yml. There I went for brevity (one line, but with the encryption label duplicated twice in that line) over configurability.

We need to either decrypt in .travis.yml, or have two deploy.sh scripts, one for running on Travis (with access to encrypted environment variables), and one for running inside the Docker container.

Although, doing two deploy scripts is not so bad, one we move them out of the repo. I guess I'll try that.

and DEPLOY_USER.

I've hard-coded it to your username, since this is only for one spec. DEPLOY_USER is used since other specs deploy to various different users all through a single deploy script. But we're not using a shared deploy script here.

Also, did you add the public key to the server already?

Yep.

domenic added a commit to whatwg/html-build that referenced this pull request Aug 18, 2017
This adds a new subdirectory, ci-deploy, with scripts and other
resources for building, validating, and deploying the spec entirely on
Travis. Previously Travis was only running build and validation steps,
but then throwing away the results, letting custom deploy architecture
handle the actual deploy. This replaces the custom deploy architecture
with something in source control and web-host-agnostic.

This deploy is Docker-based, for two main reasons:

* It is not easy to install FreePascal 3.x onto Travis CI's default
  Ubuntu configuration, which is fairly old (even with recent Trusty
  updates). It is simpler to create a Docker container with a recent OS
  and install FreePascal 3.x there.
* Docker has a good mechanism for caching previous results and not doing
  unnecessary work until the cache is invalidated. This is important as
  it allows us to avoid reinstalling prerequisite packages and
  recompiling Wattsi on every build. Travis CI has some caching support,
  but it is not as full-featured as Docker's. The intermediate
  containers created for this caching are stored on Docker Hub; see
  https://hub.docker.com/r/whatwg/html-deploy.

The ci-deploy/README.md file contains more instructions on how this is
expected to be used, and will be used by whatwg/html's .travis.yml in
whatwg/html#2941.
domenic added a commit to whatwg/html-build that referenced this pull request Aug 18, 2017
This adds a new subdirectory, ci-deploy, with scripts and other
resources for building, validating, and deploying the spec entirely on
Travis. Previously Travis was only running build and validation steps,
but then throwing away the results, letting custom deploy architecture
handle the actual deploy. This replaces the custom deploy architecture
with something in source control and web-host-agnostic.

This deploy is Docker-based, for two main reasons:

* It is not easy to install FreePascal 3.x onto Travis CI's default
  Ubuntu configuration, which is fairly old (even with recent Trusty
  updates). It is simpler to create a Docker container with a recent OS
  and install FreePascal 3.x there.
* Docker has a good mechanism for caching previous results and not doing
  unnecessary work until the cache is invalidated. This is important as
  it allows us to avoid reinstalling prerequisite packages and
  recompiling Wattsi on every build. Travis CI has some caching support,
  but it is not as full-featured as Docker's. The intermediate
  containers created for this caching are stored on Docker Hub; see
  https://hub.docker.com/r/whatwg/html-deploy.

The ci-deploy/README.md file contains more instructions on how this is
expected to be used, and will be used by whatwg/html's .travis.yml in
whatwg/html#2941.
domenic added a commit to whatwg/html-build that referenced this pull request Aug 18, 2017
This adds a new subdirectory, ci-deploy, with scripts and other
resources for building, validating, and deploying the spec entirely on
Travis. Previously Travis was only running build and validation steps,
but then throwing away the results, letting custom deploy architecture
handle the actual deploy. This replaces the custom deploy architecture
with something in source control and web-host-agnostic.

This deploy is Docker-based, for two main reasons:

* It is not easy to install FreePascal 3.x onto Travis CI's default
  Ubuntu configuration, which is fairly old (even with recent Trusty
  updates). It is simpler to create a Docker container with a recent OS
  and install FreePascal 3.x there.
* Docker has a good mechanism for caching previous results and not doing
  unnecessary work until the cache is invalidated. This is important as
  it allows us to avoid reinstalling prerequisite packages and
  recompiling Wattsi on every build. Travis CI has some caching support,
  but it is not as full-featured as Docker's. The intermediate
  containers created for this caching are stored on Docker Hub; see
  https://hub.docker.com/r/whatwg/html-deploy.

The ci-deploy/README.md file contains more instructions on how this is
expected to be used, and will be used by whatwg/html's .travis.yml in
whatwg/html#2941.
domenic added a commit to whatwg/html-build that referenced this pull request Aug 18, 2017
This adds a new subdirectory, ci-deploy, with scripts and other
resources for building, validating, and deploying the spec entirely on
Travis. Previously Travis was only running build and validation steps,
but then throwing away the results, letting custom deploy architecture
handle the actual deploy. This replaces the custom deploy architecture
with something in source control and web-host-agnostic.

This deploy is Docker-based, for two main reasons:

* It is not easy to install FreePascal 3.x onto Travis CI's default
  Ubuntu configuration, which is fairly old (even with recent Trusty
  updates). It is simpler to create a Docker container with a recent OS
  and install FreePascal 3.x there.
* Docker has a good mechanism for caching previous results and not doing
  unnecessary work until the cache is invalidated. This is important as
  it allows us to avoid reinstalling prerequisite packages and
  recompiling Wattsi on every build. Travis CI has some caching support,
  but it is not as full-featured as Docker's. The intermediate
  containers created for this caching are stored on Docker Hub; see
  https://hub.docker.com/r/whatwg/html-deploy.

The ci-deploy/README.md file contains more instructions on how this is
expected to be used, and will be used by whatwg/html's .travis.yml in
whatwg/html#2941.
domenic added a commit to whatwg/html-build that referenced this pull request Aug 18, 2017
This adds a new subdirectory, ci-deploy, with scripts and other
resources for building, validating, and deploying the spec entirely on
Travis. Previously Travis was only running build and validation steps,
but then throwing away the results, letting custom deploy architecture
handle the actual deploy. This replaces the custom deploy architecture
with something in source control and web-host-agnostic.

This deploy is Docker-based, for two main reasons:

* It is not easy to install FreePascal 3.x onto Travis CI's default
  Ubuntu configuration, which is fairly old (even with recent Trusty
  updates). It is simpler to create a Docker container with a recent OS
  and install FreePascal 3.x there.
* Docker has a good mechanism for caching previous results and not doing
  unnecessary work until the cache is invalidated. This is important as
  it allows us to avoid reinstalling prerequisite packages and
  recompiling Wattsi on every build. Travis CI has some caching support,
  but it is not as full-featured as Docker's. The intermediate
  containers created for this caching are stored on Docker Hub; see
  https://hub.docker.com/r/whatwg/html-deploy.

The ci-deploy/README.md file contains more instructions on how this is
expected to be used, and will be used by whatwg/html's .travis.yml in
whatwg/html#2941.
domenic added a commit to whatwg/html-build that referenced this pull request Aug 18, 2017
This adds a new subdirectory, ci-deploy, with scripts and other
resources for building, validating, and deploying the spec entirely on
Travis. Previously Travis was only running build and validation steps,
but then throwing away the results, letting custom deploy architecture
handle the actual deploy. This replaces the custom deploy architecture
with something in source control and web-host-agnostic.

This deploy is Docker-based, for two main reasons:

* It is not easy to install FreePascal 3.x onto Travis CI's default
  Ubuntu configuration, which is fairly old (even with recent Trusty
  updates). It is simpler to create a Docker container with a recent OS
  and install FreePascal 3.x there.
* Docker has a good mechanism for caching previous results and not doing
  unnecessary work until the cache is invalidated. This is important as
  it allows us to avoid reinstalling prerequisite packages and
  recompiling Wattsi on every build. Travis CI has some caching support,
  but it is not as full-featured as Docker's. The intermediate
  containers created for this caching are stored on Docker Hub; see
  https://hub.docker.com/r/whatwg/html-deploy.

The ci-deploy/README.md file contains more instructions on how this is
expected to be used, and will be used by whatwg/html's .travis.yml in
whatwg/html#2941.
domenic added a commit to whatwg/html-build that referenced this pull request Aug 18, 2017
This adds a new subdirectory, ci-deploy, with scripts and other
resources for building, validating, and deploying the spec entirely on
Travis. Previously Travis was only running build and validation steps,
but then throwing away the results, letting custom deploy architecture
handle the actual deploy. This replaces the custom deploy architecture
with something in source control and web-host-agnostic.

This deploy is Docker-based, for two main reasons:

* It is not easy to install FreePascal 3.x onto Travis CI's default
  Ubuntu configuration, which is fairly old (even with recent Trusty
  updates). It is simpler to create a Docker container with a recent OS
  and install FreePascal 3.x there.
* Docker has a good mechanism for caching previous results and not doing
  unnecessary work until the cache is invalidated. This is important as
  it allows us to avoid reinstalling prerequisite packages and
  recompiling Wattsi on every build. Travis CI has some caching support,
  but it is not as full-featured as Docker's. The intermediate
  containers created for this caching are stored on Docker Hub; see
  https://hub.docker.com/r/whatwg/html-deploy.

The ci-deploy/README.md file contains more instructions on how this is
expected to be used, and will be used by whatwg/html's .travis.yml in
whatwg/html#2941.
domenic added a commit to whatwg/html-build that referenced this pull request Aug 18, 2017
This adds a new subdirectory, ci-deploy, with scripts and other
resources for building, validating, and deploying the spec entirely on
Travis. Previously Travis was only running build and validation steps,
but then throwing away the results, letting custom deploy architecture
handle the actual deploy. This replaces the custom deploy architecture
with something in source control and web-host-agnostic.

This deploy is Docker-based, for two main reasons:

* It is not easy to install FreePascal 3.x onto Travis CI's default
  Ubuntu configuration, which is fairly old (even with recent Trusty
  updates). It is simpler to create a Docker container with a recent OS
  and install FreePascal 3.x there.
* Docker has a good mechanism for caching previous results and not doing
  unnecessary work until the cache is invalidated. This is important as
  it allows us to avoid reinstalling prerequisite packages and
  recompiling Wattsi on every build. Travis CI has some caching support,
  but it is not as full-featured as Docker's. The intermediate
  containers created for this caching are stored on Docker Hub; see
  https://hub.docker.com/r/whatwg/html-deploy.

The ci-deploy/README.md file contains more instructions on how this is
expected to be used, and will be used by whatwg/html's .travis.yml in
whatwg/html#2941.
domenic added a commit to whatwg/html-build that referenced this pull request Aug 18, 2017
This adds a new subdirectory, ci-deploy, with scripts and other
resources for building, validating, and deploying the spec entirely on
Travis. Previously Travis was only running build and validation steps,
but then throwing away the results, letting custom deploy architecture
handle the actual deploy. This replaces the custom deploy architecture
with something in source control and web-host-agnostic.

This deploy is Docker-based, for two main reasons:

* It is not easy to install FreePascal 3.x onto Travis CI's default
  Ubuntu configuration, which is fairly old (even with recent Trusty
  updates). It is simpler to create a Docker container with a recent OS
  and install FreePascal 3.x there.
* Docker has a good mechanism for caching previous results and not doing
  unnecessary work until the cache is invalidated. This is important as
  it allows us to avoid reinstalling prerequisite packages and
  recompiling Wattsi on every build. Travis CI has some caching support,
  but it is not as full-featured as Docker's. The intermediate
  containers created for this caching are stored on Docker Hub; see
  https://hub.docker.com/r/whatwg/html-deploy.

The ci-deploy/README.md file contains more instructions on how this is
expected to be used, and will be used by whatwg/html's .travis.yml in
whatwg/html#2941.
domenic added a commit to whatwg/html-build that referenced this pull request Aug 18, 2017
This adds a new subdirectory, ci-deploy, with scripts and other
resources for building, validating, and deploying the spec entirely on
Travis. Previously Travis was only running build and validation steps,
but then throwing away the results, letting custom deploy architecture
handle the actual deploy. This replaces the custom deploy architecture
with something in source control and web-host-agnostic.

This deploy is Docker-based, for two main reasons:

* It is not easy to install FreePascal 3.x onto Travis CI's default
  Ubuntu configuration, which is fairly old (even with recent Trusty
  updates). It is simpler to create a Docker container with a recent OS
  and install FreePascal 3.x there.
* Docker has a good mechanism for caching previous results and not doing
  unnecessary work until the cache is invalidated. This is important as
  it allows us to avoid reinstalling prerequisite packages and
  recompiling Wattsi on every build. Travis CI has some caching support,
  but it is not as full-featured as Docker's. The intermediate
  containers created for this caching are stored on Docker Hub; see
  https://hub.docker.com/r/whatwg/html-deploy.

The ci-deploy/README.md file contains more instructions on how this is
expected to be used, and will be used by whatwg/html's .travis.yml in
whatwg/html#2941.

Fixes #11. Fixes #99. Fixes #103.
domenic added a commit to whatwg/html-build that referenced this pull request Aug 18, 2017
This adds a new subdirectory, ci-deploy, with scripts and other
resources for building, validating, and deploying the spec entirely on
Travis. Previously Travis was only running build and validation steps,
but then throwing away the results, letting custom deploy architecture
handle the actual deploy. This replaces the custom deploy architecture
with something in source control and web-host-agnostic.

This deploy is Docker-based, for two main reasons:

* It is not easy to install FreePascal 3.x onto Travis CI's default
  Ubuntu configuration, which is fairly old (even with recent Trusty
  updates). It is simpler to create a Docker container with a recent OS
  and install FreePascal 3.x there.
* Docker has a good mechanism for caching previous results and not doing
  unnecessary work until the cache is invalidated. This is important as
  it allows us to avoid reinstalling prerequisite packages and
  recompiling Wattsi on every build. Travis CI has some caching support,
  but it is not as full-featured as Docker's. The intermediate
  containers created for this caching are stored on Docker Hub; see
  https://hub.docker.com/r/whatwg/html-deploy.

The ci-deploy/README.md file contains more instructions on how this is
expected to be used, and will be used by whatwg/html's .travis.yml in
whatwg/html#2941.

Fixes #11. Fixes #99. Fixes #103.
@domenic
Copy link
Member Author

domenic commented Aug 18, 2017

This is ready for review again. Proposed new commit message:

Meta: move deploy process to Travis

This uses the scripts introduced in
https://github.com/whatwg/html-build/pull/117 to move our build and
deploy process to Travis CI.

While here, we update the Travis configuration to no longer runs Travis
on both pull requests and branches, but instead only on pull requests.

It needs to be merged after the corresponding html-build PR, and until that is merged Travis will fail this branch. Marking "do not merge yet" for that reason.

@domenic domenic added the do not merge yet Pull request must not be merged per rationale in comment label Aug 18, 2017
annevk pushed a commit to whatwg/html-build that referenced this pull request Aug 19, 2017
This adds a new subdirectory, ci-deploy, with scripts and other
resources for building, validating, and deploying the spec entirely on
Travis. Previously Travis was only running build and validation steps,
but then throwing away the results, letting custom deploy architecture
handle the actual deploy. This replaces the custom deploy architecture
with something in source control and web-host-agnostic.

This deploy is Docker-based, for two main reasons:

* It is not easy to install FreePascal 3.x onto Travis CI's default
  Ubuntu configuration, which is fairly old (even with recent Trusty
  updates). It is simpler to create a Docker container with a recent OS
  and install FreePascal 3.x there.
* Docker has a good mechanism for caching previous results and not doing
  unnecessary work until the cache is invalidated. This is important as
  it allows us to avoid reinstalling prerequisite packages and
  recompiling Wattsi on every build. Travis CI has some caching support,
  but it is not as full-featured as Docker's. The intermediate
  containers created for this caching are stored on Docker Hub; see
  https://hub.docker.com/r/whatwg/html-deploy.

The ci-deploy/README.md file contains more instructions on how this is
expected to be used, and will be used by whatwg/html's .travis.yml in
whatwg/html#2941.

Fixes #11. Fixes #99. Fixes #103.
@annevk annevk merged commit a99b51e into master Aug 19, 2017
@annevk annevk deleted the move-deploy branch August 19, 2017 06:55
@domenic domenic removed the do not merge yet Pull request must not be merged per rationale in comment label Aug 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

4 participants