Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate container build and enable RBD on SPDK #38

Merged
merged 2 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Build

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

on:
push:
branches: [main]
# Publish semver tags as releases.
tags: ['v*.*.*']
pull_request:
branches: [main]

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}


jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern=v{{version}}
type=semver,pattern=v{{major}}.{{minor}}
type=semver,pattern=v{{major}}
type=ref,event=branch
type=ref,event=pr
type=sha

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM ubuntu:22.04

# TODO(knikolla): Move (or remove) dependencies in the appropriate Makefile section
RUN apt-get update \
&& apt-get install -y git curl build-essential sudo cmake python3 python3-pip libssl-dev \
&& pip install -U meson

RUN sudo apt-get install -y wget lsb-release software-properties-common gnupg \
&& wget https://apt.llvm.org/llvm.sh \
&& chmod +x llvm.sh \
&& ./llvm.sh 18

WORKDIR /app
COPY Makefile /app/Makefile
COPY meson.* /app/
COPY src /app/src
COPY subprojects /app/subprojects
COPY test /app/test

RUN make install-deps \
&& make debug
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ install-deps:
libzstd-dev ninja-build zlib1g-dev
# SPDK deps
sudo apt install -y libnuma-dev libarchive-dev libibverbs-dev librdmacm-dev \
python3-pyelftools libcunit1-dev libaio-dev nasm
python3-pyelftools libcunit1-dev libaio-dev nasm librados-dev librbd-dev
# LSVD deps
sudo apt install -y meson mold libfmt-dev librados-dev \
libjemalloc-dev libradospp-dev pkg-config uuid-dev
14 changes: 14 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
services:
spdk-lsvd:
image: lsvd-rbd
build: .
volumes:
- /dev/hugepages:/dev/hugepages
- /etc/ceph:/etc/ceph
- /var/tmp:/var/tmp
- /dev/shm:/dev/shm
network_mode: host
stdin_open: true
tty: true
privileged: true
entrypoint: /bin/bash
8 changes: 4 additions & 4 deletions subprojects/packagefiles/spdk/configure-spdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

debug() {
echo '===Building SPDK in debug mode...'
./configure --enable-debug --without-fuse --without-nvme-cuse \
--without-rbd --without-shared --without-xnvme
./configure --enable-debug --with-rbd --without-fuse --without-nvme-cuse \
--without-shared --without-xnvme
}

release() {
echo '===Building SPDK in release mode...'
./configure --without-fuse --without-nvme-cuse \
--without-rbd --without-shared --without-xnvme
./configure --with-rbd --without-fuse --without-nvme-cuse \
--without-shared --without-xnvme
}

if [ $# -lt 1 ]; then
Expand Down
Loading