Rework permission handling in scripts
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
This commit is contained in:
parent
68bae258a3
commit
8add7e5d39
18
.github/workflows/ci.yml
vendored
18
.github/workflows/ci.yml
vendored
@ -415,13 +415,13 @@ jobs:
|
||||
- name: Install containerd dependencies
|
||||
env:
|
||||
RUNC_FLAVOR: ${{ matrix.runc }}
|
||||
GOFLAGS: -modcacherw
|
||||
run: |
|
||||
sudo apt-get install -y gperf
|
||||
sudo -E PATH=$PATH script/setup/install-seccomp
|
||||
sudo -E PATH=$PATH script/setup/install-runc
|
||||
sudo -E PATH=$PATH script/setup/install-cni $(grep containernetworking/plugins go.mod | awk '{print $2}')
|
||||
sudo -E PATH=$PATH script/setup/install-critools
|
||||
script/setup/install-seccomp
|
||||
script/setup/install-runc
|
||||
script/setup/install-cni $(grep containernetworking/plugins go.mod | awk '{print $2}')
|
||||
script/setup/install-critools
|
||||
script/setup/install-failpoint-binaries
|
||||
|
||||
- name: Install criu
|
||||
run: |
|
||||
@ -429,10 +429,6 @@ jobs:
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y criu
|
||||
|
||||
- name: Install failpoint binaries
|
||||
run: |
|
||||
script/setup/install-failpoint-binaries
|
||||
|
||||
- name: Install containerd
|
||||
env:
|
||||
CGO_ENABLED: 1
|
||||
@ -440,7 +436,7 @@ jobs:
|
||||
make binaries GO_BUILD_FLAGS="-mod=vendor"
|
||||
sudo -E PATH=$PATH make install
|
||||
|
||||
- run: sudo -E PATH=$PATH script/setup/install-gotestsum
|
||||
- run: script/setup/install-gotestsum
|
||||
- name: Tests
|
||||
env:
|
||||
GOPROXY: direct
|
||||
@ -540,7 +536,7 @@ jobs:
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
- uses: actions/checkout@v2
|
||||
- run: sudo -E PATH=$PATH script/setup/install-gotestsum
|
||||
- run: script/setup/install-gotestsum
|
||||
- name: Tests
|
||||
env:
|
||||
GOPROXY: direct
|
||||
|
@ -25,6 +25,12 @@ CNI_COMMIT=${1:-$(grep containernetworking/plugins "$GOPATH"/src/github.com/cont
|
||||
CNI_DIR=${DESTDIR:=''}/opt/cni
|
||||
CNI_CONFIG_DIR=${DESTDIR}/etc/cni/net.d
|
||||
|
||||
# e2e and Cirrus will fail with "sudo: command not found"
|
||||
SUDO=''
|
||||
if (( $EUID != 0 )); then
|
||||
SUDO='sudo'
|
||||
fi
|
||||
|
||||
TMPROOT=$(mktemp -d)
|
||||
git clone https://github.com/containernetworking/plugins.git "${TMPROOT}"/plugins
|
||||
pushd "${TMPROOT}"/plugins
|
||||
@ -32,8 +38,8 @@ git checkout "$CNI_COMMIT"
|
||||
./build_linux.sh
|
||||
mkdir -p $CNI_DIR
|
||||
cp -r ./bin $CNI_DIR
|
||||
mkdir -p $CNI_CONFIG_DIR
|
||||
cat << EOF | tee $CNI_CONFIG_DIR/10-containerd-net.conflist
|
||||
$SUDO mkdir -p $CNI_CONFIG_DIR
|
||||
$SUDO cat << EOF | $SUDO tee $CNI_CONFIG_DIR/10-containerd-net.conflist
|
||||
{
|
||||
"cniVersion": "1.0.0",
|
||||
"name": "containerd-net",
|
||||
|
@ -22,6 +22,12 @@ set -eu -o pipefail
|
||||
|
||||
script_dir="$(cd -- "$(dirname -- "$0")" > /dev/null 2>&1; pwd -P)"
|
||||
|
||||
# e2e will fail with "sudo: command not found"
|
||||
SUDO=''
|
||||
if (( $EUID != 0 )); then
|
||||
SUDO='sudo'
|
||||
fi
|
||||
|
||||
cd "$(go env GOPATH)"
|
||||
go install github.com/onsi/ginkgo/v2/ginkgo@v2.1.4
|
||||
|
||||
@ -33,10 +39,10 @@ git clone https://github.com/kubernetes-sigs/cri-tools.git "${TMPROOT}/cri-tools
|
||||
pushd "${TMPROOT}"/cri-tools
|
||||
git checkout "$CRITEST_COMMIT"
|
||||
make
|
||||
make install -e DESTDIR="${DESTDIR}" BINDIR=/usr/local/bin
|
||||
$SUDO make install -e DESTDIR="${DESTDIR}" BINDIR=/usr/local/bin
|
||||
|
||||
mkdir -p "${DESTDIR}/etc/"
|
||||
cat << EOF | tee "${DESTDIR}/etc/crictl.yaml"
|
||||
$SUDO cat << EOF | $SUDO tee "${DESTDIR}/etc/crictl.yaml"
|
||||
runtime-endpoint: unix:///run/containerd/containerd.sock
|
||||
EOF
|
||||
|
||||
|
@ -22,6 +22,12 @@ set -eu -o pipefail
|
||||
|
||||
script_dir="$(cd -- "$(dirname -- "$0")" > /dev/null 2>&1; pwd -P)"
|
||||
|
||||
# e2e and Cirrus will fail with "sudo: command not found"
|
||||
SUDO=''
|
||||
if (( $EUID != 0 )); then
|
||||
SUDO='sudo'
|
||||
fi
|
||||
|
||||
function install_runc() {
|
||||
# When updating runc-version, consider updating the runc module in go.mod as well
|
||||
: "${RUNC_VERSION:=$(cat "${script_dir}/runc-version")}"
|
||||
@ -31,15 +37,15 @@ function install_runc() {
|
||||
pushd "${TMPROOT}"/runc
|
||||
git checkout "${RUNC_VERSION}"
|
||||
make BUILDTAGS='seccomp' runc
|
||||
make install
|
||||
$SUDO make install
|
||||
popd
|
||||
rm -fR "${TMPROOT}"
|
||||
}
|
||||
|
||||
function install_crun() {
|
||||
: "${CRUN_VERSION:=$(cat "${script_dir}/crun-version")}"
|
||||
curl -S -o /usr/local/sbin/runc -L https://github.com/containers/crun/releases/download/"${CRUN_VERSION}"/crun-"${CRUN_VERSION}"-linux-"$(go env GOARCH)"
|
||||
chmod +x /usr/local/sbin/runc
|
||||
$SUDO curl -S -o /usr/local/sbin/runc -L https://github.com/containers/crun/releases/download/"${CRUN_VERSION}"/crun-"${CRUN_VERSION}"-linux-"$(go env GOARCH)"
|
||||
$SUDO chmod +x /usr/local/sbin/runc
|
||||
}
|
||||
|
||||
: "${RUNC_FLAVOR:=runc}"
|
||||
|
@ -30,8 +30,8 @@ curl -fsSL "https://github.com/seccomp/libseccomp/releases/download/v${SECCOMP_V
|
||||
cd "$SECCOMP_PATH"
|
||||
./configure --prefix=/usr/local
|
||||
make
|
||||
make install
|
||||
ldconfig
|
||||
sudo make install
|
||||
sudo ldconfig
|
||||
)
|
||||
|
||||
rm -rf "$SECCOMP_PATH"
|
||||
|
Loading…
Reference in New Issue
Block a user