Skip to content

Commit

Permalink
storage: compile spdk for arm64
Browse files Browse the repository at this point in the history
Fixes opiproject#163

See docker/buildx#510

Signed-off-by: Boris Glimcher <Boris.Glimcher@emc.com>
  • Loading branch information
glimchb committed Aug 8, 2022
1 parent 8edc86d commit 58194f9
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 92 deletions.
90 changes: 5 additions & 85 deletions .github/workflows/poc-storage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ on:
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository_owner }}/opi-spdk

concurrency:
# if workflow for PR or push is already running stop it, and start new one
Expand All @@ -33,6 +31,7 @@ jobs:
package:
- server
- client
- spdk
steps:
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v2
Expand Down Expand Up @@ -67,6 +66,7 @@ jobs:
docker-build:
runs-on: ubuntu-latest
steps:

- name: configure HUGE pages
run: |
sync
Expand All @@ -77,65 +77,9 @@ jobs:
echo "Check and fail if not enough"
grep 1024 /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
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@69f6fc9d46f2f8bf0d5491e4aabe0bb8c6a4678a
with:
sep-tags: ","
sep-labels: ","
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
# Build and push Docker image with Buildx
# https://github.com/docker/build-push-action
- name: Build Docker image
id: build
uses: docker/build-push-action@c84f38281176d4c9cdb1626ffafcd6b3911b5d94
with:
context: storage/spdk
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=docker,dest=/tmp/myimage.tar
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Load docker image locally
run: docker image load < /tmp/myimage.tar
working-directory: storage

- name: List docker images
run: docker image ls
working-directory: storage
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf

- name: Start containers
run: SPDK_TAG=sha-$(git rev-parse --short ${{ github.sha }}) ./scripts/poc.sh start
Expand All @@ -154,27 +98,3 @@ jobs:
if: always()
run: ./scripts/poc.sh stop
working-directory: storage

- name: Upload build artifact
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}-${{ steps.system.outputs.arch }}
path: /tmp/myimage.tar
retention-days: 1

# Build and push Docker image with Buildx
# https://github.com/docker/build-push-action
# NOTE: The second time we run this, the iamge should already be
# built, and we're just doing the push to ghcr.io
- name: Push Docker image
id: push-to-ghcr
uses: docker/build-push-action@c84f38281176d4c9cdb1626ffafcd6b3911b5d94
if: github.event_name != 'pull_request'
with:
context: storage/spdk
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
4 changes: 2 additions & 2 deletions integration/docker-compose.spdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: "3.7"
services:

spdk-target:
image: ghcr.io/opiproject/opi-spdk:main
image: ghcr.io/opiproject/opi-storage-spdk:main
build:
context: ../storage/spdk
volumes:
Expand Down Expand Up @@ -40,7 +40,7 @@ services:
timeout: 10s

spdk-target-web:
image: ghcr.io/opiproject/opi-spdk:main
image: ghcr.io/opiproject/opi-storage-spdk:main
volumes_from:
- spdk-target:rw
ports:
Expand Down
4 changes: 2 additions & 2 deletions integration/docker-compose.xpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ services:
privileged: true

xpu-spdk:
image: ghcr.io/opiproject/opi-spdk:main
image: ghcr.io/opiproject/opi-storage-spdk:main
build:
context: ../storage/spdk
volumes:
Expand Down Expand Up @@ -86,7 +86,7 @@ services:
timeout: 10s

xpu-spdk-web:
image: ghcr.io/opiproject/opi-spdk:main
image: ghcr.io/opiproject/opi-storage-spdk:main
volumes_from:
- xpu-spdk:rw
network_mode: service:xpu-cpu-ssh
Expand Down
2 changes: 1 addition & 1 deletion storage/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ version: "3.7"
services:

spdk:
image: "ghcr.io/opiproject/opi-spdk:${SPDK_TAG-main}"
image: "ghcr.io/opiproject/opi-storage-spdk:${SPDK_TAG-main}"
build:
context: spdk
volumes:
Expand Down
8 changes: 6 additions & 2 deletions storage/spdk/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ FROM fedora:36 as build
ARG TAG=v22.05
# Pick an arch that has at least sse 4.2 but does not require newer avx
# See https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html
ARG ARCH=x86-64-v2

WORKDIR /root
RUN dnf install -y git rpm-build diffutils procps-ng pip && dnf clean all
Expand All @@ -16,7 +15,12 @@ RUN git clone https://github.com/spdk/spdk --branch ${TAG} --depth 1 && \
cd spdk && git submodule update --init --depth 1 && scripts/pkgdep.sh --rdma

# hadolint ignore=DL3003
RUN cd spdk && ./rpmbuild/rpm.sh --target-arch=${ARCH} --without-uring --without-crypto \
RUN if [ "$(uname -m)" = "aarch64" ]; then \
ARCH="generic"; \
elif [ "$(uname -m)" = "x86_64" ]; then \
ARCH="x86-64-v2"; \
fi; \
cd spdk && ./rpmbuild/rpm.sh --target-arch=${ARCH} --without-uring --without-crypto \
--without-fio --with-raid5 --with-vhost --without-pmdk --without-rbd \
--with-rdma --with-shared --with-iscsi-initiator --without-vtune --without-isal

Expand Down

0 comments on commit 58194f9

Please sign in to comment.