Skip to content

Commit 72c809d

Browse files
authored
Merge a80cf13 into f244f72
2 parents f244f72 + a80cf13 commit 72c809d

File tree

8 files changed

+143
-40
lines changed

8 files changed

+143
-40
lines changed

.github/workflows/e2e.yml

Lines changed: 114 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111

1212
jobs:
1313
prepare:
14-
runs-on: [self-hosted]
14+
runs-on: [cloud]
1515
outputs:
1616
vaccelrt_sha: ${{ steps.vars.outputs.vaccelrt_sha }}
1717
firecracker_sha: ${{ steps.vars.outputs.firecracker_sha }}
@@ -34,7 +34,7 @@ jobs:
3434
3535
test:
3636
needs: prepare
37-
runs-on: [self-hosted, gpu, "${{ matrix.arch }}" ]
37+
runs-on: [self-hosted, cloud, "${{ matrix.arch }}" ]
3838
env:
3939
NBFC_S3_ACCESS: ${{ secrets.AWS_ACCESS_KEY }}
4040
NBFC_S3_SECRET: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
@@ -43,7 +43,7 @@ jobs:
4343
FIRECRACKER_TYPE: ${{ needs.prepare.outputs.firecracker_build_type }}
4444
VIRTIO_SHA: ${{ needs.prepare.outputs.virtio_accel_sha }}
4545
JOB_TYPE: ${{ matrix.build_type }}
46-
ARCH: ${{ matrix.arch }}
46+
ARCHITECTURE: ${{ matrix.arch }}
4747

4848
strategy:
4949
matrix:
@@ -52,12 +52,17 @@ jobs:
5252
fail-fast: false
5353

