/ Jenkinsfile
Jenkinsfile
 1  #!/usr/bin/env groovy
 2  library 'status-jenkins-lib@v1.8.15'
 3  
 4  pipeline {
 5    agent {
 6      docker {
 7        label 'linuxcontainer'
 8        image 'harbor.status.im/infra/ci-build-containers:linux-base-1.0.0'
 9        args '--volume=/nix:/nix ' +
10             '--volume=/etc/nix:/etc/nix ' +
11             '--user jenkins'
12      }
13    }
14  
15    options {
16      disableConcurrentBuilds()
17      /* manage how many builds we keep */
18      buildDiscarder(logRotator(
19        numToKeepStr: '20',
20        daysToKeepStr: '30',
21      ))
22    }
23  
24    environment {
25      GIT_COMMITTER_NAME = 'status-im-auto'
26      GIT_COMMITTER_EMAIL = 'auto@status.im'
27    }
28  
29    stages {
30      stage('Install') {
31        steps {
32          script {
33            nix.develop('yarn install', pure: false)
34          }
35        }
36      }
37  
38      stage('Build') {
39        steps { script {
40          nix.develop('yarn build', pure: false)
41          jenkins.genBuildMetaJSON('build/build.json')
42        } }
43      }
44  
45      stage('Publish') {
46        steps {
47          sshagent(credentials: ['status-im-auto-ssh']) {
48            script {
49              nix.develop("""
50                ghp-import \
51                  -b ${deployBranch()} \
52                  -c ${deployDomain()} \
53                  -p build
54              """, pure: false)
55            }
56          }
57        }
58      }
59  
60    }
61    post {
62      cleanup { cleanWs() }
63    }
64  }
65  
66  def isMasterBranch() { GIT_BRANCH ==~ /.*master/ }
67  def deployBranch() { isMasterBranch() ? 'deploy-master'     : 'deploy-develop' }
68  def deployDomain() { isMasterBranch() ? 'assembly.logos.co' : 'dev-assembly.logos.co' }