From 63607cf7b7387862b1d59e4c75f7431849832ec4 Mon Sep 17 00:00:00 2001 From: William Salmon Date: Thu, 23 Jul 2020 17:31:04 +0100 Subject: Test buildstream with a reference cache server This test defines a docker compose for a buildstream cache server and uses it. This stage could be altered or duplicated to use other cache servers so we can check our continued compatibility. --- .gitlab-ci.yml | 24 ++++++++++- .gitlab-ci/buildgrid-compose.yml | 67 ------------------------------- .gitlab-ci/buildgrid-remote-execution.yml | 67 +++++++++++++++++++++++++++++++ .gitlab-ci/cache-server.yml | 36 +++++++++++++++++ 4 files changed, 126 insertions(+), 68 deletions(-) delete mode 100644 .gitlab-ci/buildgrid-compose.yml create mode 100644 .gitlab-ci/buildgrid-remote-execution.yml create mode 100644 .gitlab-ci/cache-server.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 02c7f6155..25b426b3d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -189,12 +189,34 @@ tests-remote-execution: DOCKER_DRIVER: overlay2 # Required to be able to connect to the docker daemon. See https://gitlab.com/gitlab-org/gitlab-runner/issues/4501 DOCKER_TLS_CERTDIR: "" - COMPOSE_MANIFEST: .gitlab-ci/buildgrid-compose.yml + COMPOSE_MANIFEST: .gitlab-ci/buildgrid-remote-execution.yml ARTIFACT_CACHE_SERVICE: http://docker:50052 REMOTE_EXECUTION_SERVICE: http://docker:50051 SOURCE_CACHE_SERVICE: http://docker:50052 PYTEST_ARGS: "--color=yes --remote-execution" +tests-remote-cache: + allow_failure: true + image: registry.gitlab.com/buildstream/buildstream-docker-images/testsuite-fedora:31-${DOCKER_IMAGE_VERSION} + <<: *tests + before_script: + - dnf install -y docker docker-compose + - docker-compose --file ${COMPOSE_MANIFEST} up --detach + after_script: + - docker-compose --file ${COMPOSE_MANIFEST} stop + - docker-compose --file ${COMPOSE_MANIFEST} logs + - docker-compose --file ${COMPOSE_MANIFEST} down + services: + - docker:stable-dind + variables: + DOCKER_HOST: tcp://docker:2375 + DOCKER_DRIVER: overlay2 + # Required to be able to connect to the docker daemon. See https://gitlab.com/gitlab-org/gitlab-runner/issues/4501 + DOCKER_TLS_CERTDIR: "" + COMPOSE_MANIFEST: .gitlab-ci/cache-server.yml + ARTIFACT_CACHE_SERVICE: http://docker:50052 + PYTEST_ARGS: "--color=yes --remote-cache" + tests-no-usedevelop: # Ensure that tests also pass without `--develop` flag. image: registry.gitlab.com/buildstream/buildstream-docker-images/testsuite-fedora:31-${DOCKER_IMAGE_VERSION} diff --git a/.gitlab-ci/buildgrid-compose.yml b/.gitlab-ci/buildgrid-compose.yml deleted file mode 100644 index fd45c45af..000000000 --- a/.gitlab-ci/buildgrid-compose.yml +++ /dev/null @@ -1,67 +0,0 @@ -## -# BuildGrid Compose manifest for BuildStream. -# -# Spins-up a unnamed and unauthenticated grid: -# - Controller + CAS + AC at http://localhost:50051 -# - Ref. + CAS at: http://localhost:50052 -# -# BuildStream configuration snippet: -# -# artifacts: -# url: http://localhost:50052 -# push: true -# remote-execution: -# execution-service: -# url: http://localhost:50051 -# action-cache-service: -# url: http://localhost:50051 -# storage-service: -# url: http://localhost:50051 -# -# Basic usage: -# - docker-compose -f buildgrid-compose.yml up -# - docker-compose -f buildgrid-compose.yml down -# -version: "3.2" - -services: - controller: - image: registry.gitlab.com/buildgrid/buildgrid.hub.docker.com/buildgrid:nightly - command: [ - "bgd", "server", "start", "-v", - "/etc/buildgrid/default.conf"] - ports: - - 50051:50051 - networks: - - grid - - bot: - image: registry.gitlab.com/buildgrid/buildgrid.hub.docker.com/buildbox:nightly - command: [ - "sh", "-c", "sleep 15 && ( buildbox-casd --cas-remote=http://controller:50051 /var/lib/buildgrid/cache & buildbox-worker --bots-remote=http://controller:50051 --cas-remote=unix:/var/lib/buildgrid/cache/casd.sock --buildbox-run=buildbox-run-bubblewrap --runner-arg=--use-localcas --platform OSFamily=linux --platform ISA=x86-64 --verbose )"] - privileged: true - volumes: - - type: volume - source: cache - target: /var/lib/buildgrid/cache - depends_on: - - controller - networks: - - grid - - storage: - image: registry.gitlab.com/buildgrid/buildgrid.hub.docker.com/buildgrid:nightly - command: [ - "bgd", "server", "start", "-v", - "/etc/buildgrid/artifacts.conf"] - ports: - - 50052:50052 - networks: - - grid - -networks: - grid: - driver: bridge - -volumes: - cache: diff --git a/.gitlab-ci/buildgrid-remote-execution.yml b/.gitlab-ci/buildgrid-remote-execution.yml new file mode 100644 index 000000000..fd45c45af --- /dev/null +++ b/.gitlab-ci/buildgrid-remote-execution.yml @@ -0,0 +1,67 @@ +## +# BuildGrid Compose manifest for BuildStream. +# +# Spins-up a unnamed and unauthenticated grid: +# - Controller + CAS + AC at http://localhost:50051 +# - Ref. + CAS at: http://localhost:50052 +# +# BuildStream configuration snippet: +# +# artifacts: +# url: http://localhost:50052 +# push: true +# remote-execution: +# execution-service: +# url: http://localhost:50051 +# action-cache-service: +# url: http://localhost:50051 +# storage-service: +# url: http://localhost:50051 +# +# Basic usage: +# - docker-compose -f buildgrid-compose.yml up +# - docker-compose -f buildgrid-compose.yml down +# +version: "3.2" + +services: + controller: + image: registry.gitlab.com/buildgrid/buildgrid.hub.docker.com/buildgrid:nightly + command: [ + "bgd", "server", "start", "-v", + "/etc/buildgrid/default.conf"] + ports: + - 50051:50051 + networks: + - grid + + bot: + image: registry.gitlab.com/buildgrid/buildgrid.hub.docker.com/buildbox:nightly + command: [ + "sh", "-c", "sleep 15 && ( buildbox-casd --cas-remote=http://controller:50051 /var/lib/buildgrid/cache & buildbox-worker --bots-remote=http://controller:50051 --cas-remote=unix:/var/lib/buildgrid/cache/casd.sock --buildbox-run=buildbox-run-bubblewrap --runner-arg=--use-localcas --platform OSFamily=linux --platform ISA=x86-64 --verbose )"] + privileged: true + volumes: + - type: volume + source: cache + target: /var/lib/buildgrid/cache + depends_on: + - controller + networks: + - grid + + storage: + image: registry.gitlab.com/buildgrid/buildgrid.hub.docker.com/buildgrid:nightly + command: [ + "bgd", "server", "start", "-v", + "/etc/buildgrid/artifacts.conf"] + ports: + - 50052:50052 + networks: + - grid + +networks: + grid: + driver: bridge + +volumes: + cache: diff --git a/.gitlab-ci/cache-server.yml b/.gitlab-ci/cache-server.yml new file mode 100644 index 000000000..24ccd1672 --- /dev/null +++ b/.gitlab-ci/cache-server.yml @@ -0,0 +1,36 @@ +## +# A Builstream Artifact Server +# +# Spins-up a unnamed and unauthenticated grid: +# - artifacts server at: http://localhost:50052 +# +# BuildStream configuration snippet: +# +# artifacts: +# url: http://localhost:50052 +# push: true +# +# Basic usage: +# - docker-compose -f cache-server.yml up +# - docker-compose -f cache-server.yml down +# +version: "3.2" + +services: + controller: + image: buildstream/buildstream:dev + command: ["bst-artifact-server","--port", + "50052", + "--enable-push", + "/artifacts" + ] + ports: + - 50052:50052 + networks: + - grid +networks: + grid: + driver: bridge + +volumes: + cache: -- cgit v1.2.1