Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Service Fabric/Jenkins integration issue

I am trying to automate deployment to Azure Service Fabric with Jenkins and ServiceFabric PowerShell extension. Jenkins ServiceFabric plugin is not a good option in my case due to lack of control and flexibility over deployment process. I've faced following issue - Jenkins can't recognize SF PowerShell cmdlets

Connect-ServiceFabricCluster : The term 'Connect-ServiceFabricCluster' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again

ServiceFabric setup is correct because tt works like a charm when I run the script locally from PowerShell. So, I've tried to run Jenkins locally instead of service mode as suggested in different posts over the internet, but this haven't resolved the issue.

The other things i've tried:

  • run the script with self-elevation to admin
  • run x86/x64 powershell modes
  • run the script via calling PowerShell exe from cmd runner instead
    powershell plugin
  • forcing "unrestricted" mode
  • double-dot before script name

I'm still receiving the same result.

So, I tried ServiceFabric Python Cli as an alternative, but faced the other issue - it returns "Bad SSL handshake" on "sfctl cluster select" with certificate, which worked with PS ServiceFabric cmdlets locally

Any ideas?

like image 703
user2744601 Avatar asked Feb 05 '18 16:02

user2744601


2 Answers

This is similar to Azure/service-fabric-issues issue 491 which was about a mismatch between the Azure Service Fabric SDK and the Service Fabric runtime.

For instance:

The 2.7 SDK will work against a version 6.0 cluster, but the task will not work on with the 2.8 SDK installed on the agent.

Plus:

Service Fabric PowerShell cmdlets requires PowerShell 3.0 or higher.

Service Fabric uses Windows PowerShell scripts for creating a local development cluster and for deploying applications from Visual Studio. By default, Windows blocks these scripts from running.
To enable them, you must modify your PowerShell execution policy. Open PowerShell as an administrator and enter the following command:

Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Force -Scope CurrentUser

So: if that script is working locally, but not through a Jenkins job on a Jenkins agent, look for differences between the local execution environment (where it is working) and the Jenkins one (where it fails).
The user might not be the same and/or the runtime version might not be compatible with the SDK version.

like image 169
VonC Avatar answered Oct 01 '22 22:10

VonC


Do you have Jeknis PowerShell Plugin installed in your system ?? if so can you add your commands into the Power Shell dialog box and see if it works :)

enter image description here

like image 38
rohit thomas Avatar answered Oct 01 '22 22:10

rohit thomas