@Library(['ru.sbrf.devsecops@master', 'shared-library-lbf@master', "DPMPipelineUtils@1.4"]) _

List prjList = []
def gitSshUrl = "ssh://<PRESIDIO_ANONYMIZED_EMAIL_ADDRESS>:7999/collective_decision/decision-ufs-ui-monorepo.git"
def mvnSecret = "maven_settings"
def mvnParams = "clean install -U -Dmaven.repo.local=./ "
def jdkVersion = "openjdk-17"

def runTests(){
   def changedFiles = sh(script: "git diff --name-only origin/${env.CHANGE_TARGET}...${env.BRANCH_NAME}", returnStdout: true)
        .trim()
        .split('\n')
        .findAll { it.endsWith('.ts') || it.endsWith('.tsx') }

          println(env.CHANGE_TARGET)
          println(env.BRANCH_NAME)

    // Если есть изменённые файлы, запускаем тесты
    if (changedFiles) {
        def testFiles = changedFiles.join(' ')
        sh "yarn test ${testFiles}"
    } else {
        // Если нет изменённых файлов, можем выполнять полный запуск тестов
        sh "yarn test"
    }
}

node ('rhel8') {

    if (env.CHANGE_ID) {
        println("[*]PR event")

        stage('Init') {
            cleanWs()
            checkout scm
        }

        stage('Run sonarqube scan') {
            withCredentials([usernamePassword(credentialsId: 'CAB-SA-DVO06209-WITH-DOMAIN', passwordVariable: 'CRED_PASSWORD3', usernameVariable: 'CRED_USERNAME3')]) {
                withCredentials([usernamePassword(credentialsId: 'CAB-SA-DVO06209', passwordVariable: 'CRED_PASSWORD', usernameVariable: 'CRED_USERNAME')]) {
                    withMaven(jdk: 'openjdk-17', maven: 'Maven 3.9', mavenSettingsConfig: 'nexus3-settings') {
                        withCredentials([string(credentialsId: 'sonar_token_efsdf', variable: 'token')]) {
                          sh "ls -la"
                          sh "mvn -X -U clean verify sonar:sonar -Dsonar.projectKey=EFSDF -Dsonar.sources=. -Dsonar.host.url=https://sonar.delta.sbrf.ru/sonar -Dsonar.branch.name=${env.BRANCH_NAME} -Dsonar.login=${token}"
                        }
                    }
                }
            }
        }

        stage('Build') {
            tool 'yarn-1.22'
            nodejs(configId: '902bb004-940a-464c-8165-374839ac4b2f', nodeJSInstallationName: 'node-v18.18.2-linux-x64') {
            sh '''
                agent_root_dir="$HOME/agent"
                export PATH_YARN="tools/com.cloudbees.jenkins.plugins.customtools.CustomTool/yarn-1.22/yarn-v1.22.17/bin"
                export PATH="$AGENT_WORKDIR/$PATH_YARN:$HOME/$PATH_YARN:$agent_root_dir/$PATH_YARN:$PATH"
                export NODE_OPTIONS=--max_old_space_size=4096
            '''

            runTests()

            sh '''
                yarn --ignore-platform
                yarn lint
                yarn typecheck
                yarn workspace @efsdf-ui/module.kod build
                # yarn workspace @efsdf-ui/module.covenants build
            '''
           }
        }
    }
    else {

        properties([pipelineTriggers([pollSCM('0 1 * * *')])])
        stage('Init') {
            cleanWs()
            checkout scm
        }

        stage('Build') {
            tool 'yarn-1.22'
            nodejs(configId: '902bb004-940a-464c-8165-374839ac4b2f', nodeJSInstallationName: 'node-v18.18.2-linux-x64') {
            sh '''
                agent_root_dir="$HOME/agent"
                export PATH_YARN="tools/com.cloudbees.jenkins.plugins.customtools.CustomTool/yarn-1.22/yarn-v1.22.17/bin"
                export PATH="$AGENT_WORKDIR/$PATH_YARN:$HOME/$PATH_YARN:$agent_root_dir/$PATH_YARN:$PATH"
                export NODE_OPTIONS=--max_old_space_size=4096
            '''

            runTests()

            sh '''
                yarn --ignore-platform
                yarn lint
                yarn typecheck
                yarn workspace @efsdf-ui/module.kod build
                # yarn workspace @efsdf-ui/module.covenants build
            '''
           }
        }

        configFileProvider([configFile(fileId: '620428fd-643c-437e-a076-77f8bd3f278f', variable: 'MAVEN_SETTINGS')]) {
            sh "cp \"${MAVEN_SETTINGS}\" devsecops-config.yml"
        }
        config = readYaml(file: 'devsecops-config.yml')

        stage('SAST') {
            runSastCx(config, gitSshUrl, env.CHANGE_TARGET, env.CHANGE_TARGET)
        }
        stage('Run OSS') {
            def ossQG = runOSS(config, gitSshUrl, env.CHANGE_TARGET, env.CHANGE_TARGET)
        }
    }
}
+ git diff --name-only origin/release/64.0...PR-1812
fatal: ambiguous argument 'origin/release/64.0...PR-1812': unknown revision or path not in the working tree. помоги