commit scripts im using

This commit is contained in:
Lane Jennison
2020-01-25 16:15:59 -05:00
parent ceeb8dce93
commit 7fe127675a
4 changed files with 109 additions and 25 deletions

25
.gitignore vendored
View File

@@ -1,25 +0,0 @@
#Learn more about Jenkins and JENKINS_HOME directory for which this file is intended.
# http://jenkins-ci.org/
# https://wiki.jenkins-ci.org/display/JENKINS/Administering+Jenkins
#ignore all JENKINS_HOME except jobs directory, root xml config, and .gitignore file
/*
!/jobs
!/.gitignore
!/*.xml
#ignore all files in jobs subdirectories except for folders
#note: git doesn't track folders, only file content
jobs/**
!jobs/**/
#uncomment the following line to save next build numbers with config
#!jobs/**/nextBuildNumber
#exclude only config.xml files in repository subdirectories
!config.xml
#don't track workspaces (when users build on the master)
jobs/**/*workspace
#as a result only settings and job config.xml files in JENKINS_HOME will be tracked by git

View File

@@ -1,2 +1,9 @@
# ci-testing-tools
scripts, tools, configs for CI-testing
Currently just shell scripts called by jenkins. May evolve into somethign more elegant such as a jenkins file.
Uses some simple logic for a best-effort attempt to compile a kernel based on what code has changed
## dependencies
* https://github.com/slimm609/monorepo-gitwatcher.git

View File

@@ -0,0 +1,23 @@
# Read build script documentation https://docs.armbian.com/Developer-Guide_Build-Options/
# for detailed explanation of these options and for additional options not listed here
KERNEL_ONLY="yes" # leave empty to select each time, set to "yes" or "no" to skip dialog prompt
KERNEL_CONFIGURE="no" # leave empty to select each time, set to "yes" or "no" to skip dialog prompt
CLEAN_LEVEL="make,debs,oldcache,sources" # comma-separated list of clean targets: "make" = make clean for selected kernel and u-boot,
# "debs" = delete packages in "./output/debs" for current branch and family,
# "alldebs" = delete all packages in "./output/debs", "images" = delete "./output/images",
# "cache" = delete "./output/cache", "sources" = delete "./sources"
# "oldcache" = remove old cached rootfs except for the newest 8 files
DEST_LANG="en_US.UTF-8" # sl_SI.UTF-8, en_US.UTF-8
# advanced
EXTERNAL_NEW="prebuilt" # compile and install or install prebuilt additional packages
INSTALL_HEADERS="" # install kernel headers package
LIB_TAG="master" # change to "branchname" to use any branch currently available.
USE_TORRENT="yes" # use torrent network for faster toolchain and cache download
DOWNLOAD_MIRROR="" # set to "china" to use mirrors.tuna.tsinghua.edu.cn
CARD_DEVICE="" # device name /dev/sdx of your SD card to burn directly to the card when done
FORCE_CHECKOUT="no"
EXPERT="yes"
BUILD_DESKTOP="no"

79
jenkins_kernel_build.sh Executable file
View File

@@ -0,0 +1,79 @@
#!/bin/bash
configure_monorepo_watcher() {
echo "config/kernel" > family.watch
echo "config/sources" >> family.watch
echo "patch/kernel" >> family.watch
echo "patch/u-boot" >> family.watch
echo "config/boards" > board.watch
echo "config/bootscripts" >> board.watch
}
generate_test_table() {
config_dir=build/config/boards
files=$(ls ${config_dir}/*.conf ${config_dir}/*.wip ${config_dir}/*.csc)
rm -f test_table.csv
for file in ${files}; do
source ${file}
board=$(basename ${file}|cut -d '.' -f1)
support_level=$(basename ${file}|cut -d'.' -f2)
echo "${BOARDFAMILY},${BOARD_NAME},${board},${support_level}" >> test_table.csv
done
}
get_files_changed() {
## these var values needed by detectGitChanges.sh
GIT_COMMIT=${GITHUB_PR_HEAD_SHA}
GIT_PREVIOUS_COMMIT=HEAD
cd build
family_changed="$(../monorepo-gitwatcher/detectGitChanges.sh ../family.watch)"
board_changed="$(../monorepo-gitwatcher/detectGitChanges.sh ../board.watch)"
}
get_build_target() {
OLDIFS=${IFS}
IFS=$'\n'
# reverse sort improves grep accuracy
for row in $(cat ../test_table.csv|sort -r); do
family=$(echo $row|cut -d',' -f1)
board=$(echo $row|cut -d',' -f3)
for family_row in ${family_changed}; do
echo "family_row: ${family_row}"
if echo $family_row | fgrep -q $family; then
ARMBIAN_BOARD=${board}
for branch in current dev legacy; do
if echo $family_row |fgrep -q $branch; then
echo "ARMBIAN_BRANCH=${branch}"
ARMBIAN_BRANCH=${branch}
fi
done
break 2
fi
done
for board_row in ${board_changed}; do
if echo $board_row | fgrep -q $board; then
ARMBIAN_BOARD=${board}
break
fi
done
done
IFS=${OLDIFS}
}
build_kernel() {
git checkout ${GIT_COMMIT}
./compile.sh CONFIG=../ci-testing-tools/config-jenkins-kernel.conf BOARD=${ARMBIAN_BOARD} BRANCH=${ARMBIAN_BRANCH}
}