From 970b793419275afdcfeb2f5ea153af6e5b951de3 Mon Sep 17 00:00:00 2001 From: SaiyathAliFathima <103025761+SaiyathAliFathima@users.noreply.github.com> Date: Tue, 11 Aug 2026 18:40:50 +0530 Subject: [PATCH] Update Jenkinsfile --- Jenkinsfile | 172 +++++++++++++++++++++++++--------------------------- 1 file changed, 84 insertions(+), 88 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 950546cf0..fbfd1f882 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,98 +1,94 @@ node('content') -{ -timestamps - { - - def Content=""; +{ + timestamps + { + def Content=""; env.PATH = "${ProgramFiles}"+"\\Git\\mingw64\\bin;${env.PATH}" - timeout(time: 7200000, unit: 'MILLISECONDS') { -String platform='chart-sdk'; - try - { - //Clone scm repository in Workspace source directory - stage ('Checkout') - { - dir('Spell-Checker') - { - checkout scm - + timeout(time: 7200000, unit: 'MILLISECONDS') { + String platform='chart-sdk'; + try + { + //Clone scm repository in Workspace source directory + stage ('Checkout') + { + dir('Spell-Checker') + { + checkout scm - def page = 1 - while(true) - { - def branchCommit = 'https://api.github.com/repos/syncfusion-content/'+env.githubSourceRepoHttpUrl.split('/')[env.githubSourceRepoHttpUrl.split('/').size() - 1]+'/pulls/' + env.pullRequestId + '/files?per_page=100^&page='+ page - String branchCommitDetails = bat returnStdout: true, script: 'curl -H "Accept: application/vnd.github.v3+json" -u SyncfusionBuild:' + env.GithubBuildAutomation_PrivateToken + " " + branchCommit + def page = 1 + while(true) + { + def branchCommit = 'https://api.github.com/repos/syncfusion-content/'+env.githubSourceRepoHttpUrl.split('/')[env.githubSourceRepoHttpUrl.split('/').size() - 1]+'/pulls/' + env.pullRequestId + '/files?per_page=100^&page='+ page + String branchCommitDetails = bat returnStdout: true, script: 'curl -H "Accept: application/vnd.github.v3+json" -u SyncfusionBuild:' + env.GithubBuildAutomation_PrivateToken + " " + branchCommit - def ChangeFiles= branchCommitDetails.split('"filename": '); + def ChangeFiles= branchCommitDetails.split('"filename": '); - for (int i= 1; i < ChangeFiles.size();i++) - { - def ChangeFile= ChangeFiles[i].split(',')[0].replace('"', '') - Content += env.WORKSPACE + "\\Spell-Checker\\" + ChangeFile + "\r\n"; - } + for (int i= 1; i < ChangeFiles.size();i++) + { + def ChangeFile= ChangeFiles[i].split(',')[0].replace('"', '') + Content += env.WORKSPACE + "\\Spell-Checker\\" + ChangeFile + "\r\n"; + } - // Last page - if((ChangeFiles.size() - 1) < 100) - { - break - } - page++ - } - - if (Content) { - writeFile file: env.WORKSPACE+"/cireports/content.txt", text: Content - } - else { - writeFile file: env.WORKSPACE+"/cireports/content.txt", text: "There are no filepaths found for this commit." - } - - } - - //Checkout the ug_spellchecker from development Source - checkout([$class: 'GitSCM', branches: [[name: '*/development']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'ug_spellchecker']], submoduleCfg: [], userRemoteConfigs: [[credentialsId: env.githubCredentialId, url: 'https://github.com/syncfusion-content/ug_spellchecker.git']]]) - - } - - } - - catch(Exception e) - { - currentBuild.result = 'FAILURE' - } + // Last page + if((ChangeFiles.size() - 1) < 100) + { + break + } + page++ + } -if(currentBuild.result != 'FAILURE') -{ - stage 'Build Source' - try - { - gitlabCommitStatus("Build") - { - bat 'powershell.exe -ExecutionPolicy ByPass -File '+env.WORKSPACE+"/ug_spellchecker/build.ps1 -Script "+env.WORKSPACE+"/ug_spellchecker/build.cake -Target build -Platform \""+platform+"\" -Targetbranch "+env.githubTargetBranch+" -Branch "+'"'+env.githubSourceBranch+'"' - } - - def files = findFiles(glob: '**/cireports/errorlogs/*.txt') - - if(files.size() > 0) - { - currentBuild.result = 'FAILURE' - } - - } - catch(Exception e) - { - currentBuild.result = 'FAILURE' - } -} + if (Content) { + writeFile file: env.WORKSPACE+"/cireports/content.txt", text: Content + } + else { + writeFile file: env.WORKSPACE+"/cireports/content.txt", text: "There are no filepaths found for this commit." + } + } + } + + //Checkout the ug_spellchecker from development Source + checkout([$class: 'GitSCM', branches: [[name: '*/development']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'ug_spellchecker']], submoduleCfg: [], userRemoteConfigs: [[credentialsId: env.githubCredentialId, url: 'https://github.com/syncfusion-content/ug_spellchecker.git']]]) + } + + catch(Exception e) + { + currentBuild.result = 'FAILURE' + } + + if(currentBuild.result != 'FAILURE') + { + stage 'Build Source' + try + { + gitlabCommitStatus("Build") + { + bat 'powershell.exe -ExecutionPolicy ByPass -File '+env.WORKSPACE+"/ug_spellchecker/build.ps1 -Script "+env.WORKSPACE+"/ug_spellchecker/build.cake -Target build -Platform \""+platform+"\" -Targetbranch "+env.githubTargetBranch+" -Branch "+'"'+env.githubSourceBranch+'"' + } - stage 'Delete Workspace' - - def files = findFiles(glob: '**/cireports/*.*') - - if(files.size() > 0) - { - archiveArtifacts artifacts: 'cireports/', excludes: null - } - step([$class: 'WsCleanup']) } - } + def files = findFiles(glob: '**/cireports/errorlogs/*.txt') + + if(files.size() > 0) + { + currentBuild.result = 'FAILURE' + } + + } + catch(Exception e) + { + currentBuild.result = 'FAILURE' + } + } + + stage 'Delete Workspace' + + def files = findFiles(glob: '**/cireports/*.*') + + if(files.size() > 0) + { + archiveArtifacts artifacts: 'cireports/', excludes: null + } + step([$class: 'WsCleanup']) + } + } }