From ca135a99dc5a2b51cb8f8a3de2c05866045c8918 Mon Sep 17 00:00:00 2001 From: Ernesto Puerta Date: Tue, 23 Jan 2024 20:40:31 +0100 Subject: [PATCH] docker,ci: add persistent caching Signed-off-by: Ernesto Puerta --- .github/workflows/build-container.yml | 17 ++++++++++++++--- Makefile | 1 - docker-compose.yaml | 15 +++++++++++++++ mk/containerized.mk | 1 - 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-container.yml b/.github/workflows/build-container.yml index caaedd195..c7e049de1 100644 --- a/.github/workflows/build-container.yml +++ b/.github/workflows/build-container.yml @@ -1,5 +1,6 @@ --- # yamllint disable rule:line-length +# yamllint disable rule:comments name: "CI" on: # yamllint disable rule:truthy push: @@ -20,6 +21,7 @@ concurrency: cancel-in-progress: true env: WAIT_INTERVAL_SECS: 1 + DOCKER_COMPOSE: docker compose jobs: build: runs-on: ubuntu-latest @@ -29,6 +31,9 @@ jobs: with: submodules: recursive + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build container images - spdk run: make build SVC="spdk" SPDK_TARGET_ARCH=x86-64-v2 @@ -41,9 +46,6 @@ jobs: - name: Build container images - nvmeof-cli run: make build SVC="nvmeof-cli" SPDK_TARGET_ARCH=x86-64-v2 - - name: Build container images - discovery - run: make build SVC="discovery" SPDK_TARGET_ARCH=x86-64-v2 - - name: Save container images run: | . .env @@ -63,9 +65,18 @@ jobs: build-ceph: runs-on: ubuntu-latest steps: + - name: Info + run: | + docker --version + docker compose version + docker info + - name: Checkout code uses: actions/checkout@v4 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build container images - ceph run: make build SVC=ceph diff --git a/Makefile b/Makefile index 6c751618d..7e632abc2 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,6 @@ build: export NVMEOF_GIT_MODIFIED_FILES != git status -s | grep -e "^ *M" | sed up: ## Launch services up: SVC ?= ceph nvmeof ## Services up: OPTS ?= --abort-on-container-exit --exit-code-from $(SVC) --remove-orphans -#up: override OPTS += --scale nvmeof=$(SCALE) clean: $(CLEAN) setup ## Clean-up environment clean: override HUGEPAGES = 0 diff --git a/docker-compose.yaml b/docker-compose.yaml index 26ccbb775..dec2916e4 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,3 +1,6 @@ +--- +# yamllint disable rule:line-length +# yamllint disable rule:comments version: "3.8" services: spdk: @@ -26,6 +29,10 @@ services: SPDK_GIT_COMMIT: labels: io.ceph.nvmeof: + cache_from: + - type=gha + cache_to: + - type=gha # Used to export RPM packages externally (via bind mount) spdk-rpm-export: extends: @@ -61,6 +68,10 @@ services: CEPH_CLUSTER_CEPH_REPO_BASEURL: labels: io.ceph.nvmeof: + cache_from: + - type=gha + cache_to: + - type=gha environment: TOUCHFILE: /tmp/ceph.touch entrypoint: >- @@ -121,6 +132,10 @@ services: HUGEPAGES_DIR: labels: io.ceph.nvmeof: + cache_from: + - type=gha + cache_to: + - type=gha volumes: # sudo bash -c 'echo 2048 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages' # https://spdk.io/doc/containers.html diff --git a/mk/containerized.mk b/mk/containerized.mk index 5669423d2..6246202cd 100644 --- a/mk/containerized.mk +++ b/mk/containerized.mk @@ -7,7 +7,6 @@ DOCKER_COMPOSE_COMMANDS = pull build up run exec ps top images logs port \ pause unpause stop restart down events OPTS ?= ## Docker-compose subcommand options -SCALE ?= 1 ## Number of instances CMD ?= ## Command to run with run/exec targets .PHONY: $(DOCKER_COMPOSE_COMMANDS) shell