NickF

We are an small existing Java/Web development team using IJ Idea and CI/Hudson with Maven to auto deploy artifacts to on-premise IBM Websphere for several years.

Recently we migrated new applications to MS Azure/Tomcat and found we were unable to upload Web apps to Azure because of corporate proxy/firewalls so we resorted to using the Azure manual upload/ deploy mechanisms.

We are currently evaluating TeamCity (in both a Linux VM on Azure and the Azure Teamcity deploy script) and have been progressing well with the usual GIT build/deploy/release to Nexus steps.

Unfortunately I have hit a blocker when I come to try and deploy a .war artifact to Azure/Tomcat for CI (and production)

Any help would be greatly appreciated in how to get an artifact to Azure in the build script

I have googled extensively and downloaded all the available plugins for TeamCity (and we are doing this successfully on our Jenkins VM evaluation using the Azure App Service plugin)

 

Cheers Nick

 

0
2 comments

Hi Nick,

It would be useful to help if you could provide examples on what exactly is not working, failing or what exact part you are having trouble with. The only part you mention is proxies/firewalls. For the first of the two, we have help here: https://confluence.jetbrains.com/pages/viewpage.action?pageId=113084582#HowTo...-ConfigureTeamCitytoUseProxyServerforOutgoingConnections

this article and the one below it show how to configure the server (in case you need it) and agents (which runs the builds) to use proxies for outgoing connections.

0
Avatar
Permanently deleted user

Hi Denis,

Thanks for your response I will have a good read. I think I must apologise for the lack of clarity in my request for help. The key aspect I forgot to say was that I was try to deploy to Azure/Tomat as a SAAS so need to use Azure Plugins or Cmdlets. Additionally I am evaluating this entirely in Azure VMs effectively bypassing all the corporate proxies which would have stopped me dead in my tracks.

Anyway in the meantime I have got a basic MS PowerShell script working as a TeamCity build step to download the artefact from Nexus3 and deploy to Azure Tomcat. It's not pretty and may not represent current 'best practises' but is good enough to demo.

I've included this below

 

Build Step
Runner Type: PowerShell
Script source
-----------------------

$nexususername = 'admin'
$nexuspassword = 'adminPassword'

$username = '$AZUREUSER'
$password = 'AzurePassword'
$userAgent = "powershell/1.0"

$apiUrl = 'https://yoursite.scm.azurewebsites.net/api/vfs/site/wwwroot/webapps/'
$filePath = '/home/teamcity/deploy/'

$nexusUrl = 'http://yoursite.westeurope.cloudapp.azure.com:8081/repository/your-releases/your/path/to/sample-web/2.2/sample-web-2.2.war'

$nexussecpasswd = ConvertTo-SecureString $nexuspassword -AsPlainText -Force
$nexuscredential = New-Object System.Management.Automation.PSCredential($nexususername, $nexussecpasswd)

$secpasswd = ConvertTo-SecureString $password -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential($username, $secpasswd)

Write-Host ('>>> Start Downloading File from nexus')
Invoke-WebRequest -Uri $nexusUrl -Credential $nexuscredential -Method Get -Outfile $filePath\sample-web.war
Write-Host ('>>> End Downloading File from nexus')


Write-Host ">>> Start Uploading WAR File"
Invoke-RestMethod -Uri $apiUrl'sample-web.war' -Credential $credential -AllowUnencryptedAuthentication -UserAgent $userAgent -Method Put -InFile $filePath\sample-web.war -ContentType "multipart/form-data"
Write-Host ">>> Finish Uploading WAR File"
0

Please sign in to leave a comment.