5454
steps:
55+
- name: Cleanup previous runs
56+
run: |
57+
sudo rm -rf ${{ github.workspace }}/*
58+
sudo rm -rf ${{ github.workspace }}/.??*
59+
5560
- uses: actions/checkout@v2
5661

5762
- name: Install packages
5863
run: |
5964
sudo apt update && sudo apt install -y \
60-
subversion coreutils rsync iproute2 libfdt-dev
65+
subversion coreutils rsync iproute2 libfdt-dev qemu-system-x86-64 parted debootstrap bc udev libssl-dev libelf-dev
6166
6267
- name: Setup vars
6368
id: vars
@@ -73,19 +78,90 @@ jobs:
7378
access-key: ${{ env.NBFC_S3_ACCESS }}
7479
secret-key: ${{ env.NBFC_S3_SECRET }}
7580
local-path: /github/workspace/artifacts/opt/
76-
remote-path: nbfc-assets/github/vaccelrt/${{env.VACCELRT_SHA}}/${{env.ARCH}}/${{ env.JOB_TYPE }}/opt/
81+
remote-path: nbfc-assets/github/vaccelrt/${{env.VACCELRT_SHA}}/${{env.ARCHITECTURE}}/${{ env.JOB_TYPE }}/opt/
7782
env:
7883
ACTION_UID: ${{ steps.vars.outputs.uid }}
7984
ACTION_GID: ${{ steps.vars.outputs.gid }}
8085

86+
- name: Download go & kata containers
87+
run: |
88+
if [[ $ARCHITECTURE == "x86_64" ]]
89+
then
90+
export ARCH=amd64
91+
else
92+
export ARCH=arm64
93+
fi
94+
#wget https://golang.org/dl/go1.15.11.linux-$ARCH.tar.gz
95+
#sudo tar -zxf go1.15.11.linux-$ARCH.tar.gz -C /usr/local/
96+
git submodule update --init kata-containers
97+
git submodule update --init virtio-accel
98+
99+
- name: Checkout private tools
100+
uses: actions/checkout@v2
101+
with:
102+
repository: nubificus/vaccel-go-runtime
103+
ref: main
104+
token: ${{ secrets.NBFC_BUILDER_TOKEN }} # `GitHub_PAT` is a secret that contains your PAT
105+
path: kata-containers/src/runtime/vendor/github.com/nubificus/vaccel-go-runtime
106+
107+
- name: Build and install kata-containers
108+
env:
109+
GOROOT: /usr/local/go
110+
GOPATH: /home/runner/go
111+
run: |
112+
export PATH=$GOROOT/bin:$PATH
113+
export PATH=$GOPATH/bin:$PATH
114+
if [[ $ARCHITECTURE == "x86_64" ]]
115+
then
116+
export ARCH=amd64
117+
export ARCH_KERNEL=x86_64
118+
else
119+
export ARCH_KERNEL=arm64
120+
fi
121+
cd kata-containers
122+
make -C src/runtime
123+
sudo cp src/runtime/containerd-shim-kata-v2 ${{ github.workspace }}/artifacts/opt/bin/
124+
sudo cp src/runtime/cli/config/configuration-fc.toml ${{ github.workspace }}/artifacts/opt/share/
125+
cd tools/packaging/kernel
126+
echo "CONFIG_MODULES=y" > configs/fragments/$ARCH_KERNEL/vaccel.conf
127+
echo "CONFIG_MODULE_UNLOAD=y" >> configs/fragments/$ARCH_KERNEL/vaccel.conf
128+
echo "CONFIG_MODULE_SIG=y" >> configs/fragments/$ARCH_KERNEL/vaccel.conf
129+
VERSION=`./build-kernel.sh setup 2>&1 |grep Kernel\ version\: | awk '{print $4}'`
130+
./build-kernel.sh build
131+
if [[ $ARCHITECTURE == "x86_64" ]]
132+
then
133+
sudo cp kata-linux*/vmlinux ${{ github.workspace }}/artifacts/opt/share/vmlinux-kata-fc
134+
else
135+
sudo cp kata-linux*/arch/arm64/boot/Image ${{ github.workspace }}/artifacts/opt/share/vmlinux-kata-fc
136+
fi
137+
cd ${{ github.workspace }}/virtio-accel
138+
git checkout fix_kzfree
139+
KDIR=${{ github.workspace }}/kata-containers/tools/packaging/kernel/kata-linux*/ make ZC=0 ARCH=$ARCH_KERNEL
140+
sudo cp virtio_accel.ko ${{ github.workspace }}/artifacts/opt/share/virtio_accel-kata.ko
141+
if [[ $ARCHITECTURE == "x86_64" ]]
142+
then
143+
cd ${{ github.workspace }}/kata-containers/tools/osbuilder/rootfs-builder/
144+
export ROOTFS_DIR=$PWD/rootfs
145+
rm -rf $ROOTFS_DIR
146+
script -fec 'sudo su root -c ". /opt/cargo/env && GOPATH=$GOPATH GOROOT=$GOROOT PATH=$GOROOT/bin:$PATH RUSTUP_HOME=/opt/rust CARGO_HOME=/opt/cargo PATH=/opt/cargo/bin:$PATH ./rootfs.sh -r $ROOTFS_DIR ubuntu"'
147+
MODULES_DIR=${ROOTFS_DIR}/lib/modules/$VERSION
148+
sudo mkdir -p ${MODULES_DIR}
149+
sudo cp ${{ github.workspace }}/virtio-accel/virtio_accel.ko $MODULES_DIR
150+
sudo touch ${MODULES_DIR}/modules.builtin
151+
sudo touch ${MODULES_DIR}/modules.order
152+
sudo chroot ${ROOTFS_DIR} /sbin/depmod $VERSION
153+
cd ../image-builder
154+
script -fec 'sudo bash -x ./image_builder.sh $ROOTFS_DIR'
155+
sudo cp kata-containers.img ${{ github.workspace }}/artifacts/opt/share/
156+
fi
81157
82158
- name: Fetch Firecracker
83159
uses: cloudkernels/minio-download@master
84160
with:
85161
url: https://s3.nubificus.co.uk
86162
access-key: ${{ env.NBFC_S3_ACCESS }}
87163
secret-key: ${{ env.NBFC_S3_SECRET }}
88-
remote-path: nbfc-assets/github/firecracker/${{ env.FIRECRACKER_SHA }}/${{env.ARCH}}/${{ steps.vars.outputs.firecracker_build_type }}/firecracker
164+
remote-path: nbfc-assets/github/firecracker/${{ env.FIRECRACKER_SHA }}/${{env.ARCHITECTURE}}/${{ steps.vars.outputs.firecracker_build_type }}/firecracker
89165
local-path: /github/workspace/artifacts/opt/bin/
90166
env:
91167
ACTION_UID: ${{ steps.vars.outputs.uid }}
@@ -97,7 +173,7 @@ jobs:
97173
url: https://s3.nubificus.co.uk
98174
access-key: ${{ env.NBFC_S3_ACCESS }}
99175
secret-key: ${{ env.NBFC_S3_SECRET }}
100-
remote-path: nbfc-assets/github/virtio-accel/${{ env.VIRTIO_SHA }}/${{env.ARCH}}/linux/vmlinux
176+
remote-path: nbfc-assets/github/virtio-accel/${{ env.VIRTIO_SHA }}/${{env.ARCHITECTURE}}/linux/vmlinux
101177
local-path: /github/workspace/artifacts/opt/share/
102178
env:
103179
ACTION_UID: ${{ steps.vars.outputs.uid }}
@@ -109,7 +185,7 @@ jobs:
109185
url: https://s3.nubificus.co.uk
110186
access-key: ${{ env.NBFC_S3_ACCESS }}
111187
secret-key: ${{ env.NBFC_S3_SECRET }}
112-
remote-path: nbfc-assets/github/virtio-accel/${{ env.VIRTIO_SHA }}/${{env.ARCH}}/linux/virtio_accel.ko
188+
remote-path: nbfc-assets/github/virtio-accel/${{ env.VIRTIO_SHA }}/${{env.ARCHITECTURE}}/linux/virtio_accel.ko
113189
local-path: /github/workspace/artifacts/opt/share/
114190
env:
115191
ACTION_UID: ${{ steps.vars.outputs.uid }}
@@ -145,7 +221,7 @@ jobs:
145221
sudo mkdir -p /usr/local/share/imagenet-models
146222
sudo chmod a+rw /usr/local/share/imagenet-models
147223
ln -s ${{ github.workspace }}/artifacts/opt/share/networks /usr/local/share/imagenet-models/networks
148-
sudo VACCEL_BACKENDS=${{ github.workspace }}/artifacts/opt/lib/libvaccel-jetson.so \
224+
sudo VACCEL_BACKENDS=${{ github.workspace }}/artifacts/opt/lib/libvaccel-noop.so \
149225
LD_LIBRARY_PATH=${{ github.workspace }}/artifacts/opt/lib:/usr/local/lib:/usr/lib \
150226
VACCEL_DEBUG_LEVEL=4 \
151227
./bin/firecracker \
@@ -192,32 +268,42 @@ jobs:
192268
cargo install --path .
193269
194270
- name: Test vsock plugin
195-
run: ./scripts/test_vsock.sh -i ${{ github.workspace }}/artifacts/opt/share/fc_test -p ${{ github.workspace }}/artifacts/opt/lib/libvaccel-jetson.so
271+
run: ./scripts/test_vsock.sh -i ${{ github.workspace }}/artifacts/opt/share/fc_test -p ${{ github.workspace }}/artifacts/opt/lib/libvaccel-noop.so
196272

