-
Notifications
You must be signed in to change notification settings - Fork 626
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: apostasie <[email protected]>
- Loading branch information
Showing
7 changed files
with
417 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# This pipeline purpose is solely meant to run a subset of our test suites against a kube cluster | ||
name: kube | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- 'release/**' | ||
pull_request: | ||
paths-ignore: | ||
- '**.md' | ||
|
||
env: | ||
ROOTFUL: true | ||
|
||
jobs: | ||
linux: | ||
runs-on: "ubuntu-24.04" | ||
timeout-minutes: 40 | ||
steps: | ||
- uses: actions/[email protected] | ||
with: | ||
fetch-depth: 1 | ||
- name: "Prepare integration test environment" | ||
run: | | ||
./hack/build-integration-kube.sh | ||
- name: "Run Kube integration tests" | ||
run: | | ||
sudo ./_output/nerdctl exec -ti nerdctl-test-control-plane bash -c -- 'export TMPDIR="$HOME"/tmp; mkdir -p "$TMPDIR"; cd /nerdctl-source; /usr/local/go/bin/go test ./cmd/nerdctl/ -test.kube' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright The containerd Authors. | ||
|
||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
|
||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# shellcheck disable=SC2034,SC2015 | ||
set -o errexit -o errtrace -o functrace -o nounset -o pipefail | ||
root="$(cd "$(dirname "${BASH_SOURCE[0]:-$PWD}")" 2>/dev/null 1>&2 && pwd)" | ||
readonly root | ||
# shellcheck source=/dev/null | ||
. "$root/scripts/lib.sh" | ||
|
||
GO_VERSION=1.22 | ||
KIND_VERSION=v0.23.0 | ||
|
||
[ "$(uname -m)" == "aarch64" ] && GOARCH=arm64 || GOARCH=amd64 | ||
|
||
_rootful= | ||
|
||
configure::rootful(){ | ||
log::debug "Configuring rootful to: ${1:+true}" | ||
_rootful="${1:+true}" | ||
} | ||
|
||
install::kind(){ | ||
local version="$1" | ||
local temp | ||
temp="$(fs::mktemp "install")" | ||
|
||
http::get "$temp"/kind "https://kind.sigs.k8s.io/dl/$version/kind-linux-${GOARCH:-amd64}" | ||
host::install "$temp"/kind | ||
} | ||
|
||
# shellcheck disable=SC2120 | ||
install::kubectl(){ | ||
local version="${1:-}" | ||
[ "$version" ] || version="$(http::get /dev/stdout https://dl.k8s.io/release/stable.txt)" | ||
local temp | ||
temp="$(fs::mktemp "install")" | ||
|
||
http::get "$temp"/kubectl "https://storage.googleapis.com/kubernetes-release/release/$version/bin/linux/${GOARCH:-amd64}/kubectl" | ||
host::install "$temp"/kubectl | ||
} | ||
|
||
exec::kind(){ | ||
local args=() | ||
[ ! "$_rootful" ] || args=(sudo -E) | ||
args+=(kind) | ||
|
||
log::debug "${args[*]} $*" | ||
"${args[@]}" "$@" | ||
} | ||
|
||
exec::nerdctl(){ | ||
local args=() | ||
[ ! "$_rootful" ] || args=(sudo -E) | ||
args+=("$(pwd)"/_output/nerdctl) | ||
|
||
log::debug "${args[*]} $*" | ||
"${args[@]}" "$@" | ||
} | ||
|
||
# Install dependencies | ||
main(){ | ||
log::info "Configuring rootful" | ||
configure::rootful "${ROOTFUL:-}" | ||
|
||
log::info "Installing host dependencies if necessary" | ||
host::require kind 2>/dev/null || install::kind "$KIND_VERSION" | ||
host::require kubectl 2>/dev/null || install::kubectl | ||
|
||
# Build nerdctl to use for kind | ||
make binaries | ||
PATH=$(pwd)/_output:"$PATH" | ||
export PATH | ||
|
||
# Hack to get go into kind control plane | ||
exec::nerdctl rm -f go-kind 2>/dev/null || true | ||
exec::nerdctl run -d --name go-kind golang:"$GO_VERSION" sleep Inf | ||
exec::nerdctl cp go-kind:/usr/local/go /tmp/go | ||
|
||
# Create fresh cluster | ||
log::info "Creating new cluster" | ||
export KIND_EXPERIMENTAL_PROVIDER=nerdctl | ||
exec::kind delete cluster --name nerdctl-test 2>/dev/null || true | ||
exec::kind create cluster --name nerdctl-test --config=./hack/kind.yaml | ||
} | ||
|
||
main "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# https://pkg.go.dev/sigs.k8s.io/kind/pkg/apis/config/v1alpha4#Cluster | ||
kind: Cluster | ||
apiVersion: kind.x-k8s.io/v1alpha4 | ||
nodes: | ||
- role: control-plane | ||
extraMounts: | ||
- hostPath: _output/nerdctl | ||
containerPath: /usr/local/bin/nerdctl | ||
- hostPath: /tmp/go | ||
containerPath: /usr/local/go | ||
- hostPath: . | ||
containerPath: /nerdctl-source |
Oops, something went wrong.