Add clearlinux/clr-installer-ci Docker Image

This pull request introduces an image to be used for running
the Clear Linux OS Installer continuous integration on Travis.

Previously, a very large part of the test time in Travis was
spent building adding the required bundle to the standard
Clear Linux Docker image to properly setup the test environment.

Please ensure that auto-trigger is enabled so that this image
is automatically rebuilt with each new base clearlinux docker image.

Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
This commit is contained in:
Mark D Horn
2018-08-23 10:42:10 -07:00
parent 35ade52275
commit 3ef1b98fff
2 changed files with 86 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
FROM clearlinux:latest
MAINTAINER mark.d.horn@intel.com
# Configure Go
ENV GOPATH="/go" PATH="/go/bin:${PATH}"
# Configure trust
RUN clrtrust generate && \
# Update and add bundles
swupd update && \
swupd bundle-add sysadmin-basic storage-utils network-basic go-basic-dev git telemetrics && \
# Install the Go Linters
go get -u gopkg.in/alecthomas/gometalinter.v2 && \
gometalinter.v2 --install
+72
View File
@@ -0,0 +1,72 @@
# Clear Linux* OS Installer CI Container
[![](https://images.microbadger.com/badges/image/clearlinux/clr-installer-ci.svg)](https://microbadger.com/images/clearlinux/clr-installer-ci "Get your own image badge on microbadger.com")
[![](https://images.microbadger.com/badges/version/clearlinux/clr-installer-ci.svg)](https://microbadger.com/images/clearlinux/clr-installer-ci "Get your own version badge on microbadger.com")
This repo provides a Clear Linux* container for running the Clear Linux
OS Installer CI on Travis. This container has all of the packages and
tools installed to build Clear Linux OS Installer from source and run
its test suite.
# Build
## Building Locally
```
docker build -t clearlinux/clr-installer-ci .
```
> #### Note:
> If you are behind a firewall, you may need to pass proxy settings to the
> build environment:
>
> `--build-arg https_proxy="$https_proxy"`
>
> `--build-arg http_proxy="$http_proxy"`
>
> `--build-arg no_proxy="$no_proxy"`
>
> flags to docker build; note these only impact the Build Environment and
> will not become part of the image being built.
## Pulling from Docker Hub
```
docker pull clearlinux/clr-installer-ci
```
## Running the clr-installer-ci Container
```
docker run --network=host --name clear-test -v $(pwd):/travis -v /dev:/dev -v /var/tmp/test:/tmp -v /sys/fs/cgroup:/sys/fs/cgroup:ro -e container=docker --privileged --tmpfs /run --tmpfs /run/lock -dit --rm clearlinux/clr-installer-ci:latest /sbin/init
```
## Configure Travis to build and run the Dockerfile
In your Travis config (`.travis.yml`), build and run your above `Dockerfile`. An
example `.travis.yml` file is as follows:
```
sudo: required
services:
- docker
# This is just here for Travis CI to report correctly
language: go
go:
- "1.10" # quote this or 1.10 is treated as 1.1 (floating point number)
before_install:
- docker pull clearlinux/clr-installer-ci
- docker run --network=host --name clear-test -v $(pwd):/travis -v /dev:/dev -v /var/tmp/test:/tmp -v /sys/fs/cgroup:/sys/fs/cgroup:ro -e container=docker --privileged --tmpfs /run --tmpfs /run/lock -dit --rm clearlinux/clr-installer-ci:latest /sbin/init
- docker ps
# Do NOT use -l (login) for the bash shell or the default profile
# (/usr/share/defaults/etc/profile) will reset PATH removing the
# GOPATH/bin added to the clr-installer-ci Docker image.
before_script:
- docker exec -it clear-test bash -c "swupd info"
script:
- docker exec -it clear-test bash -c "cd /travis ; make dist-clean"
- docker exec -it clear-test bash -c "cd /travis ; make"
- docker exec -it clear-test bash -c "cd /travis ; make lint"
- travis_retry docker exec -it clear-test bash -c "cd /travis ; make check"
after_script:
- docker container stop clear-test
```