197273
- name: Pack latest release
198-
if: ${{ github.event_name == 'push' }}
274+
if: ${{ github.event_name == 'pull_request' || github.event_name == 'push' && github.ref == 'refs/heads/master' }}
199275
working-directory: ${{ github.workspace }}/artifacts/opt
200276
run: |
201277
cp ${{github.workspace}}/conf/{config_virtio_accel.json,config_vsock.json} share/
202278
cp /opt/cargo/bin/vaccelrt-agent bin/
203279
zip -r ${{github.workspace}}/vaccel_${{matrix.arch}}_${{matrix.build_type}}.zip bin/ include/ lib/ \
204280
share/config_virtio_accel.json share/config_vsock.json \
205-
share/fc_test share/fc_test.pub \
206281
share/rootfs.img share/virtio_accel.ko share/vmlinux \
282+
share/kata-containers.img share/virtio_accel-kata.ko share/vmlinux-kata-fc \
283+
share/configuration-fc.toml \
207284
share/vaccel.pc
208285
286+
- name: Extract branch name
287+
env:
288+
GITHUB_CONTEXT: ${{ toJson(github) }}
289+
shell: bash
290+
run: echo "##[set-output name=branch;]$(echo ${{ github.head_ref }})"
291+
id: extract_branch
292+
293+
209294
- name: Upload latest master release to s3
210-
if: ${{ github.event_name == 'push' }}
295+
if: ${{ github.event_name == 'pull_request' || github.event_name == 'push' && github.ref == 'refs/heads/master' }}
211296
uses: cloudkernels/minio-upload@master
212297
with:
213298
url: https://s3.nubificus.co.uk
214299
access-key: ${{ env.NBFC_S3_ACCESS }}
215300
secret-key: ${{ env.NBFC_S3_SECRET }}
216-
remote-path: nbfc-assets/github/vaccel/master/${{env.ARCH}}/${{env.JOB_TYPE}}/
301+
remote-path: nbfc-assets/github/vaccel/${{ steps.extract_branch.outputs.branch }}/${{env.ARCHITECTURE}}/${{env.JOB_TYPE}}/
217302
local-path: /github/workspace/vaccel_${{matrix.arch}}_${{matrix.build_type}}.zip
218303

