Skip to content

fufu70/Xamarin-Jenkins-Cake-Box

Repository files navigation

Xamarin-Jenkins-Cake-Box

Ever feel the need to turn on the Code Analysis Oven and bake some Xamarin metrics, but all of those tools just get in the way? Welcome to the Jenkins Dump Cake mix, where all of your Analysis is at a one stop shop.

Table Of Contents

The requirements

You thought that was a Download And Analyze (DAA) project, but you are mistaken! To run the Xamarin-Jenkins-Cake-Box we need to install dependencies:

  • VirtualBox
    • Make sure to download the latest version, even if you already installed VirtualBox before.
    • As of writing this my version (AOWTMV) is 5.1.14
  • Vagrant ... not a vagrant
    • AOWTMV is 1.8.6
  • A PC

The Process

Firstly we need to start up vagrant so that it can download the entire vagrant box. This may take some time, so grab a cup of coffee

$ vagrant up

After the Vagrant machine has started we need to setup our mini mac kitchen

$ vagrant ssh
$ bash install-jenkins/install.sh

This will install all of the necessary applications to run code analysis and automated builds for your Android Xamarin application.

AHHhhhhhhhhhhh! The slowest installation possible!

Lets get to the jenkins box, go to http://192.168.205.30:8080/ in your browser. A prompt should show for unlocking jenkins

alt text

Simply ssh into your machine and cat the prompted file:

$ vagrant ssh
$ sudo cat /Users/vagrant/.jenkins/secrets/initialAdminPassword

Copy and paste the password shown after the command is run into the Administrator Password input.

Batter up! Choose to Install suggested plugins.

alt text

A list of generalized plugins will start installing, including our favorite git Source Code Management tool

alt text

Who do you want to be? A Jenkins user thats who!

alt text

The installation is now complete.

alt text

Now on to the terminal, but its not so easy. Jenkins needs its TCP port for JNLP to be set to a fixed port before any CLI commands can be run. Go to http://192.168.205.30:8080/configureSecurity/ and set the TCP port for JNLP agents value to be fixed and to a random number ... I picked 12345

alt text

The lovey dovey terminal is back! And its here to install some plugins! So ssh into your machine and run that script!

$ vagrant ssh
$ bash install-jenkins/plugins.sh

Nice! For the icing on the Xamarin-Jenkins-Cake-Box, lets add some integration with those plugins!

$ bash install-jenkins/integration.sh

When running this command you'll be given an option to input a personal repository. If N is selected then the repository URL can be changed from the config section of the jenkins job at http://192.168.205.30:8080/job/xamarin-cake-box-job/configure. The second option below is the Source Code Management config, here you can set a repository url and credentials:

alt text

Your done now, all you need to do now is simply click the "Build Now" button in your xamarin-cake-box-job and analyze on!

Troubleshooting

Content Security Policy Issues

Okay my fellow scrubs! You finally got your first job to run, you head over to your Gendarme html reportsat http://192.168.205.30:8080/job/xamarin-cake-box-job/ws/gendarme.html. Whats this!

alt text

What are all these console errors!

alt text

This is a direct issue with the Content Security Policy issue. Were going to run a script inside of Jenkins internal console. Go to http://192.168.205.30:8080/script and run:

System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "")

Inside of the script console.

alt text

After running the script go back to the Gendarme results page at http://192.168.205.30:8080/job/xamarin-cake-box-job/ws/gendarme.html, hard refresh the page to clear your current cache, and view the splendor of no Content Security!

alt text

Thanks To

Andrew Dryga's vagrant-osx-box

The Xamarin Developer Guide for a CI setup in Jenkins

Nelson Senna's Code Sniffer StyleCop.Baboon

The MonoDevelop Teams

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages