|
| 1 | +node('content') |
| 2 | +{ |
| 3 | +timestamps |
| 4 | + { |
| 5 | + timeout(time: 7200000, unit: 'MILLISECONDS') { |
| 6 | +String platform='Install'; |
| 7 | + try |
| 8 | + { |
| 9 | + |
| 10 | + def Content=""; |
| 11 | + env.PATH = "${ProgramFiles}"+"\\Git\\mingw64\\bin;${env.PATH}" |
| 12 | + |
| 13 | + //Clone scm repository in Workspace source directory |
| 14 | + stage ('Checkout') |
| 15 | + { |
| 16 | + dir('Spell-Checker') |
| 17 | + { |
| 18 | + checkout scm |
| 19 | + |
| 20 | + def branchCommit = '"' + 'https://gitlab.syncfusion.com/api/v4/projects/' + env.projectId + '/merge_requests/' + env.MergeRequestId + '/changes' |
| 21 | + String branchCommitDetails = bat returnStdout: true, script: 'curl -s --request GET --header PRIVATE-TOKEN:' + env.BuildAutomation_PrivateToken + " " + branchCommit |
| 22 | + |
| 23 | + def ChangeFiles= branchCommitDetails.split('\n')[2]; |
| 24 | + ChangeFiles = ChangeFiles.split('"new_path":') |
| 25 | + |
| 26 | + for (int i= 1; i < ChangeFiles.size();i++) |
| 27 | + { |
| 28 | + def ChangeFile= ChangeFiles[i].split(',')[0].replace('"', '') |
| 29 | + Content += env.WORKSPACE + "\\Spell-Checker\\" + ChangeFile + "\r\n"; |
| 30 | + } |
| 31 | + |
| 32 | + if (Content) { |
| 33 | + writeFile file: env.WORKSPACE+"/cireports/content.txt", text: Content |
| 34 | + } |
| 35 | + else { |
| 36 | + writeFile file: env.WORKSPACE+"/cireports/content.txt", text: "There are no filepaths found for this commit." |
| 37 | + } |
| 38 | + |
| 39 | + } |
| 40 | + |
| 41 | + //Checkout the ug_spellchecker from development Source |
| 42 | + checkout([$class: 'GitSCM', branches: [[name: '*/development']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'ug_spellchecker']], submoduleCfg: [], userRemoteConfigs: [[credentialsId: env.gitlabCredentialId, url: 'https://gitlab.syncfusion.com/content/ug_spellchecker.git']]]) |
| 43 | + |
| 44 | + } |
| 45 | + } |
| 46 | + |
| 47 | + catch(Exception e) |
| 48 | + { |
| 49 | + currentBuild.result = 'FAILURE' |
| 50 | + } |
| 51 | + |
| 52 | +if(currentBuild.result != 'FAILURE') |
| 53 | +{ |
| 54 | + stage 'Build Source' |
| 55 | + try |
| 56 | + { |
| 57 | + gitlabCommitStatus("Build") |
| 58 | + { |
| 59 | + 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.gitlabTargetBranch+" -Branch "+'"'+env.gitlabSourceBranch+'"' |
| 60 | + } |
| 61 | + |
| 62 | + def files = findFiles(glob: '**/cireports/errorlogs/*.txt') |
| 63 | + |
| 64 | + if(files.size() > 0) |
| 65 | + { |
| 66 | + currentBuild.result = 'FAILURE' |
| 67 | + } |
| 68 | + } |
| 69 | + catch(Exception e) |
| 70 | + { |
| 71 | + currentBuild.result = 'FAILURE' |
| 72 | + } |
| 73 | +} |
| 74 | + |
| 75 | + stage 'Delete Workspace' |
| 76 | + |
| 77 | + def files = findFiles(glob: '**/cireports/spellcheck/*.*') |
| 78 | + |
| 79 | + if(files.size() > 0) |
| 80 | + { |
| 81 | + archiveArtifacts artifacts: 'cireports/', excludes: null |
| 82 | + } |
| 83 | + step([$class: 'WsCleanup']) } |
| 84 | + } |
| 85 | +} |
0 commit comments