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
|
- name: Install containerd dependencies
|
||||||
env:
|
env:
|
||||||
RUNC_FLAVOR: ${{ matrix.runc }}
|
RUNC_FLAVOR: ${{ matrix.runc }}
|
||||||
GOFLAGS: -modcacherw
|
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get install -y gperf
|
sudo apt-get install -y gperf
|
||||||
sudo -E PATH=$PATH script/setup/install-seccomp
|
script/setup/install-seccomp
|
||||||
sudo -E PATH=$PATH script/setup/install-runc
|
script/setup/install-runc
|
||||||
sudo -E PATH=$PATH script/setup/install-cni $(grep containernetworking/plugins go.mod | awk '{print $2}')
|
script/setup/install-cni $(grep containernetworking/plugins go.mod | awk '{print $2}')
|
||||||
sudo -E PATH=$PATH script/setup/install-critools
|
script/setup/install-critools
|
||||||
|
script/setup/install-failpoint-binaries
|
||||||
|
|
||||||
- name: Install criu
|
- name: Install criu
|
||||||
run: |
|
run: |
|
||||||
@ -429,10 +429,6 @@ jobs:
|
|||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y criu
|
sudo apt-get install -y criu
|
||||||
|
|
||||||
- name: Install failpoint binaries
|
|
||||||
run: |
|
|
||||||
script/setup/install-failpoint-binaries
|
|
||||||
|
|
||||||
- name: Install containerd
|
- name: Install containerd
|
||||||
env:
|
env:
|
||||||
CGO_ENABLED: 1
|
CGO_ENABLED: 1
|
||||||
@ -440,7 +436,7 @@ jobs:
|
|||||||
make binaries GO_BUILD_FLAGS="-mod=vendor"
|
make binaries GO_BUILD_FLAGS="-mod=vendor"
|
||||||
sudo -E PATH=$PATH make install
|
sudo -E PATH=$PATH make install
|
||||||
|
|
||||||
- run: sudo -E PATH=$PATH script/setup/install-gotestsum
|
- run: script/setup/install-gotestsum
|
||||||
- name: Tests
|
- name: Tests
|
||||||
env:
|
env:
|
||||||
GOPROXY: direct
|
GOPROXY: direct
|
||||||
@ -540,7 +536,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
go-version: ${{ env.GO_VERSION }}
|
go-version: ${{ env.GO_VERSION }}
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- run: sudo -E PATH=$PATH script/setup/install-gotestsum
|
- run: script/setup/install-gotestsum
|
||||||
- name: Tests
|
- name: Tests
|
||||||
env:
|
env:
|
||||||
GOPROXY: direct
|
GOPROXY: direct
|
||||||
|
@ -25,6 +25,12 @@ CNI_COMMIT=${1:-$(grep containernetworking/plugins "$GOPATH"/src/github.com/cont
|
|||||||
CNI_DIR=${DESTDIR:=''}/opt/cni
|
CNI_DIR=${DESTDIR:=''}/opt/cni
|
||||||
CNI_CONFIG_DIR=${DESTDIR}/etc/cni/net.d
|
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)
|
TMPROOT=$(mktemp -d)
|
||||||
git clone https://github.com/containernetworking/plugins.git "${TMPROOT}"/plugins
|
git clone https://github.com/containernetworking/plugins.git "${TMPROOT}"/plugins
|
||||||
pushd "${TMPROOT}"/plugins
|
pushd "${TMPROOT}"/plugins
|
||||||
@ -32,8 +38,8 @@ git checkout "$CNI_COMMIT"
|
|||||||
./build_linux.sh
|
./build_linux.sh
|
||||||
mkdir -p $CNI_DIR
|
mkdir -p $CNI_DIR
|
||||||
cp -r ./bin $CNI_DIR
|
cp -r ./bin $CNI_DIR
|
||||||
mkdir -p $CNI_CONFIG_DIR
|
$SUDO mkdir -p $CNI_CONFIG_DIR
|
||||||
cat << EOF | tee $CNI_CONFIG_DIR/10-containerd-net.conflist
|
$SUDO cat << EOF | $SUDO tee $CNI_CONFIG_DIR/10-containerd-net.conflist
|
||||||
{
|
{
|
||||||
"cniVersion": "1.0.0",
|
"cniVersion": "1.0.0",
|
||||||
"name": "containerd-net",
|
"name": "containerd-net",
|
||||||
|
@ -22,6 +22,12 @@ set -eu -o pipefail
|
|||||||
|
|
||||||
script_dir="$(cd -- "$(dirname -- "$0")" > /dev/null 2>&1; pwd -P)"
|
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)"
|
cd "$(go env GOPATH)"
|
||||||
go install github.com/onsi/ginkgo/v2/ginkgo@v2.1.4
|
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
|
pushd "${TMPROOT}"/cri-tools
|
||||||
git checkout "$CRITEST_COMMIT"
|
git checkout "$CRITEST_COMMIT"
|
||||||
make
|
make
|
||||||
make install -e DESTDIR="${DESTDIR}" BINDIR=/usr/local/bin
|
$SUDO make install -e DESTDIR="${DESTDIR}" BINDIR=/usr/local/bin
|
||||||
|
|
||||||
mkdir -p "${DESTDIR}/etc/"
|
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
|
runtime-endpoint: unix:///run/containerd/containerd.sock
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
@ -22,6 +22,12 @@ set -eu -o pipefail
|
|||||||
|
|
||||||
script_dir="$(cd -- "$(dirname -- "$0")" > /dev/null 2>&1; pwd -P)"
|
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() {
|
function install_runc() {
|
||||||
# When updating runc-version, consider updating the runc module in go.mod as well
|
# When updating runc-version, consider updating the runc module in go.mod as well
|
||||||
: "${RUNC_VERSION:=$(cat "${script_dir}/runc-version")}"
|
: "${RUNC_VERSION:=$(cat "${script_dir}/runc-version")}"
|
||||||
@ -31,15 +37,15 @@ function install_runc() {
|
|||||||
pushd "${TMPROOT}"/runc
|
pushd "${TMPROOT}"/runc
|
||||||
git checkout "${RUNC_VERSION}"
|
git checkout "${RUNC_VERSION}"
|
||||||
make BUILDTAGS='seccomp' runc
|
make BUILDTAGS='seccomp' runc
|
||||||
make install
|
$SUDO make install
|
||||||
popd
|
popd
|
||||||
rm -fR "${TMPROOT}"
|
rm -fR "${TMPROOT}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_crun() {
|
function install_crun() {
|
||||||
: "${CRUN_VERSION:=$(cat "${script_dir}/crun-version")}"
|
: "${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)"
|
$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)"
|
||||||
chmod +x /usr/local/sbin/runc
|
$SUDO chmod +x /usr/local/sbin/runc
|
||||||
}
|
}
|
||||||
|
|
||||||
: "${RUNC_FLAVOR:=runc}"
|
: "${RUNC_FLAVOR:=runc}"
|
||||||
|
@ -30,8 +30,8 @@ curl -fsSL "https://github.com/seccomp/libseccomp/releases/download/v${SECCOMP_V
|
|||||||
cd "$SECCOMP_PATH"
|
cd "$SECCOMP_PATH"
|
||||||
./configure --prefix=/usr/local
|
./configure --prefix=/usr/local
|
||||||
make
|
make
|
||||||
make install
|
sudo make install
|
||||||
ldconfig
|
sudo ldconfig
|
||||||
)
|
)
|
||||||
|
|
||||||
rm -rf "$SECCOMP_PATH"
|
rm -rf "$SECCOMP_PATH"
|
||||||
|
Loading…
Reference in New Issue
Block a user