Skip to content

Commit 2eb5f35

Browse files
authored
Prepare release 4.10.0 (#1352)
1 parent cc03bc1 commit 2eb5f35

3 files changed

Lines changed: 167 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,17 @@
44

55
### Added
66

7-
87
### Changed
9-
- Update Aqua cli to 760 ([#1344](https://github.com/opendevstack/ods-core/pull/1344))
8+
- Adapted Sonarqube server configuration to make projects private and have custom gate ([#1347](https://github.com/opendevstack/ods-core/pull/1347))
109

1110
### Fixed
1211

12+
## [4.10.0] - 2025-10-08
13+
### Added
14+
- Added post creation process ([#1351](https://github.com/opendevstack/ods-core/pull/1351))
15+
16+
## Changed
17+
- Update Aqua cli to 760 ([#1344](https://github.com/opendevstack/ods-core/pull/1344))
1318

1419
## [4.9.1] - 2025-10-08
1520
### Changed

configuration-sample/ods-core.env.sample

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,8 @@ JENKINS_AGENT_BASE_SNYK_DISTRIBUTION_URL=https://github.com/snyk/snyk/releases/d
273273
# Releases are published at https://download.aquasec.com/scanner
274274
# Check Aqua versions backward compatibility at https://docs.aquasec.com/docs/version-compatibility-of-components#section-backward-compatibility-across-two-major-versions
275275
# To Download the aquaSec scanner cli and check their documentaion requires a valid account on aquasec.com
276-
# Latest tested version is 2022.4.720
277-
# Example: https://<USER>:<PASSWORD>@download.aquasec.com/scanner/2022.4.759/scannercli
276+
# Latest tested version is 2022.4.760
277+
# Example: https://<USER>:<PASSWORD>@download.aquasec.com/scanner/2022.4.760/scannercli
278278
JENKINS_AGENT_BASE_AQUASEC_SCANNERCLI_URL=
279279

280280
# Repository of shared library
@@ -460,3 +460,19 @@ OPENTELEMETRY_COLLECTOR_MEMORY_REQUEST=128Mi
460460
OPENTELEMETRY_COLLECTOR_CPU_LIMIT=1
461461
OPENTELEMETRY_COLLECTOR_MEMORY_LIMIT=256Mi
462462

463+
#################################
464+
# Post-Creation Scripts Config #
465+
#################################
466+
467+
# Enable or disable post-creation script execution
468+
POST_CREATION_SCRIPTS_ENABLED=false
469+
470+
### Configuration ####
471+
POST_CREATION_SCRIPTS_CONFIG_REPO_URL=changeme
472+
POST_CREATION_SCRIPTS_CONFIG_REPO_BRANCH=master
473+
POST_CREATION_SCRIPTS_CONFIG_FILE=post-project-creation-scripts.env
474+
475+
### Scripts ####
476+
POST_CREATION_SCRIPTS_REPO_URL=changeme
477+
POST_CREATION_SCRIPTS_BRANCH=master
478+
POST_CREATION_SCRIPTS_ORDER=01.sh,02.sh

create-projects/Jenkinsfile

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,5 +102,147 @@ podTemplate(
102102
)
103103
}
104104
}
105+
106+
stage('Setup Post-Creation Scripts') {
107+
// Load post-creation scripts configuration
108+
def postCreationEnabled = getConfigValue('POST_CREATION_SCRIPTS_ENABLED', 'ods-configuration/ods-core.env', 'false')
109+
110+
if (!postCreationEnabled || postCreationEnabled != 'true') {
111+
echo("Post-creation scripts are disabled or not configured. Skipping setup.")
112+
env.POST_SCRIPTS_ENABLED = 'false'
113+
return
114+
}
115+
116+
def scriptsOrder = getConfigValue('POST_CREATION_SCRIPTS_ORDER', 'ods-configuration/ods-core.env').trim()
117+
if (!scriptsOrder || scriptsOrder.trim().isEmpty()) {
118+
echo("No scripts specified in POST_CREATION_SCRIPTS_ORDER. Skipping setup.")
119+
env.POST_SCRIPTS_ENABLED = 'false'
120+
return
121+
}
122+
123+
echo("Post-creation scripts are enabled. Retrieving configuration...")
124+
125+
// Get scripts repository configuration
126+
def scriptsRepoUrl = getConfigValue('POST_CREATION_SCRIPTS_REPO_URL', 'ods-configuration/ods-core.env')
127+
def scriptsBranch = getConfigValue('POST_CREATION_SCRIPTS_BRANCH', 'ods-configuration/ods-core.env', 'master')
128+
def scriptsConfigFile = getConfigValue('POST_CREATION_SCRIPTS_CONFIG_FILE', 'ods-configuration/ods-core.env')
129+
130+
def configRepoUrl = getConfigValue('POST_CREATION_SCRIPTS_CONFIG_REPO_URL', 'ods-configuration/ods-core.env')
131+
def configRepoBranch = getConfigValue('POST_CREATION_SCRIPTS_CONFIG_REPO_BRANCH', 'ods-configuration/ods-core.env', 'master')
132+
133+
// Check if required configuration is missing
134+
if (!scriptsRepoUrl || scriptsRepoUrl.trim().isEmpty()) {
135+
echo("POST_CREATION_SCRIPTS_REPO_URL is not configured. Skipping setup.")
136+
env.POST_SCRIPTS_ENABLED = 'false'
137+
return
138+
}
139+
140+
if (!scriptsConfigFile || scriptsConfigFile.trim().isEmpty()) {
141+
echo("POST_CREATION_SCRIPTS_CONFIG_FILE is not configured. Skipping setup.")
142+
env.POST_SCRIPTS_ENABLED = 'false'
143+
return
144+
}
145+
146+
echo("Scripts repository: ${scriptsRepoUrl}")
147+
echo("Scripts branch: ${scriptsBranch}")
148+
echo("Scripts order: ${scriptsOrder}")
149+
echo("Scripts config file: ${scriptsConfigFile}")
150+
echo("Config repo URL: ${configRepoUrl}")
151+
echo("Config repo branch: ${configRepoBranch}")
152+
153+
def credentialsId = "${pipelineOpenShiftProject}-cd-user-with-password"
154+
155+
// Clone the scripts repository
156+
checkout([
157+
$class: 'GitSCM',
158+
branches: [[name: "*/${scriptsBranch}"]],
159+
doGenerateSubmoduleConfigurations: false,
160+
extensions: [[
161+
$class: 'RelativeTargetDirectory',
162+
relativeTargetDir: 'post-creation-scripts'
163+
]],
164+
submoduleCfg: [],
165+
userRemoteConfigs: [[
166+
credentialsId: "${credentialsId}",
167+
url: "${scriptsRepoUrl}"
168+
]]
169+
])
170+
171+
checkout([
172+
$class: 'GitSCM',
173+
branches: [[name: "*/${configRepoBranch}"]],
174+
doGenerateSubmoduleConfigurations: false,
175+
extensions: [[
176+
$class: 'RelativeTargetDirectory',
177+
relativeTargetDir: 'post-creation-config'
178+
]],
179+
submoduleCfg: [],
180+
userRemoteConfigs: [[
181+
credentialsId: "${credentialsId}",
182+
url: "${configRepoUrl}"
183+
]]
184+
])
185+
186+
// Store configuration for next stage
187+
env.POST_SCRIPTS_ENABLED = 'true'
188+
env.POST_SCRIPTS_ORDER = scriptsOrder
189+
env.POST_SCRIPTS_CONFIG_FILE = scriptsConfigFile
190+
}
191+
192+
stage('Execute Post-Creation Scripts') {
193+
dir('post-creation-scripts') {
194+
195+
if (env.POST_SCRIPTS_ENABLED != 'true') {
196+
echo("Post-creation scripts execution is disabled. Skipping.")
197+
return
198+
}
199+
200+
def credentialsId = "${odsNamespace}-cd-user-with-password"
201+
202+
def scripts = env.POST_SCRIPTS_ORDER.split(',')
203+
def odsConfigPath = "${env.WORKSPACE}/ods-configuration/ods-core.env"
204+
def scriptsConfigPath = "${env.WORKSPACE}/post-creation-config/${env.POST_SCRIPTS_CONFIG_FILE}"
205+
206+
withCredentials([usernamePassword(credentialsId: "${credentialsId}", passwordVariable: 'password', usernameVariable: 'username')]) {
207+
withEnv([
208+
"PROJECT_ID=${projectId}",
209+
"PROJECT_GROUPS=${projectGroups}",
210+
"PROJECT_ADMIN=${projectAdmins}",
211+
"ODS_NAMESPACE=${odsNamespace}",
212+
"ODS_IMAGE_TAG=${odsImageTag}",
213+
"ODS_GIT_REF=${odsGitRef}",
214+
"ODS_BITBUCKET_PROJECT=${odsBitbucketProject}",
215+
"BITBUCKET_URL=${bitbucketUrl}",
216+
"DOCKER_REGISTRY=${dockerRegistry}",
217+
"CD_USERNAME=${username}",
218+
"CD_PASSWORD=${password}",
219+
"CD_USER_CREDENTIALS_ID=${credentialsId}"
220+
]) {
221+
echo("Environment variables for scripts:")
222+
223+
for (script in scripts) {
224+
def scriptName = script.trim()
225+
def scriptPath = "post-project-creation/${scriptName}"
226+
227+
echo("Executing script: ${scriptName}")
228+
229+
sh(
230+
script: """
231+
"${scriptPath}" "${odsConfigPath}" "${scriptsConfigPath}"
232+
""",
233+
label: "Execute script: ${scriptName}"
234+
)
235+
}
236+
}
237+
}
238+
}
239+
}
105240
}
106241
}
242+
243+
def getConfigValue(field, file, defaultValue = '') {
244+
return sh(
245+
script: "grep '^${field}=' ${file} | cut -d'=' -f2 | tr -d '\"' || echo '${defaultValue}'",
246+
returnStdout: true
247+
).trim()
248+
}

0 commit comments

Comments
 (0)