Showing posts with label Jenkins. Show all posts
Showing posts with label Jenkins. Show all posts

Tuesday, 2 July 2019

Fix for Jenkins on Mac getting stuck on overnight builds




Every night my dutiful Jenkins build servers build their jobs and every morning I come in to find that a job on OSX has gotten stuck on 'git fetch' all night. The job's console output looks something like this:

[EnvInject] - Loading node environment variables.
Building in workspace /Users/me/Projects/MyProject
[WS-CLEANUP] Deleting project workspace...
[WS-CLEANUP] Deferred wipeout is used...
[WS-CLEANUP] Done
using credential xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Cloning the remote Git repository
Cloning repository ssh://myname@website.org/repo.git
 > /usr/local/bin/git init /Users/me/Projects/MyProject# timeout=10
Fetching upstream changes from ssh://myname@website.org/repo.git
 > /usr/local/bin/git --version # timeout=10
using GIT_ASKPASS to set credentials 
 > /usr/local/bin/git fetch --tags --progress ssh://myname@website.org/repo.git +refs/heads/*:refs/remotes/origin/*

Sometimes it starts again while you're looking at it, as if embarrassed to be caught slacking off all night.


Resolution:

This is because I turn off the display in the evening and the OSX build server server decides to go into sleep mode. Here's how to turn that feature off:


  1. Go the the Apple menu, select System Preferences then Energy Saver
  2. Check the box that says "Prevent computer from sleeping automatically when the display is off"

Monday, 20 May 2019

Building visual studio solutions on Jenkins


These are instructions on how to set up and use the MSBuild plugin for jenkins.

Adding MSBuild settings


  1. Go to the jenkins Global Tool Configuration and scroll to find the MSBuild section.
  2. Click "MSBuild Installations..." then "Add MSBuild", now you should see 3 fields to fill in.
  3. Name: Your identifier for these settings, this can be whatever you like but I suggest describing the settings e.g. "vs2019 Release settings"
  4. Path to MSBuild: The path to the Visual Studio compiler.
    Gotcha: In my experience to use the visual studio 2015 compiler I had to include the compiler in the path otherwise the plugin complains about not finding the compiler. Jenkins shows a warning when you do this but it works.
    • For Visual Studio 2015 use MSBuild 14 at:
      C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe
    • For Visual Studio 2017 use MSBuild 15 at:
      C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin
    • For Visual Studio 2019 use MSBuild 16 at:
      C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin
  5. Default parameters: Write here what parameters you wish to give the compiler.
    e.g.:
    -t:Clean,Build -p:Configuration="Release" -p:Platform="x64"
    MSBuild 16 uses hyphens for parameters but MSBuild 14 and 15 use a forward slash instead "/t:Clean,Build /p:Configuration="Release" /p:Platform="x64""
    If you're unsure open a command prompt and run MSBuild.exe --help or MSBuild.exe /help
  6. Click Save


Adding MSBuild to a job


  1. Go to the job configuration and scroll to find the Build section 
  2. Click Add build step and choose "Build a Visual Studio project or solution using MSBuild"
  3. In the MSBuild Version list select the setting you saved earlier.
  4. In the MSBuild Build File enter the path for the solution
    e.g. "
    $WORKSPACE\Builds\VisualStudio2019\MyProject.sln"
    (Conviently, you can use the jenkins environment variables here)
  5. Optional Additional parameters may be added to Command Line Arguments text box.
  6. Click Save



Monday, 13 August 2018

Setting JUCE global paths for Jenkins (Windows)



My problem: Jenkins build jobs were failing due to being unable to generate projects form jucer files. JUCE complained that the global paths were incorrect. ROLI user and license details didn't appear to be being saved either.

Solution: Okay the projucer settings on the PC don't get passed over to Jenkins builds, this is because the projucer settings are saved in your user details and Jenkins runs runs jobs as a special kind of user.

To solve this open up Projucer and log in, set up all the global paths you’ll need and save. 
Then copy the following file:
C:\Users\<Username>\AppData\Roaming\Projucer\Projucer.settings

to the location where Jenkins can find and use it:
C:\Windows\System32\config\systemprofile\AppData\Roaming\Projucer\Projucer.settings

AppData is a hidden folder so be sure to turn those on if you cannot see it by going to the View tab in windows explorer and checking the 'Hidden items' checkbox.

If your Jenkins is only using JUCE 5 you're probably good to go, but my Jenkins is building other projects using JUCE 4 and my settings get overwritten and lost every time a JUCE 4 project is built. So I have copied my good settings file to a safe folder in my Documents and copy it over before every JUCE 5 build using this batch command

copy /Y "C:\Users\<Username>\Documents\Projucer5\Projucer.settings" C:\Windows\System32\config\systemprofile\AppData\Roaming\Projucer\Projucer.settings

Now when you use JUCE from Jenkins everything should be fine.

  Azure Trusted Signing Signtool Error SignTool Error: An unexpected internal error has occurred. Error information: "Error: SignerSign...