+// Generate and upload the helm chart
+def HelmChart(helm_chart_upload, version) {
+ return {
+ parallel(
+ 'Helm Chart': {
+ stage('Generate Helm Chart') {
+ def context = 'Generate Helm Chart'
+ def command = "make generate-helm-chart VERSION=${version}"
+ try {
+ SetBuildStatus(in_progress, context, pending)
+ ExecSh(command).call()
+ SetBuildStatus(completed, context, success)
+ } catch (Exception e) {
+ SetBuildStatus(failed, context, failure)
+ Error("${exception_message_exec} ${command}").call()
+ }
+ }
+ stage('Upload Helm Chart') {
+ if (helm_chart_upload == true) {
+ withCredentials([string(credentialsId: 'nsm-nordix-artifactory-api-key', variable: 'API_KEY')]) {
+ ExecSh("""
+ charts=\$(cd _output/helm/ && ls *.tgz)
+ for chart in \$charts
+ do
+ curl -H 'X-JFrog-Art-Api:${API_KEY}' -T _output/helm/\$chart \"https://artifactory.nordix.org/artifactory/cloud-native/meridio/\$chart\"
+ done
+ """).call()
+ }
+ } else {
+ Utils.markStageSkippedForConditional('Upload Helm Chart')
+ }
+ }
+ }
+ )
+ }
+}
+
+// Run the security scan job
+def SecurityScan(current_branch, version) {
+ return {
+ build job: 'meridio-periodic-security-scan', parameters: [
+ string(name: 'IMAGE_VERSION', value: "$version"),
+ string(name: 'CURRENT_BRANCH', value: "$current_branch"),
+ string(name: 'DRY_RUN', value: env.DRY_RUN)
+ ], wait: true
+ }
+}
+