Till Wegmüller
2024-03-17 d49c44194f09f235241996568c344c6032bd3686
Try jenkins way to track changed files

Signed-off-by: Till Wegmüller <toasterson@gmail.com>
2 files modified
20 ■■■■ changed files
ci/user-build.groovy 18 ●●●● patch | view | raw | blame | history
tools/jenkinshelper-main.ksh 2 ●●● patch | view | raw | blame | history
ci/user-build.groovy
@@ -11,6 +11,19 @@
  return scmAction?.revision?.hash
}
@NonCPS
String getChangedFilesList() {
    changedFiles = []
    for (changeLogSet in currentBuild.changeSets) {
        for (entry in changeLogSet.getItems()) { // for each commit in the detected changes
            for (file in entry.getAffectedFiles()) {
                changedFiles.add(file.getPath()) // add changed file to list
            }
        }
    }
    return changedFiles
}
pipeline {
    agent {
        node {
@@ -43,9 +56,8 @@
            steps {
                withPublisher('openindiana.org', 'incremental') {
                    script {
                        def last_build = Jenkins.instance.getItem('OpenIndiana').getItem('Userland').lastSuccessfulBuild
                        def last_commit = commitHashForBuild(last_build)
                        var changed_files = getChangedFilesList()
                        writeFile file: 'changed_files.txt', text: changed_list.join("\n")
                    }
                    sh './tools/jenkinshelper-main.ksh -s build_changed'
                }
tools/jenkinshelper-main.ksh
@@ -57,7 +57,7 @@
stage_build_changed() {
    echo "Last successful commit $1"
    worst=0
    for f in $(git diff --name-only HEAD^1 | grep Makefile; exit 0); do
    for f in $(cat changed_files.txt | grep Makefile; exit 0); do
        echo "jenkinshelper: building for ${f%/*}..."
        curpwd=$(pwd)
        cd "${f%/*}" && COMPONENT_BUILD_ARGS=-j$(psrinfo -t -c) gmake publish