Skip to content

Commit 241d941

Browse files
mjbond-msftjonpryor
authored andcommitted
[build] Add build-tools/automation/build.groovy (#2603)
Context: http://groovy-lang.org/syntax.html Context: https://jenkins.io/doc/book/pipeline/syntax/#scripted-pipeline Historically, the [`xamarin-android` Jenkins build][0] has been a [Jenkins Freestyle project][1]. While this works, there are a few problems we've experienced with Freestyle projects: * The Freestyle configuration is not publicly visible, meaning external contributors can't verify their own environment when they encounter local build failures. * The Freestyle configuration is revision controlled, but the revisions do not have commit messages, and are not associated with the `xamarin-android` repo. * There Can Be Only One **Upload artifacts to Microsoft Azure Storage** step. We would like to have a world in which we build the `xamarin-android` repo, create the installers, upload the installers, build and run the unit tests, and then upload the results of the unit test execution. This requires (at least) two separate upload steps. The final bullet point means we cannot do this with Freestyle projects, which is doubly annoying when we encounter build timeouts, as the mono bundle and OS installers will exist but won't be uploaded and available for further use until after the *entire* build is complete, which could be a significant amount of time. Instead of using a Jenkins Freestyle project, we will migrate to a [Jenkins Scripted Pipeline build][2]. Jenkin scripted pipeline builds involve a [Groovy][3] script which will be executed to perform the build within Jenkins, fixing all of of the Freestyle project limitations detailed above: * The Groovy script will be stored within the `xamarin-android` repo, and will be publicly visible. * As the Groovy script will be kept within the `xamarin-android` repo, it can undergo normal PR review and have useful commit messages describing the changes. * Scripted pipeline builds can upload multiple times. This will allow us to upload installers immediately after they're created, which will allow "downstream workflows" to be kicked off without them needing to wait for the entire build to be completed. Add a new `build-tools/automation/build.groovy` file, which is the Groovy script to use for the Jenkins scripted pipeline build. `build.groovy` requires that the build environment provide the following values: * `BotLabel`: Label used for bot selection on which machine the build will run (e.g. `xamarin-android-master`) * `BuildFlavor`: Target build flavor for the build such as `Release` or `Debug` * `ContainerName`: The name of the Azure container where the artifacts will be stored * `StorageAccountName`: Name of Azure storage account using to store published artifacts * `StorageCredentialId`: Credential id for Azure storage account used to store the published artifacts * `StorageVirtualPath`: The name of the Azure path (folder) where published artifacts will be stored [0]: https://jenkins.mono-project.com/view/Xamarin.Android/job/xamarin-android/ [1]: https://www.guru99.com/create-builds-jenkins-freestyle-project.html [2]: https://jenkins.io/doc/book/pipeline/syntax/#scripted-pipeline [3]: http://groovy-lang.org/syntax.html
1 parent 5676d26 commit 241d941

File tree

1 file changed

+404
-0
lines changed

1 file changed

+404
-0
lines changed

0 commit comments

Comments
 (0)