-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathDBTSourceFreshness.groovy
53 lines (51 loc) · 2.48 KB
/
DBTSourceFreshness.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package analytics
import static org.edx.jenkins.dsl.AnalyticsConstants.secure_scm
import static org.edx.jenkins.dsl.AnalyticsConstants.common_log_rotator
import static org.edx.jenkins.dsl.AnalyticsConstants.common_wrappers
import static org.edx.jenkins.dsl.AnalyticsConstants.common_publishers
import static org.edx.jenkins.dsl.AnalyticsConstants.common_triggers
import static org.edx.jenkins.dsl.AnalyticsConstants.secure_scm_parameters
class DBTSourceFreshness{
public static def job = { dslFactory, allVars ->
dslFactory.job("dbt-source-freshness"){
logRotator common_log_rotator(allVars)
parameters secure_scm_parameters(allVars)
parameters {
stringParam('WAREHOUSE_TRANSFORMS_URL', allVars.get('WAREHOUSE_TRANSFORMS_URL'), 'URL for the warehouse-transforms repository.')
stringParam('WAREHOUSE_TRANSFORMS_BRANCH', allVars.get('WAREHOUSE_TRANSFORMS_BRANCH'), 'Branch of warehouse-transforms repository to use.')
stringParam('DBT_TARGET', allVars.get('DBT_TARGET'), 'DBT target from profiles.yml in analytics-secure.')
stringParam('DBT_PROFILE', allVars.get('DBT_PROFILE'), 'DBT profile from profiles.yml in analytics-secure.')
stringParam('NOTIFY', allVars.get('NOTIFY','$PAGER_NOTIFY'), 'Space separated list of emails to send notifications to.')
}
multiscm secure_scm(allVars) << {
git {
remote {
url('$WAREHOUSE_TRANSFORMS_URL')
branch('$WAREHOUSE_TRANSFORMS_BRANCH')
credentials('1')
}
extensions {
relativeTargetDirectory('warehouse-transforms')
pruneBranches()
cleanAfterCheckout()
}
}
}
triggers common_triggers(allVars)
wrappers {
colorizeOutput('xterm')
}
wrappers common_wrappers(allVars)
publishers {
postBuildTask {
task('WARN freshness', 'exit 1', true)
}
}
publishers common_publishers(allVars)
steps {
shell(dslFactory.readFileFromWorkspace('dataeng/resources/secrets-manager-setup.sh'))
shell(dslFactory.readFileFromWorkspace('dataeng/resources/dbtsource-freshness.sh'))
}
}
}
}