Commit dec0e58b authored by Martin Peres's avatar Martin Peres
Browse files

gitlab-ci: generate our containers and run tests

parent cdd2673d
Pipeline #279438 passed with stage
in 3 minutes and 27 seconds
stages:
- containers
- tests
variables:
GIT_SUBMODULE_STRATEGY: recursive
uroot_container:
image: docker:stable
stage: containers
rules:
- changes:
- Dockerfile
services:
- docker:dind
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build -t $CI_REGISTRY_IMAGE .
- if [[ "$CI_COMMIT_BRANCH" == "master" ]]; then docker push $CI_REGISTRY_IMAGE; fi
test_container:
image: docker:stable
stage: containers
rules:
- changes:
- tests/Dockerfile
services:
- docker:dind
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build -t $CI_REGISTRY_IMAGE/test -f tests/Dockerfile .
- if [[ "$CI_COMMIT_BRANCH" == "master" ]]; then docker push $CI_REGISTRY_IMAGE/test; fi
tests:
image: docker:stable
stage: tests
services:
- docker:dind
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
script:
- apk add --no-cache make bash xz curl
- make out/initramfs.linux_amd64.cpio.xz
- curl -L -o out/kernel https://gitlab.freedesktop.org/mupuf/boot2container/-/releases/v0.6/downloads/bzImage
- make KERNEL=$PWD/out/kernel test
- make clean
...@@ -52,7 +52,7 @@ out/disk.img: ...@@ -52,7 +52,7 @@ out/disk.img:
test: out/initramfs.linux_amd64.cpio out/disk.img test: out/initramfs.linux_amd64.cpio out/disk.img
[ -f "$(KERNEL)" ] || (echo "ERROR: Set the KERNEL parameter, pointing to linux kernel with modules compiled in"; exit 1) [ -f "$(KERNEL)" ] || (echo "ERROR: Set the KERNEL parameter, pointing to linux kernel with modules compiled in"; exit 1)
$(DOCKER) run --rm -ti --device=/dev/kvm -v $(PWD)/out/initramfs.linux_amd64.cpio:/initramfs.linux_amd64.cpio -v $(KERNEL):/kernel -v $(PWD)/tests/tests.sh:/entrypoint $(TEST_IMAGE_LABEL) /entrypoint $(DOCKER) run --rm --device=/dev/kvm -v $(PWD)/out/initramfs.linux_amd64.cpio:/initramfs.linux_amd64.cpio -v $(KERNEL):/kernel -v $(PWD)/tests/tests.sh:/entrypoint $(TEST_IMAGE_LABEL) /entrypoint
manual_test: out/initramfs.linux_amd64.cpio out/disk.img manual_test: out/initramfs.linux_amd64.cpio out/disk.img
[ -f "$(KERNEL)" ] || (echo "ERROR: Set the KERNEL parameter, pointing to linux kernel with modules compiled in"; exit 1) [ -f "$(KERNEL)" ] || (echo "ERROR: Set the KERNEL parameter, pointing to linux kernel with modules compiled in"; exit 1)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment