在涉及Azure service Fabric的自動化應用場景中,依賴於Service Fabric的Azure Powershell cmdlets,咱們可使用Jenkins能實現cicd,固然VSTS也是一種選擇。java
在Jenkins的Console output中,有以下報錯:shell
'Connect-ServiceFabricCluster' is not recognized測試
官網中是這麼描述的:
If you try to run any of the Service Fabric PowerShell cmdlets, such as Connect-ServiceFabricCluster in an Azure PowerShell window, it fails, saying that the cmdlet is not recognized. The reason for this is that Azure PowerShell uses the 32-bit version of Windows PowerShell (even on 64-bit OS versions), whereas the Service Fabric cmdlets only work in 64-bit environments.this
我我的嘗試過的解決辦法有兩種,第一種較爲簡單,推薦使用。第二種比較麻煩,須要下載JRE,須要改動jenkins的配置文件。spa
咱們在jenkins的configration下添加一個Environment variables 名稱爲path,在path中添加C:\Windows\sysnative\WindowsPowerShell\v1.0 爲咱們的powershell.exe的啓動路徑。code
咱們須要下載JRE,進入Jenkins的配置文件目錄C:\Program Files (x86)\Jenkins\jenkins.xml),作以下修改 xml
<executable>C:\Program Files\Java\jre1.8.0_151\bin\java</executable> <executable>C:\ProgramData\Oracle\Java\javapath\java.exe</executable>
一樣咱們在jenkins的configration下添加一個Environment variables 名稱爲path,在path中添加C:\Windows\System32\WindowsPowerShell\v1.0 爲咱們的powershell.exe的啓動路徑。blog
你須要在上述的path中再加入C:\Program Files\Microsoft Service Fabric\bin\Fabric\Fabric.Code 對方法1而言:
最後你的Jenkins Environment variables path 應該是以下:ip
C:\Windows\sysnative\WindowsPowerShell\v1.0;C:\Windows\System32;C:\Program Files\Microsoft Service Fabric\bin\Fabric\Fabric.Code
建立一個Pipeline ,在你的local service fabric啓動的狀況下,寫入以下測試腳本:ci
你會獲得以下的output結果: