OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Entry point for the AddIn build bot. | 6 """Entry point for the AddIn build bot. |
7 | 7 |
8 Perform build steps and output results using the buildbot | 8 Perform build steps and output results using the buildbot |
9 annootator syntax | 9 annootator syntax |
10 """ | 10 """ |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 else: | 152 else: |
153 if os.name == 'nt': | 153 if os.name == 'nt': |
154 gsutil = [sys.executable, _FindInPath('gsutil')] | 154 gsutil = [sys.executable, _FindInPath('gsutil')] |
155 else: | 155 else: |
156 gsutil = ['gsutil'] | 156 gsutil = ['gsutil'] |
157 | 157 |
158 return gsutil | 158 return gsutil |
159 | 159 |
160 | 160 |
161 def StepArchive(revision): | 161 def StepArchive(revision): |
162 # The BUILDBOT_REVISION environment variable gets set to the revsion that | |
163 # triggered a given build. For periodic schedulers this will be an empty | |
164 # string since they are not triggered by a particular revision. We don't | |
165 # want to upload the build results to google storage for periodic schedulers | |
166 # so we skip this step in that case. | |
167 triggered_revision = os.environ.get('BUILDBOT_REVISION') | |
168 if triggered_revision == '' or triggered_revision is None: | |
169 Log('Skipping archive step: BUILDBOT_REVISION not set') | |
170 return | |
171 | |
172 Log('@@@BUILD_STEP archive build [r%s]@@@' % revision) | 162 Log('@@@BUILD_STEP archive build [r%s]@@@' % revision) |
173 basename = 'vs_addin.tgz' | 163 basename = 'vs_addin.tgz' |
174 remote_name = '%s/%s/%s' % (GSPATH, revision, basename) | 164 remote_name = '%s/%s/%s' % (GSPATH, revision, basename) |
175 local_filename = os.path.join('..', '..', 'out', | 165 local_filename = os.path.join('..', '..', 'out', |
176 'vs_addin', basename) | 166 'vs_addin', basename) |
177 gs_remote_name = 'gs://' + remote_name | 167 gs_remote_name = 'gs://' + remote_name |
178 gsutil = _GetGsutil() | 168 gsutil = _GetGsutil() |
179 | 169 |
180 # Check for existing file on google storage | 170 # Check for existing file on google storage |
181 if RunCommand(gsutil + ['ls', gs_remote_name], check_return_code=False) == 0: | 171 if RunCommand(gsutil + ['ls', gs_remote_name], check_return_code=False) == 0: |
182 Log('File already exists on google storage: %s' % gs_remote_name) | 172 Log('Skipping archive step: file already exists on google storage') |
183 Log('@@@STEP_FAILURE@@@') | 173 return |
184 sys.exit(1) | |
185 | 174 |
186 # Upload to google storage | 175 # Upload to google storage |
187 cmd = gsutil + ['cp', '-a', 'public-read', local_filename, gs_remote_name] | 176 cmd = gsutil + ['cp', '-a', 'public-read', local_filename, gs_remote_name] |
188 RunCommand(cmd) | 177 RunCommand(cmd) |
189 url = "%s/%s" % (GSURL, remote_name) | 178 url = "%s/%s" % (GSURL, remote_name) |
190 Log('@@@STEP_LINK@download@%s@@@' % url) | 179 Log('@@@STEP_LINK@download@%s@@@' % url) |
191 | 180 |
192 | 181 |
193 def main(): | 182 def main(): |
194 # Remove BOTO_CONFIG from the environment -- we want to use the NaCl .boto | 183 # Remove BOTO_CONFIG from the environment -- we want to use the NaCl .boto |
(...skipping 11 matching lines...) Expand all Loading... |
206 | 195 |
207 StepBuild(revision) | 196 StepBuild(revision) |
208 StepInstall() | 197 StepInstall() |
209 StepInstallSDK() | 198 StepInstallSDK() |
210 StepTest() | 199 StepTest() |
211 StepArchive(revision) | 200 StepArchive(revision) |
212 | 201 |
213 | 202 |
214 if __name__ == '__main__': | 203 if __name__ == '__main__': |
215 main() | 204 main() |
OLD | NEW |