Jenkinsfile 3.56 KB
Newer Older
Boris Baldassari's avatar
Boris Baldassari committed
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
86
87
88
89
90
91
92
93
94
95
96
97
pipeline {
  agent any
  environment {
    RSYNC_PASSWD = credentials('rsync_passwd')
  }
  options {
    buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: '5'))
  }
  stages {
    stage('Build AERI') {
      steps {
        sh '''
          wget https://castalia.camp/dl/datasets/incidents_bundles_extract.csv.bz2 -O website/content/aeri_stacktraces/incidents_bundles_extract.csv.bz2
          wget https://castalia.camp/dl/datasets/incidents_extract.csv.bz2 -O website/content/aeri_stacktraces/incidents_extract.csv.bz2
          wget https://castalia.camp/dl/datasets/incidents_full.tar.bz2 -O website/content/aeri_stacktraces/incidents_full.tar.bz2
          wget https://castalia.camp/dl/datasets/problems_extract.csv.bz2 -O website/content/aeri_stacktraces/problems_extract.csv.bz2
          wget https://castalia.camp/dl/datasets/problems_full.tar.bz2 -O website/content/aeri_stacktraces/problems_full.tar.bz2
        ''' 
      }
    }
    stage('Build mboxes') {
      steps {
        sh '''
          rm /data/eclipse_mls/*.mbox.lock || echo "No mbox lock found."
          rsync -avlp -e ssh --rsh="/usr/bin/sshpass -p ${SYS_RSYNC_PASSWD} ssh -o StrictHostKeyChecking=no -l bbaldassari2kd" build.eclipse.org:/opt/public/download-staging.priv/scava/ /data/eclipse_mls/ || echo "Rsync had issues. But the show must go on, right?"
          chmod 777 /data/eclipse_mls/*
          source ~/perl5/perlbrew/etc/bashrc 
          perlbrew switch perl-5.30.1
          perl -v 
          Rscript --version
          cd scripts/ && sh ./process_mboxes.sh
          ls /data/eclipse_mls/ > ../website/content/eclipse_mls/list_mboxes.txt
          cp /data/eclipse_mls_full.csv ../website/content/eclipse_mls/
        ''' 
      }
    }
    stage('Build projects') {
      steps {
        sh '''
          pwd
          ls
          source ~/perl5/perlbrew/etc/bashrc 
          perlbrew switch perl-5.30.1
          perl -v 
          Rscript --version
          cd scripts/ && sh ./process_all_projects.sh
        ''' 
      }
    }
    stage('Build website') {
      steps {
        sh '''
          pwd
          ls
          source ~/perl5/perlbrew/etc/bashrc 
          Rscript --version
          echo "Building website."
          cd scripts/ && sh ./build_website.sh
          echo "Cleaning website zone from non-compressed files."
          find ../website/public/ -name "*.csv" -print0 | xargs rm -rf 
          find ../website/public/ -name "git*.txt" -print0 | xargs rm -rf 
          echo "Creating download area."
          rsync -rv --exclude-from=../scripts/rsync_exclude.txt ../website/public/ ../download/
          echo "Cleaning website zone from compressed files."
          find ../website/public/ \( -name "*.gz" -or -name "*.xz" -or -name "*.bz2" \) | xargs rm -rf 
        ''' 
      }
    }
    stage('Deploy Downloads') {
      steps {
        sh '''
          rsync -avz download/ bbaldassari2kd@projects-storage.eclipse.org:/home/data/httpd/download.eclipse.org/dataeggs/ --delete || echo "Error $?: some files/attrs were not transferred (see previous errors)"
        ''' 
      }
    }
    stage('Deploy Website') {
      steps {
        sh '''
          DATE=$(date +"%Y-%m-%d %T")
          git init 
          git remote add origin git@gitlab.eclipse.org:eclipse/dataeggs/dataeggs.git
          git add . 
          git commit -m "Publish web site $DATE."
          git push -u origin main
          
        ''' 
      }
    }
    stage('Archiving') {
      steps {
        archiveArtifacts artifacts: 'website/public/**/*.*', fingerprint: true 
        cleanWs()
      }
    }
  }
}