Commit 323accb4 authored by Diego Giovane Pasqualin's avatar Diego Giovane Pasqualin
Browse files

jenkins_continuous_integration.sh: Ignore commits made by jenkins


Signed-off-by: default avatarDiego Giovane Pasqualin <dpasqualin@c3sl.ufpr.br>
parent 784b0401
......@@ -34,6 +34,7 @@ REPOROOT="$PREFIX/.."
REPOCONFIGFILE="$REPOROOT/.git/config"
PUBLISHSCRIPT="$PREFIX/le-publish.sh"
PACKAGESDEST="$REPOROOT/pkgs"
JENKINSUSER="Jenkins <jenkins@c3sl.ufpr.br>"
# List of files/directories inside this repository that do not represent a
# module.
......@@ -48,17 +49,35 @@ function prepare() {
fi
}
# Check whether a git revision was made by jenkins.
# Return true if it was, false otherwise
function madeByJenkins() {
local rev=$1
git cat-file commit $rev | grep -q "author $JENKINSUSER"
return $?
}
# Return all packages that have changed since the last build.
function getChangedPackages() {
local allFiles=""
local allRevs=""
local pkgs=""
# Get all changed files
allFiles=$(git diff --name-only ${GIT_PREVIOUS_COMMIT}..${GIT_COMMIT}|
cut -d/ -f1 | sort | uniq)
# Get all revisions since last run
allRevs=$(git rev-list --reverse ${GIT_PREVIOUS_COMMIT}..${GIT_COMMIT})
lastRev=${GIT_PREVIOUS_COMMIT}
for rev in $allRevs; do
# Ignore changes made by jenkins
if ! madeByJenkins $rev; then
allFiles="$allFiles $(git diff --name-only ${lastRev}..${rev} |
cut -d/ -f1)"
fi
lastRev=$rev
done
# Filter only the ones that represents valid packages
for file in $allFiles; do
for file in $(echo $allFiles | sed 's/ /\n/g' | sort -u); do
if test -d "$REPOROOT/$file" && ! echo $DONTGENERATE | grep -q "\<$file\>"; then
pkgs="$pkgs $file"
fi
......@@ -217,6 +236,7 @@ if $COMMIT; then
fi
repository="le5-$(getCurrentRepository)"
for pkg in $(getChangedPackages); do
# Generate Package
# TODO: allow user to change minor and major too
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment