Skip to content

Commit ea2a1f8

Browse files
committed
chore(build): Adding build timeout
1 parent 5ffdab6 commit ea2a1f8

File tree

1 file changed

+31
-29
lines changed

1 file changed

+31
-29
lines changed

Jenkinsfile

+31-29
Original file line numberDiff line numberDiff line change
@@ -3,40 +3,42 @@ properties properties: [
33
[$class: 'GithubProjectProperty', displayName: '', projectUrlStr: 'https://github.com/NathanWalker/nativescript-ngx-fonticon'],
44
]
55

6-
node('nativescript') {
7-
def buildNumber = env.BUILD_NUMBER
8-
def branchName = env.BRANCH_NAME
9-
def workspace = env.WORKSPACE
10-
def buildUrl = env.BUILD_URL
6+
timeout(60) {
7+
node('nativescript') {
8+
def buildNumber = env.BUILD_NUMBER
9+
def branchName = env.BRANCH_NAME
10+
def workspace = env.WORKSPACE
11+
def buildUrl = env.BUILD_URL
1112

12-
// PRINT ENVIRONMENT TO JOB
13-
echo "workspace directory is $workspace"
14-
echo "build URL is $buildUrl"
15-
echo "build Number is $buildNumber"
16-
echo "branch name is $branchName"
17-
echo "PATH is $env.PATH"
13+
// PRINT ENVIRONMENT TO JOB
14+
echo "workspace directory is $workspace"
15+
echo "build URL is $buildUrl"
16+
echo "build Number is $buildNumber"
17+
echo "branch name is $branchName"
18+
echo "PATH is $env.PATH"
1819

19-
try {
20-
stage('Checkout') {
21-
checkout scm
22-
}
20+
try {
21+
stage('Checkout') {
22+
checkout scm
23+
}
2324

24-
stage('Build') {
25-
sh "npm run clean && npm run build"
26-
}
25+
stage('Build') {
26+
sh "npm run clean && npm run build"
27+
}
2728

28-
stage('Test') {
29-
sh "cd src && npm i .. && tns build android && tns build ios"
30-
}
29+
stage('Test') {
30+
sh "cd src && npm i .. && tns build android && tns build ios"
31+
}
3132

32-
stage('Publish NPM snapshot') {
33-
def currentVersion = sh(returnStdout: true, script: "npm version | grep \"{\" | tr -s ':' | cut -d \"'\" -f 4").trim()
34-
def newVersion = "${currentVersion}-${branchName}-${buildNumber}"
35-
sh "npm version ${newVersion} --no-git-tag-version && npm publish --tag next"
36-
}
33+
stage('Publish NPM snapshot') {
34+
def currentVersion = sh(returnStdout: true, script: "npm version | grep \"{\" | tr -s ':' | cut -d \"'\" -f 4").trim()
35+
def newVersion = "${currentVersion}-${branchName}-${buildNumber}"
36+
sh "npm version ${newVersion} --no-git-tag-version && npm publish --tag next"
37+
}
3738

38-
} catch (e) {
39-
mail subject: "${env.JOB_NAME} (${env.BUILD_NUMBER}): Error on build", to: '[email protected]', body: "Please go to ${env.BUILD_URL}."
40-
throw e
39+
} catch (e) {
40+
mail subject: "${env.JOB_NAME} (${env.BUILD_NUMBER}): Error on build", to: '[email protected]', body: "Please go to ${env.BUILD_URL}."
41+
throw e
42+
}
4143
}
4244
}

0 commit comments

Comments
 (0)