219304
- name: Cleanup run
220305
if: ${{ always() }}
306+
#if: ${{ github.ref == 'refs/heads/main' }}
221307
run: |
222308
sudo rm -rf ${{ github.workspace }}/*
223309
sudo rm -rf ${{ github.workspace }}/.??*
@@ -249,27 +335,35 @@ jobs:
249335
echo "::set-output name=uid::$(id -u)"
250336
echo "::set-output name=gid::$(id -g)"
251337
338+
- name: Extract branch name
339+
env:
340+
GITHUB_CONTEXT: ${{ toJson(github) }}
341+
shell: bash
342+
run: echo "##[set-output name=branch;]$(echo ${{ github.head_ref }})"
343+
id: extract_branch
344+
345+
252346
- name: Download artifacts
253-
if: ${{ github.event_name == 'push' }}
347+
if: ${{ github.event_name == 'pull_request' || github.event_name == 'push' && github.ref == 'refs/heads/master' }}
254348
uses: cloudkernels/minio-download@master
255349
with:
256350
url: https://s3.nubificus.co.uk
257351
access-key: ${{ env.NBFC_S3_ACCESS }}
258352
secret-key: ${{ env.NBFC_S3_SECRET }}
259-
remote-path: nbfc-assets/github/vaccel/master/
353+
remote-path: nbfc-assets/github/vaccel/${{ steps.extract_branch.outputs.branch }}/
260354
local-path: /github/workspace/master/
261355
env:
262356
ACTION_UID: ${{ steps.vars.outputs.uid }}
263357
ACTION_GID: ${{ steps.vars.outputs.gid }}
264-
358+
265359
- name: Update the release
266-
if: ${{ github.event_name == 'push' }}
360+
if: ${{ github.event_name == 'pull_request' || github.event_name == 'push' && github.ref == 'refs/heads/master' }}
267361
uses: marvinpinto/action-automatic-releases@latest
268362
with:
269363
repo_token: ${{ secrets.GITHUB_TOKEN }}
270-
automatic_release_tag: "latest"
364+
automatic_release_tag: ${{ steps.extract_branch.outputs.branch }}
271365
prerelease: true
272-
title: "Latest master build"
366+
title: "Latest ${{ steps.extract_branch.outputs.branch }} build"
273367
files: |
274368
master/vaccel_x86_64_Debug.zip
275369
master/vaccel_x86_64_Release.zip

.gitmodules

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
[submodule "firecracker"]
55
path = firecracker
66
url = git@github.com:cloudkernels/firecracker.git
7-
[submodule "virtio-accel"]
8-
path = virtio-accel
9-
url = git@github.com:cloudkernels/virtio-accel.git
107
[submodule "vaccel-grpc"]
118
path = vaccel-grpc
129
url = git@github.com:cloudkernels/vaccel-grpc.git
@@ -16,3 +13,10 @@
1613
[submodule "agent"]
1714
path = agent
1815
url = git@github.com:cloudkernels/vaccelrt-agent
16+
[submodule "kata-containers"]
17+
path = kata-containers
18+
url = https://github.com/nubificus/kata-containers
19+
branch = vaccel-release
20+
[submodule "virtio-accel"]
21+
path = virtio-accel
22+
url = https://github.com/cloudkernels/virtio-accel

dockerfiles/ubuntu/latest/Dockerfile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,14 @@ RUN echo "export VACCEL_BACKENDS=/opt/vaccel/lib/libvaccel-virtio.so" >> /root/.
3131

3232
# Enable ssh server
3333
RUN systemctl enable ssh
34-
COPY fc_test.pub id_rsa.pub
35-
RUN mkdir /root/.ssh/ && \
36-
cat id_rsa.pub >> /root/.ssh/authorized_keys && \
37-
chmod 0700 /root/.ssh && \
38-
chmod 0600 /root/.ssh/authorized_keys && \
39-
chown -R root:root /root/.ssh
34+
#COPY fc_test.pub id_rsa.pub
35+
RUN echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
36+
RUN echo "PermitEmptyPasswords yes" >> /etc/ssh/sshd_config
37+
#RUN mkdir /root/.ssh/ && \
38+
# cat id_rsa.pub >> /root/.ssh/authorized_keys && \
39+
# chmod 0700 /root/.ssh && \
40+
# chmod 0600 /root/.ssh/authorized_keys && \
41+
# chown -R root:root /root/.ssh
4042

4143
# Disable root password
4244
RUN sed s/root\:x\:/root\:\:/ -i /etc/passwd

kata-containers

Submodule kata-containers added at 8d27480

scripts/build_rootfs.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ build() {
7777
cd ${BUILD_DIR}/rootfs
7878

7979
# Create RSA key to rootfs
80-
ssh-keygen -t rsa -f fc_test -N ""
80+
#ssh-keygen -t rsa -f fc_test -N ""
8181

8282
# Create root filesystem
83-
DOCKER_BUILDKIT=1 docker build \
83+
DOCKER_BUILDKIT=1 docker build --no-cache \
8484
--network=host \
8585
-t vaccel-rootfs \
8686
--build-arg "KERNEL_VERSION=4.20.0" \
@@ -96,7 +96,7 @@ build() {
9696
sudo mount rootfs.img $mnt
9797
ok_or_die "Could not mount rootfs"
9898

99-
sudo rsync -aogxvPH rootfs/* $mnt
99+
sudo rsync -aogxPH rootfs/* $mnt
100100
sudo chown -R root:root $mnt/root
101101
ok_or_die "Could not populate rootfs"
102102

@@ -110,7 +110,7 @@ build() {
110110
sudo rmdir $mnt
111111

112112
cp rootfs.img ${INSTALL_PREFIX}/share/
113-
cp fc_test* ${INSTALL_PREFIX}/share/
113+
#cp fc_test* ${INSTALL_PREFIX}/share/
114114
cp -r imagenet/{networks,images} ${INSTALL_PREFIX}/share/
115115
}
116116

scripts/test_virtio.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ SSH_TIMEOUT=300
1313
FC_IP="172.42.0.2"
1414

1515
# Path to ssh private key
16-
SSH_KEY=$(pwd)/opt/share/fc_test
16+
#SSH_KEY=$(pwd)/opt/share/fc_test
1717

1818
# script name for logging
1919
LOG_NAME="$(basename $0)"
@@ -28,7 +28,7 @@ print_help() {
2828
echo " -v|--vaccel Directory of vAccel installation (default: '/opt/vaccel')"
2929
echo " -t|--timeout Timeout in seconds to wait response from Firecracker (default: 300)"
3030
echo " -a|--ip-address Address of Firecracker VM"
31-
echo " -i|--ssh-key RSA key to use for SSHing inside the VM"
31+
echo " -i|--ssh-key RSA key to use for SSHing inside the VM (not currently used)"
3232
echo ""
3333
}
3434

@@ -37,7 +37,8 @@ run_test() {
3737
in_fc_cmd="$in_fc_cmd VACCEL_BACKENDS=$VACCEL_PATH/lib/libvaccel-virtio.so"
3838
in_fc_cmd="$in_fc_cmd $VACCEL_PATH/bin/classify /root/images/dog_0.jpg 1"
3939

40-
ssh -o StrictHostKeyChecking=no -i $SSH_KEY root@$FC_IP $in_fc_cmd
40+
ssh -o StrictHostKeyChecking=no -o GlobalKnownHostsFile=/dev/null \
41+
-o UserKnownHostsFile=/dev/null root@$FC_IP $in_fc_cmd
4142
}
4243

4344
main() {

scripts/test_vsock.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ SSH_TIMEOUT=300
1313
FC_IP="172.42.0.2"
1414

1515
# Path to ssh private key
16-
SSH_KEY=$(pwd)/opt/share/fc_test
16+
#SSH_KEY=$(pwd)/opt/share/fc_test
1717

1818
# vsock socket to use inside the VM
1919
VACCEL_VSOCK="vsock://2:2048"
@@ -37,7 +37,7 @@ print_help() {
3737
echo " -v|--vaccel Directory of vAccel installation (default: '/opt/vaccel')"
3838
echo " -t|--timeout Timeout in seconds to wait response from Firecracker (default: 300)"
3939
echo " -a|--ip-address Address of Firecracker VM"
40-
echo " -i|--ssh-key RSA key to use for SSHing inside the VM"
40+
echo " -i|--ssh-key RSA key to use for SSHing inside the VM (not currently used)"
4141
echo " -p|--plugin Plugin to use for agent"
4242
echo " --vsock Vsock socket to use inside the VM"
4343
echo " --unix Unix socket to use on host"
@@ -62,7 +62,8 @@ run_test() {
6262
launch_agent
6363
ok_or_die "Could not launch agent"
6464

65-
ssh -o StrictHostKeyChecking=no -i $SSH_KEY root@$FC_IP $in_fc_cmd
65+
ssh -o StrictHostKeyChecking=no -o GlobalKnownHostsFile=/dev/null \
66+
-o UserKnownHostsFile=/dev/null root@$FC_IP $in_fc_cmd
6667
}
6768

6869
main() {

virtio-accel

0 commit comments

Comments
 (0)