Skip to content

Commit

Permalink
docker,ci: add persistent caching
Browse files Browse the repository at this point in the history
Signed-off-by: Ernesto Puerta <[email protected]>
  • Loading branch information
epuertat committed Jan 23, 2024
1 parent b6d3040 commit 10889dd
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 29 deletions.
72 changes: 46 additions & 26 deletions .github/workflows/build-container.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
# yamllint disable rule:line-length
# yamllint disable rule:comments
name: "CI"
on: # yamllint disable rule:truthy
push:
Expand All @@ -20,7 +21,38 @@ concurrency:
cancel-in-progress: true
env:
WAIT_INTERVAL_SECS: 1
DOCKER_COMPOSE: docker compose # This is to deal with v1 (docker-compose) and v2 (docker compose)
jobs:
build-ceph:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Expose GitHub Runtime
# Pinned to https://github.com/crazy-max/ghaction-github-runtime/releases/tag/v3.0.0
# Required to expose $ACTIONS_RUNTIME_TOKEN (suggested by Docker:
# https://docs.docker.com/build/cache/backends/gha/#authentication )
uses: crazy-max/ghaction-github-runtime@b3a9207c0e1ef41f4cf215303c976869d0c2c1c4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build container images - ceph
run: make build SVC=ceph

- name: Save container images
run: |
. .env
docker save $QUAY_CEPH:$CEPH_VERSION > ceph.tar
- name: Upload container images
uses: actions/upload-artifact@v4
with:
name: container_images_ceph
path: |
ceph.tar
build:
runs-on: ubuntu-latest
steps:
Expand All @@ -29,6 +61,15 @@ jobs:
with:
submodules: recursive

- name: Expose GitHub Runtime
# Pinned to https://github.com/crazy-max/ghaction-github-runtime/releases/tag/v3.0.0
# Required to expose $ACTIONS_RUNTIME_TOKEN (suggested by Docker:
# https://docs.docker.com/build/cache/backends/gha/#authentication )
uses: crazy-max/ghaction-github-runtime@b3a9207c0e1ef41f4cf215303c976869d0c2c1c4

- 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

Expand Down Expand Up @@ -60,27 +101,6 @@ jobs:
nvmeof-cli.tar
bdevperf.tar
build-ceph:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Build container images - ceph
run: make build SVC=ceph

- name: Save container images
run: |
. .env
docker save $QUAY_CEPH:$CEPH_VERSION > ceph.tar
- name: Upload container images
uses: actions/upload-artifact@v4
with:
name: container_images_ceph
path: |
ceph.tar
pytest:
needs: [build, build-ceph]
strategy:
Expand Down Expand Up @@ -354,7 +374,7 @@ jobs:
- name: Start discovery controller
if: matrix.integration == 'container'
run: |
docker-compose up --detach discovery
$DOCKER_COMPOSE up --detach discovery
- name: Wait for discovery controller to be listening
if: matrix.integration == 'container'
Expand All @@ -374,7 +394,7 @@ jobs:
- name: Start gateway with scale=2
run: |
docker-compose up --detach --scale nvmeof=2 nvmeof
$DOCKER_COMPOSE up --detach --scale nvmeof=2 nvmeof
- name: Wait for gateways to be listening
timeout-minutes: 3
Expand All @@ -397,12 +417,12 @@ jobs:
- name: List containers
if: success() || failure()
run: |
docker-compose ps
$DOCKER_COMPOSE ps
- name: List processes
if: success() || failure()
run: |
docker-compose top
$DOCKER_COMPOSE top
- name: Create RBD image
run: |
Expand All @@ -423,7 +443,7 @@ jobs:
cli_gw() {
gw=$1
shift
docker-compose run --rm nvmeof-cli --server-address $gw --server-port $NVMEOF_GW_PORT "$@"
$DOCKER_COMPOSE run --rm nvmeof-cli --server-address $gw --server-port $NVMEOF_GW_PORT "$@"
}
gw1=$(container_ip $GW1)
Expand Down
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
---
# yamllint disable rule:line-length
# yamllint disable rule:comments
version: "3.8"
services:
spdk:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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: >-
Expand Down Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions mk/containerized.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

# Docker and docker-compose specific commands
DOCKER = docker
DOCKER_COMPOSE = docker-compose ## Docker-compose command
DOCKER_COMPOSE != echo $${DOCKER_COMPOSE:-docker-compose} ## Docker-compose command
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
Expand Down

0 comments on commit 10889dd

Please sign in to comment.