Jenkinsfile 5.41 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
/*******************************************************************************
 * Copyright (c) 2021 in-tech GmbH
 *
 * This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License 2.0
 * which is available at https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *******************************************************************************/

11
pipeline {
12
13
14
  agent none
  options {
    checkoutToSubdirectory('repo')
Frederic Gurr's avatar
Frederic Gurr committed
15
    timeout(time: 5, unit: 'HOURS')
16
17
18
19
  }
  stages {
    stage('Linux and Windows build') {
      parallel {
Reinhard Biegel's avatar
Reinhard Biegel committed
20
        stage('Linux') {
21
22
23
24
          agent {
            kubernetes {
              label 'openpass-agent-pod-' + env.BUILD_NUMBER
              yaml """
25
26
27
28
29
30
31
32
33
apiVersion: v1
kind: Pod
spec:
  containers:
  - name: openpass-build
    image: rbiegel/openpass-build:latest
    tty: true
    resources:
      limits:
34
35
        memory: "16Gi"
        cpu: "4"
36
      requests:
37
38
        memory: "16Gi"
        cpu: "4"
39
  - name: jnlp
40
41
42
43
44
45
46
    volumeMounts:
    - name: volume-known-hosts
      mountPath: /home/jenkins/.ssh
  volumes:
  - name: volume-known-hosts
    configMap:
      name: known-hosts
47
"""
48
49
            }
          }
50
          environment {
51
            CONAN_USER_HOME = '/home/jenkins/agent/workspace'
52
          }
53
          stages {
Reinhard Biegel's avatar
Reinhard Biegel committed
54
            stage('Linux: Cleanup and prepare dependencies') {
55
56
57
58
59
60
              steps {
                container('openpass-build') {
                  sh 'bash repo/utils/ci/scripts/build_prepare.sh'
                }
              }
            }
Reinhard Biegel's avatar
Reinhard Biegel committed
61
            stage('Linux: Build core and run end-to-end tests') {
62
63
64
65
66
67
              steps {
                container('openpass-build') {
                  sh 'bash repo/utils/ci/scripts/build_core_and_e2e.sh'
                }
              }
            }
Reinhard Biegel's avatar
Reinhard Biegel committed
68
            stage('Linux: Build and run unit tests') {
69
70
71
72
73
74
              steps {
                container('openpass-build') {
                  sh 'bash repo/utils/ci/scripts/build_unittests.sh'
                }
              }
            }
Reinhard Biegel's avatar
Reinhard Biegel committed
75
            stage('Linux: Deploy') {
76
77
78
79
80
81
              when {
                anyOf {
                  tag pattern: "openPASS_.*", comparator: "REGEXP"
                  triggeredBy 'TimerTrigger'
                }
              }
82
83
84
85
86
              steps {
                container('jnlp') {
                  sshagent ( ['projects-storage.eclipse.org-bot-ssh']) {
                    sh '''
                      ssh -o BatchMode=yes genie.simopenpass@projects-storage.eclipse.org mkdir -p /home/data/httpd/download.eclipse.org/simopenpass/snapshots
87
                      [ -f artifacts/openPASS_SIM.tar.gz ] && scp -o BatchMode=yes artifacts/openPASS_SIM.tar.gz "genie.simopenpass@projects-storage.eclipse.org:/home/data/httpd/download.eclipse.org/simopenpass/snapshots/openPASS_SIM_$(date -u +%Y%m%d_%H%M%S).tar.gz"
88
89
90
91
92
93
94
95
                    '''
                  }
                }
              }
            }
          }
          post {
            always {
96
              archiveArtifacts allowEmptyArchive: true, artifacts: 'artifacts/**,dist/opSim/testreport/**', followSymlinks: false
97
98
99
              junit allowEmptyResults: true, testResults: 'build/**/*Tests.xml,repo/sim/tests/endToEndTests/pyOpenPASS/result_*.xml'
            }
          }
100
        }
Reinhard Biegel's avatar
Reinhard Biegel committed
101
        stage('Windows') {
102
103
104
105
106
107
          agent {
            label 'windows'
          }
          environment {
            MSYSTEM = 'MINGW64'
            CHERE_INVOKING = 'yes'
108
            PYTHON_WINDOWS_EXE = 'C:/Program Files/Python39/python.exe'
109
110
          }
          stages {
Reinhard Biegel's avatar
Reinhard Biegel committed
111
            stage('Windows: Cleanup and prepare dependencies') {
112
              steps {
113
114
115
116
                bat 'subst W: %WORKSPACE%'
                dir('W:/') {
                  bat 'C:\\msys64\\usr\\bin\\bash -lc repo/utils/ci/scripts/build_prepare.sh'
                }
117
118
              }
            }
Reinhard Biegel's avatar
Reinhard Biegel committed
119
            stage('Windows: Build core and run end-to-end tests') {
120
              steps {
121
122
123
                dir('W:/') {
                  bat 'C:\\msys64\\usr\\bin\\bash -lc repo/utils/ci/scripts/build_core_and_e2e.sh'
                }
124
125
              }
            }
Reinhard Biegel's avatar
Reinhard Biegel committed
126
            stage('Windows: Build and run unit tests') {
127
              steps {
128
129
130
                dir('W:/') {
                  bat 'C:\\msys64\\usr\\bin\\bash -lc repo/utils/ci/scripts/build_unittests.sh'
                }
131
132
              }
            }
Reinhard Biegel's avatar
Reinhard Biegel committed
133
            stage('Windows: Deploy') {
134
135
136
              steps {
                sshagent ( ['projects-storage.eclipse.org-bot-ssh']) {
                  bat '''
Reinhard Biegel's avatar
Reinhard Biegel committed
137
                    C:\\msys64\\usr\\bin\\bash -lc 'ssh -o BatchMode=yes genie.simopenpass@projects-storage.eclipse.org mkdir -p /home/data/httpd/download.eclipse.org/simopenpass/snapshots'
138
                    C:\\msys64\\usr\\bin\\bash -lc '[ -f artifacts/openPASS_SIM.zip ] && scp -o BatchMode=yes artifacts/openPASS_SIM.zip "genie.simopenpass@projects-storage.eclipse.org:/home/data/httpd/download.eclipse.org/simopenpass/snapshots/openPASS_SIM_$(date -u +%%Y%%m%%d_%%H%%M%%S).zip"'
139
140
141
142
143
144
145
                    '''
                }
              }
            }
          }
          post {
            always {
146
              bat 'subst W: /d'
147
              archiveArtifacts allowEmptyArchive: true, artifacts: 'artifacts/**,dist/opSim/testreport/**', followSymlinks: false
148
149
              junit allowEmptyResults: true, testResults: 'build/**/*Tests.xml,repo/sim/tests/endToEndTests/pyOpenPASS/result_*.xml'
            }
150
151
          }
        }
152
153
      }
    }
154
155
  }
}