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

CI: run SELinux tests with Rocky Linux 8 #310

Merged
merged 1 commit into from
Feb 7, 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
1 change: 1 addition & 0 deletions .github/.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
GO_VERSION=1.21.3
HUGO_VERSION=0.114.0
LIMA_VERSION=0.20.1
47 changes: 47 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,50 @@ jobs:
with:
name: logs
path: logs

selinux:
name: "SELinux"
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
- name: Checkout cri-dockerd
uses: actions/checkout@v2
with:
repository: ${{ github.repository }}
path: src/github.com/Mirantis/cri-dockerd

- name: Load environment
uses: c-py/action-dotenv-to-setenv@v4
with:
env-file: src/github.com/Mirantis/cri-dockerd/.github/.env

- name: "Install QEMU"
run: |
sudo apt-get update
sudo apt-get install -y qemu-system-x86
sudo apt-get install -y --no-install-recommends ovmf qemu-system-x86 qemu-utils
sudo modprobe kvm
# `sudo usermod -aG kvm $(whoami)` does not take an effect on GHA
sudo chown $(whoami) /dev/kvm

- name: "Install Lima"
run: |
curl -fsSL https://github.com/lima-vm/lima/releases/download/v${LIMA_VERSION}/lima-${LIMA_VERSION}-Linux-x86_64.tar.gz | sudo tar Cxzvf /usr/local -

- name: "Cache ~/.cache/lima"
uses: actions/cache@v4
with:
path: ~/.cache/lima
key: lima-${{ env.LIMA_VERSION }}-rocky-8

- name: "Start Lima"
run: |
limactl start --name=default --plain template://rocky-8
mkdir -p -m 0700 ~/.ssh
cat ~/.lima/default/ssh.config >>~/.ssh/config

- run: rsync -a -e ssh src/github.com/Mirantis/cri-dockerd/ lima-default:/tmp/cri-dockerd
- run: ssh lima-default sudo /tmp/cri-dockerd/scripts/setup-el
- run: ssh lima-default make -C /tmp/cri-dockerd cri-dockerd
- run: ssh -f lima-default sudo /tmp/cri-dockerd/cri-dockerd --network-plugin="" &
- run: ssh lima-default sudo /usr/local/bin/critest -runtime-endpoint=unix:///var/run/cri-dockerd.sock -ginkgo.focus='.*selinux.*' -ginkgo.v
18 changes: 18 additions & 0 deletions scripts/setup-el
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
# Set up Docker (with SELinux enabled) and cri-tools, for EL-like distributions
set -eux -o pipefail

setenforce 1

echo "Installing Docker (with SELinux enabled)"
mkdir -p /etc/docker
cat <<EOF >/etc/docker/daemon.json
{"selinux-enabled": true}
EOF
dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
dnf install -y docker-ce git golang make
sudo systemctl enable --now docker

echo "Installing cri-tools"
git clone https://github.com/kubernetes-sigs/cri-tools.git
(cd cri-tools && make && make install)
Loading