Merge pull request #2425 from dcmiddle/cleanup-kernel-packaging

Cleanup kernel packaging
This commit is contained in:
Fabiano Fidêncio
2021-08-18 08:24:12 +02:00
committed by GitHub
8 changed files with 15 additions and 232 deletions

View File

@@ -1,8 +0,0 @@
# Jenkins
Kata Containers uses [Jenkins](https://jenkins.io/)
for [its main CI](http://jenkins.katacontainers.io/).
This directory contains support files for the Jenkins
[pipeline](https://jenkins.io/doc/book/pipeline/)
[plugin](https://wiki.jenkins.io/display/JENKINS/Pipeline+Plugin).

View File

@@ -1,40 +0,0 @@
// Copyright (c) 2019 Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0
//
pipeline {
agent none
parameters {
string(
name: 'BRANCH',
defaultValue:"master",
description: "Kata Containers Branch"
)
string(
name: 'NEW_VERSION',
defaultValue:"",
description: "Kata Containers version"
)
}
environment {
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
BRANCH="${params.BRANCH}"
NEW_VERSION="${params.NEW_VERSION}"
}
stages {
stage('Bump repos') {
agent { label 'ubuntu-lts-latest-azure' }
steps {
sh 'git clone https://github.com/kata-containers/packaging.git'
withCredentials([string(credentialsId: 'katabuilder-git-bump', variable: 'GITHUB_TOKEN')]) {
dir("${WORKSPACE}/packaging/Jenkinsfiles/release_pipeline/") {
sh '''
./git_credential_cache.sh
./bump.sh "${NEW_VERSION}" "${BRANCH}"
'''
}
}
}
}
}
}

View File

@@ -1,109 +0,0 @@
#!/bin/bash
# Copyright (c) 2019 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#
export CI="true"
set -o errexit
set -o nounset
set -o pipefail
set -o errtrace
readonly script_name="$(basename "${BASH_SOURCE[0]}")"
function handle_error() {
local exit_code="${?}"
local line_number="${1:-}"
echo "Failed at $line_number: ${BASH_COMMAND}"
exit "${exit_code}"
}
trap 'handle_error $LINENO' ERR
die() {
echo >&2 "ERROR: $*"
exit 1
}
install_go() {
echo "Installing go"
export GOROOT="/usr/local/go"
# shellcheck disable=SC2016
echo 'export PATH=$PATH:'"${GOROOT}/bin" | sudo tee -a /etc/profile
export PATH="$PATH:${GOROOT}/bin"
export GOPATH="${WORKSPACE}/go"
mkdir -p "${GOPATH}"
tests_repo="github.com/kata-containers/tests"
tests_repo_dir="${GOPATH}/src/${tests_repo}"
# shellcheck disable=SC2046
mkdir -p $(dirname "${tests_repo_dir}")
[ -d "${tests_repo_dir}" ] || git clone "https://${tests_repo}.git" "${tests_repo_dir}"
"${GOPATH}/src/${tests_repo}/.ci/install_go.sh" -p -f
go version
}
install_docker() {
echo "Installing docker"
sudo -E apt-get --no-install-recommends install -y apt-transport-https apt-utils ca-certificates software-properties-common
curl -sL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
arch=$(dpkg --print-architecture)
sudo -E add-apt-repository "deb [arch=${arch}] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo -E apt-get update
sudo -E apt-get --no-install-recommends install -y docker-ce
}
setup_git() {
echo "configuring git"
git config --global user.email "katabuilder@katacontainers.io"
git config --global user.name "katabuilder"
export HUB_PROTOCOL=https
}
bump_kata() {
new_version=${1:-}
branch=${2:-}
[ -n "${new_version}" ]
[ -n "${branch}" ]
readonly packaging_repo="github.com/kata-containers/packaging"
readonly packaging_repo_dir="${GOPATH}/src/${packaging_repo}"
[ -d "${packaging_repo_dir}" ] || git clone "https://${packaging_repo}.git" "${packaging_repo_dir}"
cd "${packaging_repo_dir}/release"
./update-repository-version.sh -p "$new_version" "$branch"
}
setup() {
setup_git
install_go
install_docker
}
usage() {
exit_code="$1"
cat <<EOT
Usage:
${script_name} <args>
Args:
<new-version> : new version to bump kata
<branch> : branch target
Example:
${script_name} 1.10
EOT
exit "$exit_code"
}
main() {
new_version=${1:-}
branch=${2:-}
[ -n "${new_version}" ] || usage 1
[ -n "${branch}" ] || usage 1
echo "Start Release ${new_version} for branch ${branch}"
setup
bump_kata "${new_version}" "${branch}"
}
main $@

View File

@@ -1,58 +0,0 @@
#!/bin/bash
# Copyright (c) 2019 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#
set -o errexit
set -o nounset
set -o pipefail
set -o errtrace
die() {
echo >&2 "ERROR: $*"
exit 1
}
init_git_credential_cache() {
#This is needed to setup github credentials to do push in a job
(
set -o errexit
set -o nounset
set -o pipefail
set -o errtrace
set +x
readonly token_sh=$(mktemp)
readonly agent_clone=$(mktemp -d)
finish() {
rm -rf "${token_sh}"
rm -rf "${agent_clone}"
}
trap finish EXIT
chmod 700 "${token_sh}"
cat <<EOT >"${token_sh}"
#!/bin/bash
echo "\$GITHUB_TOKEN"
EOT
export GIT_ASKPASS=${token_sh}
#cache credential
git config --global credential.helper cache
#setup credential
git clone https://github.com/katabuilder/agent.git "${agent_clone}"
cd "${agent_clone}" || exit 1
#this set the credential for first time
git push
# not needed anymore
unset GIT_ASKPASS
) >>/dev/null
}
main() {
[ -n "$GITHUB_TOKEN" ] || die "GITHUB_TOKEN not set"
init_git_credential_cache
}
main $@

View File

@@ -36,10 +36,6 @@ See [the ccloudvm documentation](ccloudvm).
See [the release documentation](release).
## Jenkins files
See [the Jenkins documentation](Jenkinsfiles).
## Packaging scripts
See the [scripts documentation](scripts).

View File

@@ -8,6 +8,14 @@ automates the process to build a kernel for Kata Containers.
The `build-kernel.sh` script requires an installed Golang version matching the
[component build requirements](../../../docs/Developer-Guide.md#requirements-to-build-individual-components).
It also requires [yq](https://github.com/mikefarah/yq) version 3.4.1
> **Hint**: `snap install yq --channel=v3/stable`
The Linux kernel scripts further require a few packages (flex, bison, and libelf-dev)
See the CI scripts for your distro for more information...
Look for the setup*.sh files [here](https://github.com/kata-containers/tests/tree/main/.ci)
## Usage
@@ -17,9 +25,6 @@ Overview:
Build a kernel for Kata Containers
Description: This script is the *ONLY* to build a kernel for development.
Usage:
build-kernel.sh [options] <command> <argument>
@@ -49,14 +54,16 @@ Options:
Example:
```
$ ./build-kernel.sh -v 4.19.86 -g nvidia -f -d setup
$ ./build-kernel.sh -v 5.10.25 -g nvidia -f -d setup
```
> **Note**
> - `-v 4.19.86`: Specify the guest kernel version.
> - `-v 5.10.25`: Specify the guest kernel version.
> - `-g nvidia`: To build a guest kernel supporting Nvidia GPU.
> - `-f`: The `.config` file is forced to be generated even if the kernel directory already exists.
> - `-d`: Enable bash debug mode.
> **Hint**: When in doubt look at [versions.yaml](../../../versions.yaml) to see what kernel version CI is using.
## Setup kernel source code
@@ -90,7 +97,7 @@ on this path, the following command will install it to the default Kata
containers path (`/usr/share/kata-containers/`).
```bash
$ ./build-kernel.sh install
$ sudo ./build-kernel.sh install
```
## Submit Kernel Changes

View File

@@ -4,10 +4,6 @@
#
# SPDX-License-Identifier: Apache-2.0
description="
Description: This script is the *ONLY* to build a kernel for development.
"
set -o errexit
set -o nounset
set -o pipefail
@@ -71,7 +67,6 @@ usage() {
Overview:
Build a kernel for Kata Containers
${description}
Usage:

View File

@@ -152,14 +152,14 @@ assets:
kernel:
description: "Linux kernel optimised for virtual machines"
url: "https://cdn.kernel.org/pub/linux/kernel/v4.x/"
url: "https://cdn.kernel.org/pub/linux/kernel/v5.x/"
uscan-url: >-
https://mirrors.edge.kernel.org/pub/linux/kernel/v5.x/linux-(5\.4\..+)\.tar\.gz
version: "v5.10.25"
kernel-experimental:
description: "Linux kernel with virtio-fs support"
url: "https://cdn.kernel.org/pub/linux/kernel/v4.x/"
url: "https://cdn.kernel.org/pub/linux/kernel/v5.x/"
tag: "v5.10.25"
externals: