-
Notifications
You must be signed in to change notification settings - Fork 21
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
1 parent
1f504e8
commit 8adea2f
Showing
1 changed file
with
54 additions
and
49 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,65 +21,70 @@ | |
package devops.jobs | ||
import static org.edx.jenkins.dsl.Constants.common_logrotator | ||
|
||
class SAMLSSLExpirationCheck{ | ||
public static def job = { dslFactory, extraVars -> | ||
assert extraVars.containsKey('DEPLOYMENTS') : "Please define DEPLOYMENTS. It should be a list of strings." | ||
assert !(extraVars.get('DEPLOYMENTS') instanceof String) : "Make sure DEPLOYMENTS is a list and not a string" | ||
extraVars.get('DEPLOYMENTS').each { deployment, configuration -> | ||
configuration.environments.each { environment, inner_config -> | ||
dslFactory.job(extraVars.get("FOLDER_NAME","Monitoring") + "/saml-ssl-expiration-check-${environment}-${deployment}") { | ||
logRotator common_logrotator | ||
class SAMLSSLExpirationCheck { | ||
public static def job = { | ||
dslFactory, | ||
extraVars -> | ||
assert extraVars.containsKey('DEPLOYMENTS'): "Please define DEPLOYMENTS. It should be a list of strings." | ||
assert!(extraVars.get('DEPLOYMENTS') instanceof String): "Make sure DEPLOYMENTS is a list and not a string" | ||
extraVars.get('DEPLOYMENTS').each { | ||
deployment, | ||
configuration -> | ||
configuration.environments.each { | ||
environment, | ||
inner_config -> | ||
dslFactory.job(extraVars.get("FOLDER_NAME", "Monitoring") + "/saml-ssl-expiration-check-${environment}-${deployment}") { | ||
logRotator common_logrotator | ||
|
||
def gitCredentialId = extraVars.get('SECURE_GIT_CREDENTIALS', '') | ||
|
||
def gitCredentialId = extraVars.get('SECURE_GIT_CREDENTIALS','') | ||
parameters { | ||
stringParam('MONITORING_SCRIPTS_REPO', extraVars.get('MONITORING_SCRIPTS_REPO', '[email protected]:edx/monitoring-scripts.git'), | ||
'Git repo containing edX monitoring scripts, which contains the ssl expiration check script.') | ||
stringParam('MONITORING_SCRIPTS_BRANCH', extraVars.get('MONITORING_SCRIPTS_BRANCH', 'master'), | ||
'e.g. tagname or origin/branchname') | ||
} | ||
|
||
parameters{ | ||
stringParam('MONITORING_SCRIPTS_REPO', extraVars.get('MONITORING_SCRIPTS_REPO', '[email protected]:edx/monitoring-scripts.git'), | ||
'Git repo containing edX monitoring scripts, which contains the ssl expiration check script.') | ||
stringParam('MONITORING_SCRIPTS_BRANCH', extraVars.get('MONITORING_SCRIPTS_BRANCH', 'master'), | ||
'e.g. tagname or origin/branchname') | ||
} | ||
|
||
multiscm{ | ||
git { | ||
remote { | ||
url('$MONITORING_SCRIPTS_REPO') | ||
branch('$MONITORING_SCRIPTS_BRANCH') | ||
if (gitCredentialId) { | ||
credentials(gitCredentialId) | ||
} | ||
} | ||
extensions { | ||
cleanAfterCheckout() | ||
pruneBranches() | ||
relativeTargetDirectory('monitoring-scripts') | ||
} | ||
} | ||
multiscm { | ||
git { | ||
remote { | ||
url('$MONITORING_SCRIPTS_REPO') | ||
branch('$MONITORING_SCRIPTS_BRANCH') | ||
if (gitCredentialId) { | ||
credentials(gitCredentialId) | ||
} | ||
} | ||
extensions { | ||
cleanAfterCheckout() | ||
pruneBranches() | ||
relativeTargetDirectory('monitoring-scripts') | ||
} | ||
} | ||
} | ||
|
||
|
||
triggers { | ||
cron("H 15 * * * ") | ||
} | ||
|
||
environmentVariables { | ||
env('REGION', extraVars.get('REGION', 'us-east-1')) | ||
env('DAYS', extraVars.get('DAYS', 90)) | ||
env('SAML_SECRET', inner_config.get('saml_secret')) | ||
env('SECRET_KEY', inner_config.get('secret_key')) | ||
} | ||
triggers { | ||
cron("H 15 * * * ") | ||
} | ||
|
||
steps { | ||
shell(dslFactory.readFileFromWorkspace('devops/resources/saml-ssl-expiration-check.sh')) | ||
} | ||
environmentVariables { | ||
env('REGION', extraVars.get('REGION', 'us-east-1')) | ||
env('DAYS', extraVars.get('DAYS', 90)) | ||
env('SAML_SECRET', inner_config.get('saml_secret')) | ||
env('SECRET_KEY', inner_config.get('secret_key')) | ||
} | ||
|
||
if (extraVars.get('NOTIFY_ON_FAILURE')) { | ||
publishers { | ||
mailer(extraVars.get('NOTIFY_ON_FAILURE'), false, false) | ||
steps { | ||
shell(dslFactory.readFileFromWorkspace('devops/resources/saml-ssl-expiration-check.sh')) | ||
} | ||
} | ||
|
||
if (extraVars.get('NOTIFY_ON_FAILURE')) { | ||
publishers { | ||
mailer(extraVars.get('NOTIFY_ON_FAILURE'), false, false) | ||
} | ||
} | ||
|
||
} | ||
} | ||
} | ||
} | ||
} |