Skip to content

Commit 6588c62

Browse files
kahoona77cesmarvin
authored andcommitted
Merge branch 'release/v3.9.0-4'
2 parents 2211619 + cb42866 commit 6588c62

19 files changed

+191
-31
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [v3.9.0-4] - 2025-02-12
10+
### Changed
11+
- [#32] Update Makefiles to 9.5.0
12+
- [#36] exit with error if `logging/root` is invalid
13+
- this change is necessary for compatibility with CES Multinode
14+
915
## [v3.9.0-3] - 2024-09-18
1016
### Changed
1117
- Relicense to AGPL-3.0-only

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM registry.cloudogu.com/official/base:3.20.2-1
22
LABEL NAME="official/postfix" \
3-
VERSION="3.9.0-3" \
3+
VERSION="3.9.0-4" \
44
55

66
# INSTALL POSTFIX

Jenkinsfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!groovy
2-
@Library(['github.com/cloudogu/ces-build-lib@1.67.0', 'github.com/cloudogu/dogu-build-lib@v2.3.0'])
2+
@Library(['github.com/cloudogu/ces-build-lib@3.1.0', 'github.com/cloudogu/dogu-build-lib@v2.6.0'])
33
import com.cloudogu.ces.cesbuildlib.*
44
import com.cloudogu.ces.dogubuildlib.*
55

@@ -33,7 +33,7 @@ timestamps {
3333
}
3434

3535
stage('Shellcheck') {
36-
shellCheck()
36+
shellCheck("./resources/logging.sh ./resources/startup.sh ./resources/mask2cidr.sh")
3737
}
3838
}
3939
node('vagrant') {

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
MAKEFILES_VERSION=9.1.0
1+
MAKEFILES_VERSION=9.5.0
22

33
.DEFAULT_GOAL:=dogu-release
44

build/make/bats.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ BATS_SUPPORT=$(BATS_LIBRARY_DIR)/bats-support
99
BATS_FILE=$(BATS_LIBRARY_DIR)/bats-file
1010
BATS_BASE_IMAGE?=bats/bats
1111
BATS_CUSTOM_IMAGE?=cloudogu/bats
12-
BATS_TAG?=1.2.1
12+
BATS_TAG?=1.11.0
1313
BATS_DIR=build/make/bats
1414
BATS_WORKDIR="${WORKDIR}"/"${BATS_DIR}"
1515

build/make/bats/Dockerfile

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
ARG BATS_BASE_IMAGE
22
ARG BATS_TAG
33

4-
FROM ${BATS_BASE_IMAGE}:${BATS_TAG}
4+
FROM ${BATS_BASE_IMAGE:-bats/bats}:${BATS_TAG:-1.11.0}
55

66
# Make bash more findable by scripts and tests
77
RUN apk add make git bash
8+
# suppress git "detected dubious ownership" error/warning for repos which are checked out later
9+
RUN git config --global --add safe.directory /workspace

build/make/build.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
ADDITIONAL_LDFLAGS?=-extldflags -static
44
LDFLAGS?=-ldflags "$(ADDITIONAL_LDFLAGS) -X main.Version=$(VERSION) -X main.CommitID=$(COMMIT_ID)"
55
GOIMAGE?=golang
6-
GOTAG?=1.22
6+
GOTAG?=1.23
77
GOOS?=linux
88
GOARCH?=amd64
99
PRE_COMPILE?=

build/make/k8s-dogu.tpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
apiVersion: k8s.cloudogu.com/v1
1+
apiVersion: k8s.cloudogu.com/v2
22
kind: Dogu
33
metadata:
44
name: NAME

build/make/k8s.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ ${K8S_RESOURCE_TEMP_FOLDER}:
138138
##@ K8s - Docker
139139

140140
.PHONY: docker-build
141-
docker-build: check-docker-credentials check-k8s-image-env-var ## Builds the docker image of the K8s app.
141+
docker-build: check-docker-credentials check-k8s-image-env-var ${BINARY_YQ} ## Builds the docker image of the K8s app.
142142
@echo "Building docker image $(IMAGE)..."
143143
@DOCKER_BUILDKIT=1 docker build . -t $(IMAGE)
144144

build/make/prerelease.mk

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# used to create switch the dogu to a prerelease namespace
2+
# e.g. official/usermgmt -> prerelease_official/usermgmt
3+
4+
.PHONY: prerelease_namespace
5+
prerelease_namespace:
6+
build/make/stagex.sh prerelease_namespace

build/make/prerelease.sh

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
set -o errexit
3+
set -o nounset
4+
set -o pipefail
5+
6+
prerelease_namespace() {
7+
8+
# Update version in dogu.json
9+
if [ -f "dogu.json" ]; then
10+
echo "Updating name in dogu.json..."
11+
ORIG_NAME="$(jq -r ".Name" ./dogu.json)"
12+
PRERELEASE_NAME="prerelease_${ORIG_NAME}"
13+
jq ".Name = \"${PRERELEASE_NAME}\"" dogu.json >dogu2.json && mv dogu2.json dogu.json
14+
jq ".Image = \"registry.cloudogu.com/${PRERELEASE_NAME}\"" dogu.json >dogu2.json && mv dogu2.json dogu.json
15+
fi
16+
17+
# Update version in Dockerfile
18+
if [ -f "Dockerfile" ]; then
19+
echo "Updating version in Dockerfile..."
20+
ORIG_NAME="$(grep -oP "^[ ]*NAME=\"([^\"]*)" Dockerfile | awk -F "\"" '{print $2}')"
21+
PRERELEASE_NAME="prerelease_$( echo -e "$ORIG_NAME" | sed 's/\//\\\//g' )"
22+
sed -i "s/\(^[ ]*NAME=\"\)\([^\"]*\)\(.*$\)/\1${PRERELEASE_NAME}\3/" Dockerfile
23+
fi
24+
25+
}
26+
27+
28+
TYPE="${1}"
29+
30+
echo ${TYPE}
31+
if [[ "${TYPE}" == "prerelease_namespace" ]];then
32+
prerelease_namespace
33+
fi

build/make/release.sh

+1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ fi
5656

5757
update_versions "${NEW_RELEASE_VERSION}"
5858
update_changelog "${NEW_RELEASE_VERSION}" "${FIXED_CVE_LIST}"
59+
update_releasenotes "${NEW_RELEASE_VERSION}"
5960
show_diff
6061

6162
if [[ -n "${DRY_RUN}" ]]; then

build/make/release_functions.sh

+44
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,50 @@ update_changelog() {
207207
git commit -m "Update changelog"
208208
}
209209

210+
update_releasenotes() {
211+
local NEW_RELEASE_VERSION="${1}"
212+
213+
# ReleaseNotes update
214+
local CURRENT_DATE
215+
CURRENT_DATE=$(date --rfc-3339=date)
216+
local NEW_RELEASENOTE_TITLE="## [v${NEW_RELEASE_VERSION}] - ${CURRENT_DATE}"
217+
rm -rf ".rn_changed"
218+
find . -name "*release_notes*.md" -print0 | while read -d $'\0' file
219+
do
220+
# Check if "Unreleased" tag exists
221+
while ! grep --silent "## \[Unreleased\]" "${file}"; do
222+
echo ""
223+
echo -e "\e[31mYour ${file} does not contain a \"## [Unreleased]\" line!\e[0m"
224+
echo "Please add one to make it comply to https://keepachangelog.com/en/1.0.0/"
225+
wait_for_ok "Please insert a \"## [Unreleased]\" line into ${file} now."
226+
done
227+
228+
# Add new title line to changelog
229+
sed -i "s|## \[Unreleased\]|## \[Unreleased\]\n\n${NEW_RELEASENOTE_TITLE}|g" "${file}"
230+
echo "Processed ${file}"
231+
echo true > ".rn_changed"
232+
done
233+
234+
if test -f ".rn_changed" ; then
235+
# Wait for user to validate changelog changes
236+
wait_for_ok "Please make sure your release notes looks as desired."
237+
238+
find . -name "*release_notes*.md" -print0 | while read -d $'\0' file
239+
do
240+
# Check if new version tag still exists
241+
while ! grep --silent "$(echo $NEW_RELEASENOTE_TITLE | sed -e 's/[]\/$*.^[]/\\&/g')" "${file}"; do
242+
echo ""
243+
echo -e "\e[31mYour ${file} does not contain \"${NEW_RELEASENOTE_TITLE}\"!\e[0m"
244+
wait_for_ok "Please update your ${file} now."
245+
done
246+
git add "${file}"
247+
done
248+
249+
git commit -m "Update ReleaseNotes"
250+
fi
251+
rm -rf ".rn_changed"
252+
}
253+
210254
# addFixedCVEListFromReRelease is used in dogu cve releases. The method adds the fixed CVEs under the ### Fixed header
211255
# in the unreleased section.
212256
addFixedCVEListFromReRelease() {

build/make/self-update.mk

+6-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,9 @@ remove-old-files:
1919

2020
.PHONY: copy-new-files
2121
copy-new-files:
22-
@cp -r $(TMP_DIR)/makefiles-$(MAKEFILES_VERSION)/build/make $(BUILD_DIR)
22+
@cp -r $(TMP_DIR)/makefiles-$(MAKEFILES_VERSION)/build/make $(BUILD_DIR)
23+
24+
.PHONY: update-build-libs
25+
update-build-libs:
26+
@echo "Check for newer Build-Lib versions"
27+
build/make/self-update.sh buildlibs

build/make/self-update.sh

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/bin/bash
2+
set -o errexit
3+
set -o nounset
4+
set -o pipefail
5+
6+
TYPE="${1}"
7+
8+
update_build_libs() {
9+
echo "Get newest version of ces-build-lib and dogu-build-lib"
10+
update_jenkinsfile
11+
echo "Newest Versions set. Please check your Jenkinsfile"
12+
}
13+
14+
get_highest_version() {
15+
local target="${1}"
16+
local gitCesBuildLib
17+
# getting tags from ces-build.libs OR dogu-build-libs
18+
gitCesBuildLib="$(git ls-remote --tags --refs https://github.com/cloudogu/${target}-build-lib)"
19+
local highest
20+
# Flagfile for getting results out of while-loop
21+
rm -rf .versions
22+
while IFS= read -r line; do
23+
local version
24+
version="$(awk -F'/tags/' '{ for(i=1;i<=NF;i++) print $i }' <<< $line | tail -n 1 | sed 's/[^0-9\.]*//g')"
25+
if [[ $version == *"."* ]] ; then
26+
echo $version >> ".versions"
27+
fi
28+
done <<< "$gitCesBuildLib"
29+
highest=$(sort .versions | tail -n 1)
30+
rm -rf .versions
31+
echo "${highest}"
32+
}
33+
34+
# Patch Jenkinsfile
35+
update_jenkinsfile() {
36+
sed -i "s/ces-build-lib@[[:digit:]].[[:digit:]].[[:digit:]]/ces-build-lib@$(get_highest_version ces)/g" Jenkinsfile
37+
sed -i "s/dogu-build-lib@[[:digit:]].[[:digit:]].[[:digit:]]/dogu-build-lib@$(get_highest_version dogu)/g" Jenkinsfile
38+
}
39+
40+
# switch for script entrypoint
41+
if [[ "${TYPE}" == "buildlibs" ]];then
42+
update_build_libs
43+
else
44+
echo "Unknown target ${TYPE}"
45+
fi
46+
47+
48+

build/make/static-analysis.mk

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
STATIC_ANALYSIS_DIR=$(TARGET_DIR)/static-analysis
44
GOIMAGE?=golang
5-
GOTAG?=1.22
5+
GOTAG?=1.23
66
CUSTOM_GO_MOUNT?=-v /tmp:/tmp
77

88
REVIEW_DOG=$(TMP_DIR)/bin/reviewdog
99
LINT=$(TMP_DIR)/bin/golangci-lint
10-
LINT_VERSION?=v1.58.2
10+
LINT_VERSION?=v1.61.0
1111
# ignore tests and mocks
1212
LINTFLAGS=--tests=false --exclude-files="^.*_mock.go$$" --exclude-files="^.*/mock.*.go$$" --timeout 10m --issues-exit-code 0
1313
ADDITIONAL_LINTER=-E bodyclose -E containedctx -E contextcheck -E decorder -E dupl -E errname -E forcetypeassert -E funlen -E unparam

build/make/vulnerability-scan.mk

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
##@ Vulnerability scan
2+
3+
GOVULNCHECK_BIN=${UTILITY_BIN_PATH}/govulncheck
4+
GOVULNCHECK_VERSION?=latest
5+
6+
${GOVULNCHECK_BIN}: ${UTILITY_BIN_PATH}
7+
$(call go-get-tool,$(GOVULNCHECK_BIN),golang.org/x/vuln/cmd/govulncheck@$(GOVULNCHECK_VERSION))
8+
9+
.PHONY: govulncheck
10+
govulncheck: ${GOVULNCHECK_BIN} ## This target is used to scan the go repository against known vulnerabilities
11+
@echo "Start vulnerability against repository"
12+
${GOVULNCHECK_BIN} -show verbose ./...
13+
@echo "Finished scan"

dogu.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"Name": "official/postfix",
3-
"Version": "3.9.0-3",
3+
"Version": "3.9.0-4",
44
"DisplayName": "Postfix",
55
"Description": "Postfix - Mail Transfer Agent",
66
"Logo": "https://cloudogu.com/images/dogus/postfix.png",

resources/logging.sh

+20-18
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,30 @@ set -o errexit
33
set -o nounset
44
set -o pipefail
55

6+
SCRIPT_LOG_PREFIX="Log level mapping:"
7+
8+
function exitOnInvalidDoguLogLevel() {
9+
echo "${SCRIPT_LOG_PREFIX} Validate root log level"
10+
11+
validateExitCode=0
12+
doguctl validate "${DEFAULT_LOGGING_KEY}" || validateExitCode=$?
13+
14+
if [[ ${validateExitCode} -ne 0 ]]; then
15+
echo "${SCRIPT_LOG_PREFIX} ERROR: The loglevel configured in ${DEFAULT_LOGGING_KEY} is invalid."
16+
echo "${SCRIPT_LOG_PREFIX} ERROR: Fix the loglevel. Exiting now"
17+
exit 1
18+
fi
19+
20+
return
21+
}
22+
623
# logging behaviour can be configured in logging/root with the following options <ERROR,WARN,INFO,DEBUG>
724
DEFAULT_LOGGING_KEY="logging/root"
825
DEFAULT_LOG_LEVEL="INFO"
926

27+
# check if loglevel is valid or exit, so that customers see that they need to fix the log level
28+
exitOnInvalidDoguLogLevel
29+
1030
POSTFIX_LOGLEVEL=$(doguctl config --default "${DEFAULT_LOG_LEVEL}" "${DEFAULT_LOGGING_KEY}")
1131
export POSTFIX_LOGLEVEL
1232

@@ -18,24 +38,6 @@ RSYSLOG_LOGGING="/etc/rsyslog.conf"
1838
SUPERVISOR_CONF_TEMPLATE="/etc/supervisord.conf.tpl"
1939
SUPERVISOR_CONF="/etc/supervisord.conf"
2040

21-
SCRIPT_LOG_PREFIX="Log level mapping:"
22-
function validateDoguLogLevel() {
23-
echo "${SCRIPT_LOG_PREFIX} Validate root log level"
24-
25-
validateExitCode=0
26-
doguctl validate "${DEFAULT_LOGGING_KEY}" || validateExitCode=$?
27-
28-
if [[ ${validateExitCode} -ne 0 ]]; then
29-
echo "${SCRIPT_LOG_PREFIX} WARNING: The loglevel configured in ${DEFAULT_LOGGING_KEY} is invalid."
30-
echo "${SCRIPT_LOG_PREFIX} WARNING: Removing misconfigured value."
31-
doguctl config --rm "${DEFAULT_LOGGING_KEY}"
32-
fi
33-
34-
return
35-
}
36-
37-
validateDoguLogLevel
38-
3941
echo "Rendering logging configuration..."
4042
doguctl template ${RSYSLOG_LOGGING_TEMPLATE} ${RSYSLOG_LOGGING}
4143
doguctl template ${SUPERVISOR_CONF_TEMPLATE} ${SUPERVISOR_CONF}

0 commit comments

Comments
 (0)