Skip to content

Commit 38553d2

Browse files
cbeyer42cesmarvin
authored andcommitted
Merge branch 'release/v3.40.1-2'
2 parents 4e65f37 + 12cca41 commit 38553d2

12 files changed

+329
-53
lines changed

CHANGELOG.md

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

77
## [Unreleased]
88

9+
## [v3.40.1-2] - 2022-08-19
10+
### Added
11+
- Preconfigured compact blobstore task which will run every 14 days. #108
12+
- Preconfigured cleanup policy which, wenn added to a matching maven-snapshot repository, will mark artifacts older than 14 days for deletion. #108
13+
### Fixed
14+
- Remove orientDB credentials from log messages. #88
15+
916
## [v3.40.1-1] - 2022-07-12
1017
### Changed
1118
- Upgrade Sonatype Nexus to v3.40.1-01; #106
@@ -30,7 +37,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3037

3138
## [v3.34.1-4] - 2021-12-13
3239
### Fixed
33-
- disable jndi lookup due to a vulnerability #90 (https://doc.nexusgroup.com/pages/viewpage.action?pageId=83133294)
40+
- Disable jndi lookup due to a vulnerability #90 (https://doc.nexusgroup.com/pages/viewpage.action?pageId=83133294)
3441

3542
## [v3.34.1-3] - 2021-11-02
3643
### Changed
@@ -80,19 +87,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8087
### Changed
8188
- Update dogu-build-lib to `v1.1.1`
8289
- Update zalenium-build-lib to `v2.1.1`
83-
- toggle video recording with build parameter (#63)
90+
- Toggle video recording with build parameter (#63)
8491

8592
### Removed
86-
- installation of R and Helm plugins. These plugins are a built-in feature now. (#66)
93+
- Installation of R and Helm plugins. These plugins are a built-in feature now. (#66)
8794

8895
## [v3.28.1-3] - 2020-12-14
89-
9096
### Added
91-
9297
- Ability to configure the `MaxRamPercentage` and `MinRamPercentage` for the Nexus process inside the container via `cesapp edit-conf` (#61)
9398

9499
## [v3.28.1-2] - 2020-11-27
95-
96100
### Fixed
97101
- Remove nexus admin password from environment variable. Now, the password is passed via enviroment variable passing only to the respective tools (#59)
98102

@@ -129,54 +133,46 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
129133

130134
## [v3.23.0-4] - 2020-09-04
131135
### Changed
132-
- register missing appenders in logging configuration
136+
- Register missing appenders in logging configuration
133137

134138
## [v3.23.0-3] - 2020-07-24
135139
### Changed
136-
- update dogu-build-lib
137-
- update ces-build-lib
138-
- update java image
139-
- use doguctl validation
140+
- Update dogu-build-lib
141+
- Update ces-build-lib
142+
- Update java image
143+
- Use doguctl validation
140144

141145
## [v3.23.0-2] - 2020-07-02
142146
### Changed
143-
- update carp.yml.tpl to contain log-level and log-format
144-
- update nexus-carp to v1.0.0
147+
- Update carp.yml.tpl to contain log-level and log-format
148+
- Update nexus-carp to v1.0.0
145149

146150
## [v3.23.0-1] - 2020-06-18
147151
### Changed
148-
- updated Nexus version to 3.23.0
149-
- enabled groovy scripting during startup in `nexus.properties`
150-
- update nexus-claim to v1.0.0
152+
- Updated Nexus version to 3.23.0
153+
- Enabled groovy scripting during startup in `nexus.properties`
154+
- Update nexus-claim to v1.0.0
151155

152156
## [3.19.1-2] - 2020-04-15
153157
### Added
154-
155-
A new CES registry key `logging/root` is evaluated to override the default root log level. One of these values can be set in order to increase the log verbosity: `ERROR`, `WARN`, `INFO`, `DEBUG`. These log levels are directly applied to Nexus's logback root appender configuration.
156-
157-
Changing Nexus's log level with different settings at runtime is still supported. Please note that these settings are reset (to the root log level from above) during a restart of the Nexus dogu. (#37)
158+
- A new CES registry key `logging/root` is evaluated to override the default root log level. One of these values can be set in order to increase the log verbosity: `ERROR`, `WARN`, `INFO`, `DEBUG`. These log levels are directly applied to Nexus's logback root appender configuration.
159+
Changing Nexus's log level with different settings at runtime is still supported. Please note that these settings are reset (to the root log level from above) during a restart of the Nexus dogu. (#37)
158160

159161
### Changed
160-
161-
In order to cope with the amount of file system data the max history is set to 7 days worth of Nexus logging, capping the total log size to 10 MBytes. This is only important for Nexus's own Log viewer. Logs to the Cloudogu EcoSystem host are not subject to change though. (#37)
162+
- In order to cope with the amount of file system data the max history is set to 7 days worth of Nexus logging, capping the total log size to 10 MBytes. This is only important for Nexus's own Log viewer. Logs to the Cloudogu EcoSystem host are not subject to change though. (#37)
162163

163164
## Removed
164-
165-
Remove unnecessary log appenders (#37).
165+
- Remove unnecessary log appenders (#37).
166166

167167
### Fixed
168-
169-
Reduce the default root log level to WARN. Nexus's defaults to INFO which leads to an obscene amount of log entries from the underlying Felix framework. (#37)
168+
- Reduce the default root log level to WARN. Nexus's defaults to INFO which leads to an obscene amount of log entries from the underlying Felix framework. (#37)
170169

171170
## [3.19.1-1] - 2019-12-09
172-
173171
### Changed
174-
175172
- Changed Nexus version from 3.18.1 to 3.19.1
176173
- Changed Java version in Dockerfile to 8u222-1
177174

178175
### Added
179-
180176
- Added docker health check
181177
- Add a start-up check whether the minimum number of CPU cores is reached (#36)
182178
- Starting with [Nexus Repository Manager 3.17](https://issues.sonatype.org/secure/ReleaseNote.jspa?projectId=10001&version=17890) a minimum number of 4 CPU cores is enforced, otherwise the Repository Manager is no longer guaranteed to work.

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
FROM registry.cloudogu.com/official/java:8u302-3
33
LABEL maintainer="[email protected]" \
44
NAME="official/nexus" \
5-
VERSION="3.40.1-1"
5+
VERSION="3.40.1-2"
66

77
# The version of nexus to install
88
ENV NEXUS_VERSION=3.40.1-01 \

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
MAKEFILES_VERSION=6.0.3
2-
VERSION=3.40.1-1
2+
VERSION=3.40.1-2
33

44
.DEFAULT_GOAL:=dogu-release
55

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Vorkonfigurierte Nexus Settings
2+
Durch die verwendung von Scripten die zum start des Nexus aufgerufen werden eine *Cleanup Policy* sowie ein *Compact Blobstore Task* angelegt.
3+
4+
## Compact Blobstore Task
5+
Wird in Nexus ein Artefakt zum Löschen vorgesehen (bspw. durch den automatisch laufenden *Cleanup Service Task*) wird das
6+
Artefakt nur zum Löschen markiert. Das endgültige Löschen der Daten aus dem Blobstore übernimmt ein *Compact Blobstore Task,*
7+
welcher aber nicht in der standardkonfiguration von Nexus konfiguriert ist.
8+
Dieser Task wird beim Start der Applikation von dem Skript `nexusSetupCompactBlobstoreTask.groovy` angelegt.
9+
Der Task löscht hierbei Daten (täglich, wenn die standard Konfiguration verwendet wird) aus dem _default_ Blobstore. Falls ein anderer Blobstore konfiguriert werden soll, kann hierfür
10+
der etcd-Schlüssel `config/nexus/compact_blobstore_task/blobstore` angepasst werden.
11+
Dies geht am einfachsten über den cesapp Befehl `cesapp edit-config nexus`.
12+
Mehr Informationen über Tasks sind in der [offiziellen Tasks-Dokumentation](https://help.sonatype.com/repomanager3/nexus-repository-administration/tasks) zu finden.
13+
14+
15+
## Cleanup Policy
16+
Wie auch der oben genannte Task wird eine Policy (`ces-maven-snapshot-cleanuppolicy`) per Skript (`nexusSetupCleanupPolicies.groovy`)
17+
angelegt. Diese Cleanup Policy ist für maven-snapshot Repositorys gedacht. Um sie anzuwenden, muss entweder das Repository manuell konfiguriert werden oder
18+
in einer hcl Konfiguration per `nexus-claim` das Feld `policyName` mit einer Liste aus Policies gefüllt werden die `ces-maven-snapshot-cleanuppolicy` enthält.
19+
20+
```
21+
repository "public" {
22+
_state = "present"
23+
online = true
24+
recipeName = "maven2-hosted"
25+
attributes = {
26+
cleanup = {
27+
policyName = ["ces-maven-snapshot-cleanuppolicy"]
28+
},
29+
30+
...
31+
}
32+
```
33+
34+
Die Policy kann in per `cesapp edit-config nexus` konfiguriert werden. Das Standardintervall für die Policy beträgt 14 Tage.
35+
Mehr Informationen über Cleanup Policies können der [offiziellen Cleanup-Policy-Dokumentation](https://help.sonatype.com/repomanager3/nexus-repository-administration/repository-management/cleanup-policies) entnommen werden.
36+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Preconfigured Nexus settings
2+
By using scripts that are called to start the Nexus, a *Cleanup Policy* and a *Compact Blobstore Task* are created.
3+
4+
## Compact Blobstore Task
5+
If an artifact is scheduled for deletion in Nexus (e.g. by the automatically running *Cleanup Service Task*), the artifact is only **marked** for deletion but not actually deleted.
6+
The final deletion of the data from the Blobstore is done by a *Compact Blobstore Task,*
7+
which is not configured in the default Nexus configuration.
8+
This task is created by the script `nexusSetupCompactBlobstoreTask.groovy` when the application is started.
9+
The task deletes data daily (in its standard configuration) from the _default_ blobstore. If you want to configure a different blobstore, you can do this by
10+
modifying the etcd key `config/nexus/compact_blobstore_task/blobstore`.
11+
The easiest way to do this is to use the cesapp command `cesapp edit-config nexus`.
12+
13+
More information about tasks can be found in the [official task-documentation](https://help.sonatype.com/repomanager3/nexus-repository-administration/tasks).
14+
15+
16+
## Cleanup Policy
17+
Like the task mentioned above, a policy (`ces-maven-snapshot-cleanuppolicy`) is created by script (`nexusSetupCleanupPolicies.groovy`).
18+
This cleanup policy is intended for maven-snapshot repositories. To apply it, either the repository has to be configured manually or
19+
in a hcl configuration via `nexus-claim` the field `policyName` must be filled with a list of policies containing `ces-maven-snapshot-cleanuppolicy`.
20+
21+
```
22+
repository "public" {
23+
_state = "present
24+
online = true
25+
recipeName = "maven2-hosted
26+
attributes = {
27+
cleanup = {
28+
policyName = ["ces-maven-snapshot-cleanuppolicy"]
29+
},
30+
31+
...
32+
}
33+
```
34+
35+
The policy can be configured via `cesapp edit-config nexus` command. The default intervall for the cleanup policy is 14 days.
36+
More information about cleanup policies can be found in the [official cleanup-policy-documentation](https://help.sonatype.com/repomanager3/nexus-repository-administration/repository-management/cleanup-policies).

dogu.json

+80-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"Name": "official/nexus",
3-
"Version": "3.40.1-1",
3+
"Version": "3.40.1-2",
44
"DisplayName": "Sonatype Nexus",
55
"Description": "The Nexus Repository is like the local warehouse where all of the parts and finished goods used in your software supply chain are stored and distributed.",
66
"Url": "http://www.sonatype.org/nexus",
@@ -81,7 +81,7 @@
8181
},
8282
{
8383
"Name": "logging/root",
84-
"Description": "Set the root log level to one of ERROR, WARN, INFO, DEBUG.",
84+
"Description": "Set the root log level to one of ERROR, WARN, INFO, DEBUG. The default log level is set to \"WARN\"",
8585
"Optional": true,
8686
"Default": "WARN",
8787
"Validation": {
@@ -127,6 +127,84 @@
127127
"Validation": {
128128
"Type": "FLOAT_PERCENTAGE_HUNDRED"
129129
}
130+
},
131+
{
132+
"Name": "cleanup_policy/notes",
133+
"Description": "Notes to the default cleanup-policy. Default: \"Do not edit. CES will re-generate this default policy during each Nexus start-up that will overwrite your changes. You may want to create your own policies which will stay untouched during the start-up.\"",
134+
"Optional": true,
135+
"Default": "Do not edit. CES will re-generate this default policy during each Nexus start-up that will overwrite your changes. You may want to create your own policies which will stay untouched during the start-up."
136+
},
137+
{
138+
"Name": "cleanup_policy/policy_format",
139+
"Description": "Repository format on which the default cleanup-policy can be applied. The default is \"maven2\" which corresponds to maven repositories",
140+
"Optional": true,
141+
"Default": "maven2",
142+
"Validation": {
143+
"Type": "ONE_OF",
144+
"Values": [
145+
"apt",
146+
"bower",
147+
"cocoapods",
148+
"conan",
149+
"conda",
150+
"docker",
151+
"gitlfs",
152+
"go",
153+
"helm",
154+
"maven2",
155+
"npm",
156+
"nuget",
157+
"p2",
158+
"pypi",
159+
"r",
160+
"raw",
161+
"rubygems",
162+
"yum"
163+
]
164+
}
165+
},
166+
{
167+
"Name": "cleanup_policy/criteria/regex",
168+
"Description": "Regex which will be used to match fitting artifacts. Default: \".*SNAPSHOT\"",
169+
"Optional": true,
170+
"Default": ".*SNAPSHOT"
171+
},
172+
{
173+
"Name": "cleanup_policy/criteria/release_type",
174+
"Description": "The release type on which this policy will be applied. This configuration can only be applied if the 'policy_format' is of type \"maven2\", \"yum\" and \"npm\". Default: \"PRERELEASES\"",
175+
"Optional": true,
176+
"Default": "PRERELEASES"
177+
},
178+
{
179+
"Name": "cleanup_policy/criteria/days_till_recognition_for_delete",
180+
"Description": "The number of days after which an artifact is recognised for deletion. Default: \"14\"",
181+
"Optional": true,
182+
"Default": "14"
183+
},
184+
{
185+
"Name": "compact_blobstore_task/enabled",
186+
"Description": "Switch to control whether the policy should be switched on or off. Default: \"true\"",
187+
"Optional": true,
188+
"Default": "true",
189+
"Validation": {
190+
"Type": "ONE_OF",
191+
"Values": [
192+
"true",
193+
"false"
194+
]
195+
}
196+
},
197+
{
198+
"Name": "compact_blobstore_task/blobstore",
199+
"Description": "The specific blobstore instance to that the task should be applied. This configuration should only be used if the task type is 'blobstore.compact' (or other tasks that need to choose a blobstore instance). Default: \"default\"",
200+
"Optional": true,
201+
"Default": "default"
202+
},
203+
{
204+
"Name": "compact_blobstore_task/cron",
205+
"Description": "Cron string (in Quartz syntax) that sets the task's schedule. The default \"0 0 3 * * ?\" value will run the task daily at 3:00 AM.",
206+
"Optional": true,
207+
"Default": "0 0 3 * * ?"
130208
}
131209
],
132210
"HealthChecks": [
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "ces-default-cleanuppolicy",
3+
"notes": "{{ .Config.GetOrDefault "cleanup_policy/notes" "Default policy that is generated by the ces via a script on nexus startup"}}",
4+
"mode": "deletion",
5+
"format": "{{ .Config.GetOrDefault "cleanup_policy/policy_format" "maven2"}}",
6+
"criteria": {
7+
"regex": "{{ .Config.GetOrDefault "cleanup_policy/criteria/regex" ".*SNAPSHOT"}}",
8+
"criteriaReleaseType": "{{ .Config.GetOrDefault "cleanup_policy/criteria/release_type" "PRERELEASES"}}",
9+
"criteriaLastBlobUpdated": "{{ .Config.GetOrDefault "cleanup_policy/criteria/days_till_recognition_for_delete" "14"}}"
10+
}
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "blobstore.compact",
3+
"enabled": "{{ .Config.GetOrDefault "compact_blobstore_task/enabled" "true"}}",
4+
"blobstore": "{{ .Config.GetOrDefault "compact_blobstore_task/blobstore" "default"}}" ,
5+
"name": "default CES compact blobstore task" ,
6+
"cron": "{{ .Config.GetOrDefault "compact_blobstore_task/cron" "0 0 3 * * ?"}}"
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import org.sonatype.nexus.cleanup.storage.CleanupPolicyStorage
2+
import groovy.json.JsonSlurper
3+
4+
import static org.sonatype.nexus.repository.search.DefaultComponentMetadataProducer.IS_PRERELEASE_KEY
5+
import static org.sonatype.nexus.repository.search.DefaultComponentMetadataProducer.LAST_BLOB_UPDATED_KEY
6+
import static org.sonatype.nexus.repository.search.DefaultComponentMetadataProducer.REGEX_KEY
7+
8+
// get parameters from payload JSON file
9+
def configurationParameters = new JsonSlurper().parseText(args)
10+
11+
def Integer asSeconds(Integer days) {
12+
return days * 60 * 60 * 24
13+
}
14+
15+
def String asStringSeconds(String daysString) {
16+
return String.valueOf(asSeconds(Integer.parseInt(daysString)))
17+
}
18+
19+
/**
20+
* this script is called in startup.sh and creates a cleanup
21+
* @return
22+
*/
23+
def createMavenSnapshotCleanupPolicy(configurationParameters) {
24+
def policyStorage = container.lookup(CleanupPolicyStorage.class.getName())
25+
26+
def cleanupPolicy = policyStorage.newCleanupPolicy()
27+
cleanupPolicy.setName(configurationParameters.name)
28+
cleanupPolicy.setNotes(configurationParameters.notes)
29+
cleanupPolicy.setMode(configurationParameters.mode)
30+
cleanupPolicy.setFormat(configurationParameters.format)
31+
32+
def criteriaMap = [:]
33+
criteriaMap.put(REGEX_KEY, configurationParameters.criteria.regex) // criteriaAssetRegex
34+
if (configurationParameters.criteria.criteriaReleaseType != "") {
35+
// We do a additional check here as the criteriaReleaseType is not supported for every kind of repository
36+
// and should therefore be only set if a value is present.
37+
// see: https://help.sonatype.com/repomanager3/nexus-repository-administration/repository-management/cleanup-policies
38+
criteriaMap.put(IS_PRERELEASE_KEY, "PRERELEASES".equals(configurationParameters.criteria.criteriaReleaseType).toString())
39+
}
40+
criteriaMap.put(LAST_BLOB_UPDATED_KEY, asStringSeconds(configurationParameters.criteria.criteriaLastBlobUpdated))
41+
42+
cleanupPolicy.setCriteria(criteriaMap)
43+
44+
deleteCleanupPolicyIfExists(configurationParameters.name)
45+
policyStorage.add(cleanupPolicy)
46+
}
47+
48+
def deleteCleanupPolicyIfExists(String name) {
49+
def cleanupPolicyStorage = container.lookup(CleanupPolicyStorage.class.getName())
50+
if (cleanupPolicyStorage.exists(name)) {
51+
cleanupPolicyStorage.remove(cleanupPolicyStorage.get(name))
52+
}
53+
}
54+
55+
// start
56+
createMavenSnapshotCleanupPolicy(configurationParameters)

0 commit comments

Comments
 (0)