Files
qt6-migration-pipeline/external-dependencies/dtentity/Jenkinsfile
T

110 lines
3.6 KiB
Groovy

pipeline {
agent any
environment {
DTENTITY_VERSION = '1.0.0'
HARBOR_REGISTRY = 'harbor.sl.defence-elec.de/proxydockerhub'
IMAGE_NAME = 'dtentity'
IMAGE_TAG = "${DTENTITY_VERSION}"
OFFLINE_CACHE_PATH = '/opt/offline-cache/dtEntity'
}
options {
timeout(time: 20, unit: 'MINUTES')
buildDiscarder(logRotator(numToKeepStr: '10'))
}
stages {
stage('Checkout') {
steps {
checkout scm
}
}
stage('Prepare DEB Package Installation') {
steps {
script {
// dtEntity DEB package (libdtentity-dev) will be installed from internal SCM repository.
// No license file required - open source (LGPL license).
sh """
echo "dtEntity: Will install libdtentity-dev from internal SCM"
"""
}
}
}
stage('Build dtEntity Container') {
steps {
script {
dir('external-dependencies/dtentity') {
sh """
docker build \
--build-arg DTENTITY_VERSION=${DTENTITY_VERSION} \
-t ${HARBOR_REGISTRY}/${IMAGE_NAME}:${IMAGE_TAG} \
.
"""
}
}
}
}
stage('Verify dtEntity') {
steps {
script {
sh """
docker run --rm ${HARBOR_REGISTRY}/${IMAGE_NAME}:${IMAGE_TAG} bash -c '
ls -la /opt/dtEntity/
test -d /opt/dtEntity/include
test -d /opt/dtEntity/lib64
'
"""
}
}
}
stage('Generate SBOM') {
steps {
script {
dir('external-dependencies/dtentity') {
sh """
mkdir -p sbom
# Set environment variables for SBOM generation
export GIT_URL="${env.GIT_URL}"
export GIT_COMMIT="${env.GIT_COMMIT}"
export BUILD_NUMBER="${env.BUILD_NUMBER}"
export DOCKERFILE_PATH="external-dependencies/dtentity/Dockerfile"
# Generate CycloneDX SBOM, SLSA provenance, and license report
bash ../scripts/generate-sbom.sh dtentity ${DTENTITY_VERSION} ./sbom
"""
}
}
}
}
stage('Push to Registry') {
steps {
script {
withCredentials([usernamePassword(
credentialsId: 'harbor-credentials',
usernameVariable: 'HARBOR_USER',
passwordVariable: 'HARBOR_PASSWORD'
)]) {
sh """
echo ${HARBOR_PASSWORD} | docker login ${HARBOR_REGISTRY} -u ${HARBOR_USER} --password-stdin
docker push ${HARBOR_REGISTRY}/${IMAGE_NAME}:${IMAGE_TAG}
docker logout ${HARBOR_REGISTRY}
"""
}
}
}
}
}
post {
always {
cleanWs()
}
}
}