-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
85 lines (68 loc) · 2.7 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
node('content')
{
timestamps
{
timeout(time: 7200000, unit: 'MILLISECONDS') {
String platform='php';
try
{
def Content="";
env.PATH = "${ProgramFiles}"+"\\Git\\mingw64\\bin;${env.PATH}"
//Clone scm repository in Workspace source directory
stage ('Checkout')
{
dir('Spell-Checker')
{
checkout scm
def branchCommit = 'https://api.github.com/repos/syncfusion-content/'+env.githubSourceRepoHttpUrl.split('/')[env.githubSourceRepoHttpUrl.split('/').size() - 1]+'/pulls/' + env.pullRequestId + '/files'
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": ');
for (int i= 1; i < ChangeFiles.size();i++)
{
def ChangeFile= ChangeFiles[i].split(',')[0].replace('"', '')
Content += env.WORKSPACE + "\\Spell-Checker\\" + ChangeFile + "\r\n";
}
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+'"'
}
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']) }
}
}