/ Jenkinsfile
Jenkinsfile
 1  def gh_branch = 'master'
 2  def gh_repo = 'github.com/status-im/analytics.status.im.git'
 3  def gh_user = 'status-im-auto'
 4  def gh_email = 'auto@status.im'
 5  
 6  node('linux') {
 7    stage('Git Prep') {
 8      checkout scm
 9      dir('analytics') {
10        git(url: "https://${gh_repo}")
11      }
12      sh "git config user.name ${gh_user}"
13      sh "git config user.email ${gh_email}"
14      sh "git config --global push.default simple"
15      /* Install Python3 requirements */
16      sh 'pip3 install --user -r requirements.txt'
17    }
18  
19    stage('Gen AppFigures Stats') {
20      withCredentials([
21        string(credentialsId: 'appfigures-key',       variable: 'CLIENT_KEY'),
22        string(credentialsId: 'appfigures-header',    variable: 'AUTH_HEADER'),
23      ]) {
24        sh './appfigures.py analytics'
25      }
26    }
27  
28    stage('Gen Whisper Stats') {
29      sh './prometheus.py analytics'
30    }
31  
32    stage('Push Changes') {
33      withCredentials([
34        string(credentialsId: 'jenkins-github-token', variable: 'GH_TOKEN'),
35      ]) {
36        def gh_url = "https://${gh_user}:${env.GH_TOKEN}@${gh_repo}"
37        dir('analytics') {
38          sh 'git commit -m "update analytics-dash images" .'
39          sh "git push ${gh_url} ${gh_branch}"
40        }
41      }
42    }
43  }