Skip to content
Snippets Groups Projects

Reduce disk usage

Closed Frederic Gurr requested to merge fgurr/simopenpass:fgurr-develop-patch-76449 into develop
1 file
+ 152
28
Compare changes
  • Side-by-side
  • Inline
+ 152
28
/*******************************************************************************
/********************************************************************************
* Copyright (c) 2021 in-tech GmbH
* Copyright (c) 2021 in-tech GmbH
 
* 2022-2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
*
*
* This program and the accompanying materials are made
* This program and the accompanying materials are made available under the
* available under the terms of the Eclipse Public License 2.0
* terms of the Eclipse Public License 2.0 which is available at
* which is available at https://www.eclipse.org/legal/epl-2.0/
* http://www.eclipse.org/legal/epl-2.0.
*
*
* SPDX-License-Identifier: EPL-2.0
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
********************************************************************************/
pipeline {
pipeline {
agent none
agent none
 
parameters {
 
booleanParam(name: 'BUILD_DOCKER_IMAGE', defaultValue: false, description: 'Force docker image (re-)build')
 
}
options {
options {
checkoutToSubdirectory('repo')
checkoutToSubdirectory('repo')
 
timeout(time: 10, unit: 'HOURS')
 
timestamps()
 
disableConcurrentBuilds(abortPrevious: true)
 
buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: '2'))
 
}
 
environment {
 
IMAGE_NAME = "eclipseopenpass/opsim-ci"
 
REPO_URL = "https://gitlab.eclipse.org/eclipse/openpass/opSimulation.git"
 
DOCKERFILE_PATH = "utils/Dockerfile"
}
}
stages {
stages {
 
stage('Build docker image or set image tag') {
 
agent {
 
kubernetes {
 
inheritFrom 'openpass-agent-pod-' + env.BUILD_NUMBER
 
yaml """
 
apiVersion: v1
 
kind: Pod
 
spec:
 
containers:
 
- name: ose-build
 
image: eclipseopenpass/ubuntu:base
 
tty: true
 
resources:
 
limits:
 
memory: "16Gi"
 
cpu: "4"
 
requests:
 
memory: "16Gi"
 
cpu: "4"
 
- name: jnlp
 
volumeMounts:
 
- name: volume-known-hosts
 
mountPath: /home/jenkins/.ssh
 
volumes:
 
- name: volume-known-hosts
 
configMap:
 
name: known-hosts
 
"""
 
}
 
}
 
stages {
 
stage('Build docker image') {
 
when {
 
expression {
 
return params.BUILD_DOCKER_IMAGE
 
}
 
}
 
steps {
 
script {
 
env.IMAGE_TAG = "v1.2.0"
 
}
 
build job: 'Docker-build', parameters: [string(name: 'IMAGE_NAME', value: "${env.IMAGE_NAME}"),
 
string(name: 'IMAGE_TAG', value:"${env.IMAGE_TAG}"),
 
string(name: 'REPO_URL', value: "${env.REPO_URL}"),
 
string(name: 'BRANCH_NAME', value: "${env.GIT_BRANCH}"),
 
string(name: 'DOCKERFILE_PATH', value: "${env.DOCKERFILE_PATH}")],
 
propagate: true
 
}
 
}
 
stage('Set image tag') {
 
when {
 
expression {
 
return !params.BUILD_DOCKER_IMAGE
 
}
 
}
 
steps {
 
script {
 
env.IMAGE_TAG = "v1.2.0"
 
}
 
}
 
}
 
}
 
}
stage('Linux and Windows build') {
stage('Linux and Windows build') {
parallel {
parallel {
stage('Linux') {
stage('Linux') {
agent {
agent {
kubernetes {
kubernetes {
label 'openpass-agent-pod-' + env.BUILD_NUMBER
inheritFrom 'openpass-agent-pod-' + env.BUILD_NUMBER
yaml """
yaml """
apiVersion: v1
apiVersion: v1
kind: Pod
kind: Pod
spec:
spec:
containers:
containers:
- name: openpass-build
- name: openpass-build
image: rbiegel/openpass-build:latest
image: "${env.IMAGE_NAME}:${env.IMAGE_TAG}"
tty: true
tty: true
resources:
resources:
limits:
limits:
memory: "16Gi"
memory: "16Gi"
cpu: "4"
cpu: "4"
requests:
volumeMounts:
memory: "16Gi"
- name: openpass-cache-storage
cpu: "4"
mountPath: "/home/jenkins/cache"
- name: jnlp
- name: jnlp
volumeMounts:
volumeMounts:
- name: volume-known-hosts
- name: volume-known-hosts
@@ -43,11 +119,23 @@ spec:
@@ -43,11 +119,23 @@ spec:
- name: volume-known-hosts
- name: volume-known-hosts
configMap:
configMap:
name: known-hosts
name: known-hosts
 
- name: openpass-cache-storage
 
persistentVolumeClaim:
 
claimName: openpass-cache-storage
 
securityContext:
 
seLinuxOptions:
 
level: s0:c4,c54
 
type: spc_t
"""
"""
}
}
}
}
environment {
environment {
CONAN_USER_HOME = '/home/jenkins/agent/workspace'
CONAN_HOME = '/opsimulation/conan'
 
CCACHE_REMOTE_STORAGE = 'file:///home/jenkins/cache/opSimulation/ccache/linux'
 
CCACHE_REMOTE_ONLY = 'true'
 
CCACHE_BASE_DIR = "${env.WORKSPACE}"
 
CTCACHE_BASE_DIR = '/home/jenkins/cache/opSimulation/ctcache'
 
PYTHON_EXECUTABLE = 'python3'
}
}
stages {
stages {
stage('Linux: Cleanup and prepare dependencies') {
stage('Linux: Cleanup and prepare dependencies') {
@@ -57,6 +145,14 @@ spec:
@@ -57,6 +145,14 @@ spec:
}
}
}
}
}
}
 
stage('Linux: Code compliance') {
 
steps {
 
container('openpass-build') {
 
sh 'bash repo/utils/ci/scripts/61_check_eol.sh'
 
sh 'bash repo/utils/ci/scripts/62_static_analysis.sh'
 
}
 
}
 
}
stage('Linux: Build core and run end-to-end tests') {
stage('Linux: Build core and run end-to-end tests') {
steps {
steps {
container('openpass-build') {
container('openpass-build') {
@@ -71,20 +167,35 @@ spec:
@@ -71,20 +167,35 @@ spec:
}
}
}
}
}
}
 
stage('Linux: Cleanup') {
 
steps {
 
container('openpass-build') {
 
sh 'bash repo/utils/ci/scripts/cleanup.sh'
 
}
 
}
 
}
stage('Linux: Deploy') {
stage('Linux: Deploy') {
when {
when {
anyOf {
anyOf {
tag pattern: "openPASS_.*", comparator: "REGEXP"
tag pattern: "v.*", comparator: "REGEXP"
triggeredBy 'TimerTrigger'
branch "develop"
}
}
}
}
steps {
steps {
container('jnlp') {
container('jnlp') {
sshagent ( ['projects-storage.eclipse.org-bot-ssh']) {
sshagent ( ['projects-storage.eclipse.org-bot-ssh']) {
sh '''
sh 'bash repo/utils/ci/scripts/publish_artifacts.sh'
ssh -o BatchMode=yes genie.simopenpass@projects-storage.eclipse.org mkdir -p /home/data/httpd/download.eclipse.org/simopenpass/snapshots
}
[ -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"
}
'''
}
 
}
 
stage('Linux: Deploy Docs') {
 
steps {
 
container('openpass-build')
 
{
 
withCredentials([string(credentialsId: 'gitlab-api-token', variable: 'GITLAB_BOT_TOKEN')])
 
{
 
sh 'bash repo/utils/ci/scripts/auto_deploy_docu.sh'
}
}
}
}
}
}
@@ -92,50 +203,63 @@ spec:
@@ -92,50 +203,63 @@ spec:
}
}
post {
post {
always {
always {
archiveArtifacts allowEmptyArchive: true, artifacts: 'artifacts/**,dist/opSim/testreport/**', followSymlinks: false
archiveArtifacts allowEmptyArchive: true, artifacts: 'artifacts/**', followSymlinks: false
junit allowEmptyResults: true, testResults: 'build/**/*Tests.xml,repo/sim/tests/endToEndTests/pyOpenPASS/result_*.xml'
junit allowEmptyResults: true, testResults: 'build/**/*Tests.xml,repo/sim/tests/endToEndTests/pyOpenPASS/result_*.xml'
}
}
}
}
}
}
stage('Windows') {
stage('Windows') {
agent {
agent {
label 'windows'
label 'windows10'
}
}
environment {
environment {
MSYSTEM = 'MINGW64'
MSYSTEM = 'MINGW64'
CHERE_INVOKING = 'yes'
CHERE_INVOKING = 'yes'
PYTHON_WINDOWS_EXE = 'C:/Program Files/Python39/python.exe'
PYTHON_EXECUTABLE = 'C:/op/python/python.exe'
 
OP_BASE_DIR = '/w'
 
OP_REPO_DIR = '/w/repo'
 
OP_DEPS_DIR = '/w/deps'
}
}
stages {
stages {
stage('Windows: Cleanup and prepare dependencies') {
stage('Windows: Cleanup and prepare dependencies') {
steps {
steps {
bat 'subst W: %WORKSPACE%'
bat 'subst W: %WORKSPACE%'
dir('W:/') {
dir('W:/') {
bat 'C:\\msys64\\usr\\bin\\bash -lc repo/utils/ci/scripts/build_prepare.sh'
bat 'C:\\op\\msys64\\usr\\bin\\bash -lc repo/utils/ci/scripts/build_prepare.sh'
}
}
}
}
}
}
stage('Windows: Build core and run end-to-end tests') {
stage('Windows: Build core and run end-to-end tests') {
steps {
steps {
dir('W:/') {
dir('W:/') {
bat 'C:\\msys64\\usr\\bin\\bash -lc repo/utils/ci/scripts/build_core_and_e2e.sh'
bat 'C:\\op\\msys64\\usr\\bin\\bash -lc repo/utils/ci/scripts/build_core_and_e2e.sh'
}
}
}
}
}
}
stage('Windows: Build and run unit tests') {
stage('Windows: Build and run unit tests') {
steps {
steps {
dir('W:/') {
dir('W:/') {
bat 'C:\\msys64\\usr\\bin\\bash -lc repo/utils/ci/scripts/build_unittests.sh'
bat 'C:\\op\\msys64\\usr\\bin\\bash -lc repo/utils/ci/scripts/build_unittests.sh'
 
}
 
}
 
}
 
stage('Windows: Cleanup') {
 
steps {
 
dir('W:/') {
 
bat 'C:\\op\\msys64\\usr\\bin\\bash -lc repo/utils/ci/scripts/cleanup.sh'
}
}
}
}
}
}
stage('Windows: Deploy') {
stage('Windows: Deploy') {
 
when {
 
anyOf {
 
tag pattern: "v.*", comparator: "REGEXP"
 
branch "develop"
 
}
 
}
steps {
steps {
sshagent ( ['projects-storage.eclipse.org-bot-ssh']) {
sshagent ( ['projects-storage.eclipse.org-bot-ssh']) {
bat '''
bat 'C:\\op\\msys64\\usr\\bin\\bash -lc repo/utils/ci/scripts/publish_artifacts.sh'
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'
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"'
'''
}
}
}
}
}
}
@@ -143,7 +267,7 @@ spec:
@@ -143,7 +267,7 @@ spec:
post {
post {
always {
always {
bat 'subst W: /d'
bat 'subst W: /d'
archiveArtifacts allowEmptyArchive: true, artifacts: 'artifacts/**,dist/opSim/testreport/**', followSymlinks: false
archiveArtifacts allowEmptyArchive: true, artifacts: 'artifacts/**', followSymlinks: false
junit allowEmptyResults: true, testResults: 'build/**/*Tests.xml,repo/sim/tests/endToEndTests/pyOpenPASS/result_*.xml'
junit allowEmptyResults: true, testResults: 'build/**/*Tests.xml,repo/sim/tests/endToEndTests/pyOpenPASS/result_*.xml'
}
}
}
}
Loading