-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
181 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
FROM registry.cloudogu.com/official/java:17.0.12-3 as base | ||
FROM registry.cloudogu.com/official/java:17.0.13-1 as base | ||
|
||
ENV SONARQUBE_HOME=/opt/sonar \ | ||
# mark as webapp for nginx | ||
SERVICE_TAGS=webapp \ | ||
SONAR_VERSION=9.9.7.96285 \ | ||
CAS_PLUGIN_VERSION=5.0.2 \ | ||
SONAR_VERSION=9.9.8.100196 \ | ||
CAS_PLUGIN_VERSION=5.1.0 \ | ||
STARTUP_DIR="/" | ||
|
||
FROM base as builder | ||
|
||
ENV SONARQUBE_ZIP_SHA256=82eb93a1380dac4725ad24fd94a11917fb2e0ac6b9a9c98b20e436ed2a50f351 \ | ||
CAS_PLUGIN_JAR_SHA256=82f9fd7f65c9ce255f4f1dd6649a65a1f7eaf2acbc6a54f2c8103cbc2a42010f \ | ||
ENV SONARQUBE_ZIP_SHA256=07d9100c95e5c19f1785c0e9ffc7c8973ce3069a568d2500146a5111b6e966cd \ | ||
CAS_PLUGIN_JAR_SHA256=67a127a4f8fd247b2f2c84869d62d960c97fb546083a79fbac637163123490a2 \ | ||
BUILDER_HOME="/builder/sonar" | ||
|
||
WORKDIR /builder | ||
|
@@ -27,7 +27,7 @@ RUN echo "${CAS_PLUGIN_JAR_SHA256} *${BUILDER_HOME}/sonar-cas-plugin-${CAS_PLUGI | |
FROM base | ||
|
||
LABEL NAME="official/sonar" \ | ||
VERSION="9.9.7-1" \ | ||
VERSION="9.9.8-1" \ | ||
maintainer="[email protected]" | ||
|
||
RUN set -eux \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!groovy | ||
@Library(['github.com/cloudogu/ces-build-lib@2.4.0', 'github.com/cloudogu/dogu-build-lib@v2.5.0']) | ||
@Library(['github.com/cloudogu/[email protected].1', 'github.com/cloudogu/dogu-build-lib@v3.0.0']) | ||
import com.cloudogu.ces.cesbuildlib.* | ||
import com.cloudogu.ces.dogubuildlib.* | ||
|
||
|
@@ -22,16 +22,16 @@ node('vagrant') { | |
disableConcurrentBuilds(), | ||
// Parameter to activate dogu upgrade test on demand | ||
parameters([ | ||
booleanParam(defaultValue: false, description: 'Test dogu upgrade from latest release or optionally from defined version below', name: 'TestDoguUpgrade'), | ||
string(defaultValue: '', description: 'Old Dogu version for the upgrade test (optional; e.g. 2.222.1-1)', name: 'OldDoguVersionForUpgradeTest'), | ||
booleanParam(defaultValue: false, description: 'Enables the video recording during the test execution', name: 'EnableVideoRecording'), | ||
choice(name: 'TrivyScanLevels', choices: [TrivyScanLevel.CRITICAL, TrivyScanLevel.HIGH, TrivyScanLevel.MEDIUM, TrivyScanLevel.ALL], description: 'The levels to scan with trivy'), | ||
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.'), | ||
booleanParam(defaultValue: false, description: 'Test dogu upgrade from latest release or optionally from defined version below', name: 'TestDoguUpgrade'), | ||
string(defaultValue: '', description: 'Old Dogu version for the upgrade test (optional; e.g. 2.222.1-1)', name: 'OldDoguVersionForUpgradeTest'), | ||
booleanParam(defaultValue: false, description: 'Enables the video recording during the test execution', name: 'EnableVideoRecording'), | ||
booleanParam(defaultValue: false, description: 'Enables the screenshot recording during the test execution', 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'), | ||
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.'), | ||
]) | ||
]) | ||
|
||
EcoSystem ecoSystem = new EcoSystem(this, "gcloud-ces-operations-internal-packer", "jenkins-gcloud-ces-operations-internal") | ||
Trivy trivy = new Trivy(this, ecoSystem) | ||
|
||
stage('Checkout') { | ||
checkout scm | ||
|
@@ -73,9 +73,12 @@ node('vagrant') { | |
} | ||
|
||
stage('Trivy scan') { | ||
trivy.scanDogu("/dogu", TrivyScanFormat.HTML, params.TrivyScanLevels, params.TrivyStrategy) | ||
trivy.scanDogu("/dogu", TrivyScanFormat.JSON, params.TrivyScanLevels, params.TrivyStrategy) | ||
trivy.scanDogu("/dogu", TrivyScanFormat.PLAIN, params.TrivyScanLevels, params.TrivyStrategy) | ||
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') { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
MAKEFILES_VERSION=9.3.2 | ||
MAKEFILES_VERSION=9.5.0 | ||
.DEFAULT_GOAL:=dogu-release | ||
|
||
WORKSPACE=/workspace | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# used to create switch the dogu to a prerelease namespace | ||
# e.g. official/usermgmt -> prerelease_official/usermgmt | ||
|
||
.PHONY: prerelease_namespace | ||
prerelease_namespace: | ||
build/make/stagex.sh prerelease_namespace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
prerelease_namespace() { | ||
|
||
# Update version in dogu.json | ||
if [ -f "dogu.json" ]; then | ||
echo "Updating name in dogu.json..." | ||
ORIG_NAME="$(jq -r ".Name" ./dogu.json)" | ||
PRERELEASE_NAME="prerelease_${ORIG_NAME}" | ||
jq ".Name = \"${PRERELEASE_NAME}\"" dogu.json >dogu2.json && mv dogu2.json dogu.json | ||
jq ".Image = \"registry.cloudogu.com/${PRERELEASE_NAME}\"" dogu.json >dogu2.json && mv dogu2.json dogu.json | ||
fi | ||
|
||
# Update version in Dockerfile | ||
if [ -f "Dockerfile" ]; then | ||
echo "Updating version in Dockerfile..." | ||
ORIG_NAME="$(grep -oP "^[ ]*NAME=\"([^\"]*)" Dockerfile | awk -F "\"" '{print $2}')" | ||
PRERELEASE_NAME="prerelease_$( echo -e "$ORIG_NAME" | sed 's/\//\\\//g' )" | ||
sed -i "s/\(^[ ]*NAME=\"\)\([^\"]*\)\(.*$\)/\1${PRERELEASE_NAME}\3/" Dockerfile | ||
fi | ||
|
||
} | ||
|
||
|
||
TYPE="${1}" | ||
|
||
echo ${TYPE} | ||
if [[ "${TYPE}" == "prerelease_namespace" ]];then | ||
prerelease_namespace | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/bin/bash | ||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
TYPE="${1}" | ||
|
||
update_build_libs() { | ||
echo "Get newest version of ces-build-lib and dogu-build-lib" | ||
update_jenkinsfile | ||
echo "Newest Versions set. Please check your Jenkinsfile" | ||
} | ||
|
||
get_highest_version() { | ||
local target="${1}" | ||
local gitCesBuildLib | ||
# getting tags from ces-build.libs OR dogu-build-libs | ||
gitCesBuildLib="$(git ls-remote --tags --refs https://github.com/cloudogu/${target}-build-lib)" | ||
local highest | ||
# Flagfile for getting results out of while-loop | ||
rm -rf .versions | ||
while IFS= read -r line; do | ||
local version | ||
version="$(awk -F'/tags/' '{ for(i=1;i<=NF;i++) print $i }' <<< $line | tail -n 1 | sed 's/[^0-9\.]*//g')" | ||
if [[ $version == *"."* ]] ; then | ||
echo $version >> ".versions" | ||
fi | ||
done <<< "$gitCesBuildLib" | ||
highest=$(sort .versions | tail -n 1) | ||
rm -rf .versions | ||
echo "${highest}" | ||
} | ||
|
||
# Patch Jenkinsfile | ||
update_jenkinsfile() { | ||
sed -i "s/ces-build-lib@[[:digit:]].[[:digit:]].[[:digit:]]/ces-build-lib@$(get_highest_version ces)/g" Jenkinsfile | ||
sed -i "s/dugu-build-lib@[[:digit:]].[[:digit:]].[[:digit:]]/dogu-build-lib@$(get_highest_version dogu)/g" Jenkinsfile | ||
} | ||
|
||
# switch for script entrypoint | ||
if [[ "${TYPE}" == "buildlibs" ]];then | ||
update_build_libs | ||
else | ||
echo "Unknown target ${TYPE}" | ||
fi | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters