forked from HL7/fhir-ig-publisher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nightly-xig-pipeline.yml
167 lines (146 loc) · 4.91 KB
/
nightly-xig-pipeline.yml
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
trigger: none
pr: none
schedules:
- cron: "0 0 * * *"
displayName: "nightly-xig-build-process"
branches:
include:
- master
always: true # whether to always run the pipeline or only if there have been source code changes since the last successful scheduled run. The default is false.
pool:
vmImage: ubuntu-latest
variables:
- group: XIG_VARIABLE_GROUP
- name: XIG_CACHE_FOLDER
value: $(Pipeline.Workspace)/xig_cache
- name: XIG_DB_FOLDER
value: $(Pipeline.Workspace)/xig_db
- name: XIG_DB_FILE
value: xig.db
jobs:
- job: xig_step_1
timeoutInMinutes: 70
steps:
- task: Bash@3
displayName: 'Download latest publisher'
inputs:
targetType: 'inline'
script: 'wget https://github.com/HL7/fhir-ig-publisher/releases/latest/download/publisher.jar'
- task: Bash@3
displayName: 'Make db folder'
inputs:
targetType: 'inline'
script: 'mkdir $(XIG_DB_FOLDER)'
- task: Bash@3
displayName: 'Make cache folder'
inputs:
targetType: 'inline'
script: 'mkdir $(XIG_CACHE_FOLDER)'
- task: Bash@3
displayName: 'Run publisher with xig param step 1'
inputs:
targetType: 'inline'
script: 'java -Xmx7168m -jar ./publisher.jar -xig $(XIG_DB_FOLDER)/$(XIG_DB_FILE) -xig-cache $(XIG_CACHE_FOLDER) -xig-step 1'
- task: PublishPipelineArtifact@1
inputs:
targetPath: $(XIG_DB_FOLDER)
artifactName: xig_step_1_db
- task: PublishPipelineArtifact@1
inputs:
targetPath: $(XIG_CACHE_FOLDER)
artifactName: xig_step_1_cache
- job: xig_step_2
dependsOn: xig_step_1
steps:
- task: Bash@3
displayName: 'Download latest publisher'
inputs:
targetType: 'inline'
script: 'wget https://github.com/HL7/fhir-ig-publisher/releases/latest/download/publisher.jar'
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'current'
artifactName: xig_step_1_cache
targetPath: $(XIG_CACHE_FOLDER)
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'current'
artifactName: xig_step_1_db
targetPath: $(XIG_DB_FOLDER)
- task: Bash@3
displayName: 'Run publisher with xig param step 2'
inputs:
targetType: 'inline'
script: 'java -Xmx7168m -jar ./publisher.jar -xig $(XIG_DB_FOLDER)/$(XIG_DB_FILE) -xig-cache $(XIG_CACHE_FOLDER) -xig-step 2'
- task: PublishPipelineArtifact@1
inputs:
targetPath: $(XIG_DB_FOLDER)
artifactName: xig_step_2_db
- task: PublishPipelineArtifact@1
inputs:
targetPath: $(XIG_CACHE_FOLDER)
artifactName: xig_step_2_cache
- job: xig_step_3
dependsOn: xig_step_2
steps:
- task: Bash@3
displayName: 'Download latest publisher'
inputs:
targetType: 'inline'
script: 'wget https://github.com/HL7/fhir-ig-publisher/releases/latest/download/publisher.jar'
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'current'
artifactName: xig_step_2_cache
targetPath: $(XIG_CACHE_FOLDER)
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'current'
artifactName: xig_step_2_db
targetPath: $(XIG_DB_FOLDER)
- task: Bash@3
displayName: 'Run publisher with xig param step 3'
inputs:
targetType: 'inline'
script: 'java -Xmx7168m -jar ./publisher.jar -xig $(XIG_DB_FOLDER)/$(XIG_DB_FILE) -xig-cache $(XIG_CACHE_FOLDER) -xig-step 3'
- task: PublishPipelineArtifact@1
inputs:
targetPath: $(XIG_DB_FOLDER)
artifactName: xig_step_3_db
- job: transfer_db_to_remote
dependsOn:
- xig_step_1
- xig_step_2
- xig_step_3
steps:
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'current'
artifactName: xig_step_3_db
targetPath: $(XIG_DB_FOLDER)
- task: DownloadSecureFile@1
inputs:
secureFile: 'xig.private.key'
# This step includes chmod to the private key to avoid ssh complaining about permissions.
- task: Bash@3
displayName: 'Clean previous results on remote'
retryCountOnTaskFailure: 5
inputs:
targetType: 'inline'
script: |
chmod 400 $(Agent.TempDirectory)/xig.private.key
ssh -o "StrictHostKeyChecking=no" -i $(Agent.TempDirectory)/xig.private.key $(XIG_USER)@$(XIG_SERVER) 'if [ -d "$(XIG_TARGET_DIRECTORY)" ]; then find $(XIG_TARGET_DIRECTORY) -name "*" -delete; fi && mkdir $(XIG_TARGET_DIRECTORY)'
- task: Bash@3
displayName: 'Copy tar to remote'
retryCountOnTaskFailure: 5
inputs:
targetType: 'inline'
script: |
scp -o "StrictHostKeyChecking=no" -i $(Agent.TempDirectory)/xig.private.key $(XIG_DB_FOLDER)/$(XIG_DB_FILE) $(XIG_USER)@$(XIG_SERVER):$(XIG_TARGET_DIRECTORY)/
- task: Bash@3
displayName: 'Leave a timestamp'
retryCountOnTaskFailure: 5
inputs:
targetType: 'inline'
script: |
ssh -o "StrictHostKeyChecking=no" -i $(Agent.TempDirectory)/xig.private.key $(XIG_USER)@$(XIG_SERVER) 'date +%Y%m%d%H%M%S%Z > $(XIG_TARGET_DIRECTORY)/timestamp.txt'