Andreas Wacknitz
2024-03-31 97a780a15002cc79b83dca6ceb54a7411df3f799
ci/user-build.groovy
@@ -2,6 +2,28 @@
@Library("BuildLib") _
/**
 * Gets the commit hash from a Jenkins build object, if any
 */
@NonCPS
def commitHashForBuild( build ) {
  def scmAction = build?.actions.find { action -> action instanceof jenkins.scm.api.SCMRevisionAction }
  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 {
@@ -34,21 +56,16 @@
            steps {
                withPublisher('openindiana.org', 'incremental') {
                    script {
                        def last_commit = Jenkins.instance.getItem('OpenIndiana/Userland').lastSuccessfulBuild.changeset[0].revision
                        writeFile file: 'changed_files.txt', text: getChangedFilesList().join("\n")
                    }
                    sh './tools/jenkinshelper-main.ksh -s build_changed $last_commit'
                    sh './tools/jenkinshelper-main.ksh -s build_changed'
                }
            }
        }
        stage('copy packages') {
            steps {
                pkgcopy()
            }
        }
        stage('update system') {
            steps {
                update()
                sh /opt/local/bin/cleanup_bootenvs.sh'
                sh '/opt/local/bin/cleanup_bootenvs.sh'
            }
        }
    }