| pipeline { |
| agent { |
| kubernetes { |
| label 'basyx-' + env.BRANCH_NAME + '-' + env.BUILD_NUMBER |
| yaml """ |
| apiVersion: v1 |
| kind: Pod |
| spec: |
| containers: |
| - name: postgresql |
| image: postgres:latest |
| resources: |
| requests: |
| memory: "2Gi" |
| cpu: "0.5" |
| limits: |
| memory: "2Gi" |
| cpu: "0.5" |
| command: |
| - cat |
| tty: true |
| env: |
| - name: POSTGRES_PASSWORD |
| value: admin |
| - name: PGDATA |
| value: /run/postgresql/data |
| - name: java |
| image: maven:3.6-jdk-8 |
| resources: |
| requests: |
| memory: "3Gi" |
| cpu: "0.75" |
| limits: |
| memory: "3Gi" |
| cpu: "0.75" |
| command: |
| - cat |
| tty: true |
| env: |
| - name: MAVEN_CONFIG |
| value: /home/jenkins/agent/.m2 |
| - name: cpp |
| image: iesetps/basyx-ci-cpp:latest |
| resources: |
| requests: |
| memory: "3Gi" |
| cpu: "0.75" |
| limits: |
| memory: "3Gi" |
| cpu: "0.75" |
| command: |
| - cat |
| tty: true |
| """ |
| } |
| } |
| stages { |
| stage('Setup PostgreSQL') { |
| steps { |
| container('postgresql') { |
| sh ''' |
| chmod +x ./ci/init_postgres.sh |
| ./ci/init_postgres.sh postgres |
| pg_ctl start |
| ''' |
| } |
| } |
| } |
| stage('Java SDK Tests') { |
| steps { |
| container('java') { |
| sh ''' |
| mkdir /home/jenkins/agent/.m2 |
| chmod +x ./ci/build_java.sh |
| ./ci/build_java.sh |
| ''' |
| } |
| } |
| } |
| stage('C++ SDK Tests') { |
| steps { |
| container('cpp') { |
| sh ''' |
| chmod +x ./ci/build_cpp.sh |
| ./ci/build_cpp.sh |
| ''' |
| } |
| } |
| } |
| } |
| } |