From 8b19c32875043f90a7a89c272ba6cb98c1447a3e Mon Sep 17 00:00:00 2001 From: Salvador Fuentes Date: Mon, 28 May 2018 12:09:56 -0500 Subject: [PATCH] kernel: Add config version file In order to track the changes that we add to the kernel, lets add a kata_config_version file that should be bumped whenever a change is added to the kernel directory Fixes #43. Signed-off-by: Salvador Fuentes --- .ci/lib.sh | 26 ++++++++++++++++++++++++++ .ci/run.sh | 6 +++++- kernel/kata_config_version | 1 + 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 .ci/lib.sh create mode 100644 kernel/kata_config_version diff --git a/.ci/lib.sh b/.ci/lib.sh new file mode 100644 index 0000000000..194cf5296a --- /dev/null +++ b/.ci/lib.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# +# Copyright (c) 2018 Intel Corporation +# +# SPDX-License-Identifier: Apache-2.0 + +# If we fail for any reason a message will be displayed +die(){ + msg="$*" + echo "ERROR: $msg" >&2 + exit 1 +} + +# Check that kata_confing_version file is updated +# when there is any change in the kernel directory. +# If there is a change in the directory, but the config +# version is not updated, return error. +check_kata_kernel_version(){ + kernel_version_file="kernel/kata_config_version" + modified_files=$(git diff --name-only master..) + if echo "$modified_files" | grep "kernel/"; then + echo "$modified_files" | grep "$kernel_version_file" || \ + die "Please bump version in $kernel_version_file" + fi + +} diff --git a/.ci/run.sh b/.ci/run.sh index 2e40f8e618..50eedb5585 100755 --- a/.ci/run.sh +++ b/.ci/run.sh @@ -9,6 +9,10 @@ set -o errexit set -o nounset set -o pipefail +cidir=$(dirname "$0") +source "${cidir}/lib.sh" + # This script will execute packaging tests suite # TODO: Add steps needed to build packages -true + +check_kata_kernel_version diff --git a/kernel/kata_config_version b/kernel/kata_config_version new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/kernel/kata_config_version @@ -0,0 +1 @@ +1