Skip to content

Commit

Permalink
[#30] Fix CVEs & update build libs
Browse files Browse the repository at this point in the history
* Update ces-build-lib & dogu-build-lib
* Add prerelease stage to Jenkinsfile
* Add Trivy Scan to Jenkinsfile
* Update base image to debian:12.7-3
* Update mysql package to 0.8.33-1
  • Loading branch information
root committed Jan 31, 2025
1 parent 5baa90a commit 414f1a0
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM registry.cloudogu.com/official/base-debian:12.6-1
FROM registry.cloudogu.com/official/base-debian:12.7-3

LABEL MAINTAINER="[email protected]" \
NAME="official/mysql" \
Expand Down
30 changes: 27 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!groovy
@Library(['github.com/cloudogu/ces-build-lib@v1.48.0', 'github.com/cloudogu/dogu-build-lib@v1.5.1']) _
@Library(['github.com/cloudogu/ces-build-lib@4.0.1', 'github.com/cloudogu/dogu-build-lib@v3.0.0'])
import com.cloudogu.ces.cesbuildlib.*
import com.cloudogu.ces.dogubuildlib.*

Expand Down Expand Up @@ -47,13 +47,23 @@ timestamps {
// Keep only the last x builds to preserve space
buildDiscarder(logRotator(numToKeepStr: '10')),
// Don't run concurrent builds for a branch, because they use the same workspace directory
disableConcurrentBuilds()
disableConcurrentBuilds(),
parameters([
booleanParam(defaultValue: true, description: 'Enables cypress to record video of the integration tests.', name: 'EnableVideoRecording'),
booleanParam(defaultValue: true, description: 'Enables cypress to take screenshots of failing integration tests.', name: 'EnableScreenshotRecording'),
choice(name: 'TrivySeverityLevels', choices: [TrivySeverityLevel.CRITICAL, TrivySeverityLevel.HIGH_AND_ABOVE, TrivySeverityLevel.MEDIUM_AND_ABOVE, TrivySeverityLevel.ALL], description: 'The levels to scan with trivy', defaultValue: TrivySeverityLevel.CRITICAL),
choice(name: 'TrivyStrategy', choices: [TrivyScanStrategy.UNSTABLE, TrivyScanStrategy.FAIL, TrivyScanStrategy.IGNORE], description: 'Define whether the build should be unstable, fail or whether the error should be ignored if any vulnerability was found.', defaultValue: TrivyScanStrategy.UNSTABLE),
])
])

EcoSystem ecoSystem = new EcoSystem(this, 'gcloud-ces-operations-internal-packer', 'jenkins-gcloud-ces-operations-internal')

try {
stage('Provision') {
// change namespace to prerelease_namespace if in develop-branch
if (gitflow.isPreReleaseBranch()) {
sh "make prerelease_namespace"
}
ecoSystem.provision(doguDirectory)
}

Expand All @@ -73,6 +83,15 @@ timestamps {
ecoSystem.build(doguDirectory)
}

stage('Trivy scan') {
ecoSystem.copyDoguImageToJenkinsWorker("/dogu")
Trivy trivy = new Trivy(this)
trivy.scanDogu(".", params.TrivySeverityLevels, params.TrivyStrategy)
trivy.saveFormattedTrivyReport(TrivyScanFormat.TABLE)
trivy.saveFormattedTrivyReport(TrivyScanFormat.JSON)
trivy.saveFormattedTrivyReport(TrivyScanFormat.HTML)
}

stage('Verify') {
ecoSystem.verify(doguDirectory)
}
Expand Down Expand Up @@ -108,7 +127,12 @@ timestamps {
stage('Add Github-Release') {
github.createReleaseWithChangelog(releaseVersion, changelog, "main")
}
}
} else if (gitflow.isPreReleaseBranch()) {
// push to registry in prerelease_namespace
stage('Push Prerelease Dogu to registry') {
ecoSystem.pushPreRelease("/dogu")
}
}

} finally {
stage('Clean') {
Expand Down
4 changes: 2 additions & 2 deletions installation-scripts/install-mysql.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
set -o errexit
set -o nounset
set -o pipefail
DEBIAN_SHA_256_SUM="df9c563abd70bb9b2fb1be7d11868a300bd60023bcd60700f24430008059a704"
DEBIAN_SHA_256_SUM="455ec3690765cff58a4123ba498921fb58fb76c46465e9659180848e997452b6"
# Version of debian file containing the installation files for mysql in different versions
# This is NOT the actual mysql version to install
VERSION="0.8.32-1"
VERSION="0.8.33-1"
# see for latest version: https://dev.mysql.com/downloads/repo/apt/
wget "https://dev.mysql.com/get/mysql-apt-config_${VERSION}_all.deb"
echo "${DEBIAN_SHA_256_SUM} mysql-apt-config_${VERSION}_all.deb" | sha256sum -c -
Expand Down
Binary file added mysql-apt-config_0.8.33-1_all.deb
Binary file not shown.

0 comments on commit 414f1a0

Please sign in to comment.