@@ -37,36 +37,23 @@ class JsmDevDeployment implements Deployment {
37
37
JsmDevDeployment (String jiraBaseUrl , String dockerHost , String dockerCertPath , ArrayList<String > srcCodePaths ) {
38
38
39
39
componentsPrefix = AllureContainer . extractDomainFromUrl(jiraBaseUrl)
40
+ subDeployments. add(new JsmH2Deployment (jiraBaseUrl, dockerHost, dockerCertPath))
41
+
40
42
41
43
allureContainer = new AllureContainer (dockerHost, dockerCertPath)
42
44
allureContainer. containerName = componentsPrefix + " -reporter"
43
45
dockerClient = allureContainer. dockerClient
44
46
45
-
46
- allureReportVolume = dockerClient. getOrCreateVolume(componentsPrefix + " -allureReports" )
47
- jiraReportVolume = dockerClient. getOrCreateVolume(componentsPrefix + " -jiraReports" )
48
- allureContainer. prepareCustomEnvVar([" CHECK_RESULTS_EVERY_SECONDS=3" , " KEEP_HISTORY=1" , " KEEP_HISTORY_LATEST=30" ])
49
- allureContainer. setResultsVolume(allureReportVolume. name)
50
-
51
-
52
- srcCodeVolume = dockerClient. getOrCreateVolume(componentsPrefix + " -code" )
53
47
srcSyncer = DirectorySyncer . getDuplicateContainer(dockerClient, " SrcSyncer" )
54
- this . srcCodePaths = srcCodePaths
48
+ reportSyncer = DirectorySyncer . getDuplicateContainer(dockerClient, " ReportSyncer " )
55
49
56
- if (srcSyncer?. created) {
57
- log. warn(" Old SrcSyncer container exists, removing it before proceeding" )
58
- srcSyncer. stopAndRemoveContainer()
59
- srcSyncer = null
60
- }
61
50
62
51
63
- subDeployments. add(new JsmH2Deployment (jiraBaseUrl, dockerHost, dockerCertPath))
64
- jsmDeployment. jsmContainer. prepareVolumeMount(srcCodeVolume. name, " /var/atlassian/application-data/jira/scripts/" , false )
65
- jsmDeployment. jsmContainer. prepareVolumeMount(jiraReportVolume. name, " /var/atlassian/application-data/jira/allure-results/" , false )
66
-
52
+ this . srcCodePaths = srcCodePaths
67
53
68
54
}
69
55
56
+
70
57
JsmH2Deployment getJsmDeployment () {
71
58
return subDeployments. find { it instanceof JsmH2Deployment } as JsmH2Deployment
72
59
}
@@ -93,7 +80,8 @@ class JsmDevDeployment implements Deployment {
93
80
94
81
try {
95
82
jsmSnapshotVolume = jsmContainer. getSnapshotVolume()
96
- }catch (ignored){}
83
+ } catch (ignored) {
84
+ }
97
85
98
86
99
87
Boolean success = Deployment . super . stopAndRemoveDeployment()
@@ -120,21 +108,35 @@ class JsmDevDeployment implements Deployment {
120
108
boolean setupDeployment () {
121
109
122
110
123
- srcSyncer = DirectorySyncer . createSyncToVolume(srcCodePaths, srcCodeVolume. name, " SrcSyncer" , " -avh --chown=2001:2001" )
111
+
112
+ srcCodeVolume = dockerClient. getOrCreateVolume(componentsPrefix + " -code" )
113
+ allureReportVolume = dockerClient. getOrCreateVolume(componentsPrefix + " -allureReports" )
114
+ jiraReportVolume = dockerClient. getOrCreateVolume(componentsPrefix + " -jiraReports" )
124
115
125
116
117
+ srcSyncer = DirectorySyncer . createSyncToVolume(srcCodePaths, srcCodeVolume. name, " SrcSyncer" , " -avh --chown=2001:2001" )
126
118
reportSyncer = DirectorySyncer . syncBetweenVolumesAndUsers(jiraReportVolume. name, allureReportVolume. name, " 1000:1000" , " ReportSyncer" )
127
119
128
120
121
+ allureContainer. prepareCustomEnvVar([" CHECK_RESULTS_EVERY_SECONDS=3" , " KEEP_HISTORY=1" , " KEEP_HISTORY_LATEST=30" ])
122
+ allureContainer. setResultsVolume(allureReportVolume. name)
123
+
124
+
129
125
allureContainer. created ?: allureContainer. createContainer()
130
126
allureContainer. startContainer()
131
127
128
+ if (! jsmDeployment. jsmContainer. created) {
129
+ jsmDeployment. jsmContainer. prepareVolumeMount(srcCodeVolume. name, " /var/atlassian/application-data/jira/scripts/" , false )
130
+ jsmDeployment. jsmContainer. prepareVolumeMount(jiraReportVolume. name, " /var/atlassian/application-data/jira/allure-results/" , false )
131
+
132
+ }
133
+
132
134
jsmDeployment. setupDeployment(builder. useSnapshotIfAvailable, builder. snapshotAfterCreation)
133
135
// Change owner of the mounted volume
134
136
jsmContainer. runBashCommandInContainer(" chown -R jira:jira /var/atlassian/application-data/jira/allure-results" , 10 , " root" )
135
137
136
138
if (jsmDeployment. jiraRest. scriptRunnerIsInstalled()) {
137
- jsmDeployment. jiraRest. deploySpockEndpoint([' com.riadalabs.jira.plugins.insight' ])
139
+ jsmDeployment. jiraRest. deploySpockEndpoint([' com.riadalabs.jira.plugins.insight' ])
138
140
}
139
141
140
142
}
@@ -197,12 +199,12 @@ class JsmDevDeployment implements Deployment {
197
199
return this
198
200
}
199
201
200
- Builder useSnapshotIfAvailable ( ) {
202
+ Builder useSnapshotIfAvailable () {
201
203
this . useSnapshotIfAvailable = true
202
204
return this
203
205
}
204
206
205
- Builder snapshotAfterCreation ( ) {
207
+ Builder snapshotAfterCreation () {
206
208
this . snapshotAfterCreation = true
207
209
return this
208
210
}
0 commit comments