-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathJenkinsfile
65 lines (62 loc) · 2.41 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
@Library('MesSharedLibrary@master')
import aws.dvsa.mes.Globals
import aws.dvsa.mes.CommonFunctions
import aws.dvsa.mes.GitFunctions
import aws.dvsa.mes.MobileFunctions
import aws.dvsa.mes.NVMFunctions
//------------------------------------------
def Globals = new Globals()
def CommonFunctions = new CommonFunctions()
def GitFunctions = new GitFunctions()
def MobileFunctions = new MobileFunctions()
def NVMFunctions = new NVMFunctions()
String branch_name = "${env.BRANCH_NAME}"
String ionic_app_id = Globals.MOBILE_APP_ID
String nodejs_installation = Globals.MOBILE_NODE_JS
String mobile_config_branch = "master"
//----------------------------------------------------
node (Globals.NONPROD_BUILDER_TAG) {
currentBuild.description = "BRANCH: ${branch_name}"
// clear workspace
deleteDir()
// declare workspace
env.WSPACE = pwd()
// wrappers
timestamps {
ansiColor("xterm") {
wrap([$class: "BuildUser"]) {
stage("checkout") {
CommonFunctions.log("info", "STAGE: Checkout")
GitFunctions.git_check_out(Globals.MOBILE_REPO, branch_name, Globals.MOBILE_NAME, Globals.GITHUB_MOBILE_CREDS, false, false)
}
stage("install dependencies") {
CommonFunctions.log("info", "STAGE: Install Dependencies")
dir(Globals.MOBILE_NAME) {
NVMFunctions.run(" -c 'npm install'")
}
}
stage("tests") {
CommonFunctions.log("info", "STAGE: Tests")
dir(Globals.MOBILE_NAME) {
NVMFunctions.run(" -c 'npm test'")
}
}
stage("build") {
if(branch_name == "develop" || branch_name == "origin/develop"){
CommonFunctions.log("info", "STAGE: Build")
// install ionic
MobileFunctions.ionic_cli_install(nodejs_installation)
// get current commit hash of the ios_app branch
String commit_hash = GitFunctions.git_get_commit_hash(Globals.MOBILE_NAME)
// build
dir(Globals.MOBILE_NAME) {
MobileFunctions.ionic_pro_push(nodejs_installation, Globals.MOBILE_DEPLOYER_KEY, branch_name, commit_hash, ionic_app_id)
}
CommonFunctions.log("info", "It takes a couple of minutes to build and publish the app to the IonicPro service.")
}
// IONIC APP info for Ionic View
CommonFunctions.shout(ionic_app_id, "35m", Globals.MOBILE_NAME.toUpperCase()+" ID", 26)
}}}} //ansiColor //BuildUser //timestamps
// clear workspace
deleteDir()
}