Bamboo

Bamboo Integration in Avo Assure

Execution using Bamboo

  1. Log in to (Atlassian) Bamboo. The version used here is 7.1.1.

  2. If a build plan is already created, then skip this step and navigate to the plan configuration screen. Follow these steps to create a build plan:

    1. Click on the ‘Create’ button present on the header. Select ‘Create Plan’.

    2. Select an existing Project or select ‘New Project’. If such an option is not present, then that means there are 0 existing Projects.

    3. If creating a new Project, then give a desired ‘Project Name’ and a ‘Project Key’ will be auto-populated. The key can be changed but it has to unique.

    4. Give a desired ‘Plan Name’. The plan key will be auto-populated and the key can be changed but it has to be unique.

    5. Link any repository if needed. If not needed or unsure, then select ‘None’.

    6. Click on ‘Configure Plan’ and click on ‘Save and continue’ on the next page.

3. Click on the Variables tab in the Plan Configuration screen and add the following variables: Variable name: AvoAssureUri Variable value: https://< AvoAssure URL > Variable name: AvoAssureExecutionRequestData Variable value: Paste Execution request data prepared above.

4. Click on desired stage and job (from the left-hand side panel) from where execution has to be triggered in Avo Assure. If a new plan is created without configuring stages, click on ‘Default Job’. Then click on the ‘Tasks’ tab.

5. Click on ‘Add Task’. Configuration for the task should look like this:

  1. Select Task Type as ‘Script'.

  2. Set the Task description as desired.

  3. Set Interpreter as ‘Windows PowerShell’.

  4. Select Script location as ‘Inline’.

  5. Paste below code snippet in Script body.

$Uri = "${bamboo.Avo_Assure_Uri}/ExecuteTestSuite_ICE_SVN"
$Body = @"
${bamboo.Execution_Request_Data}
"@
$Headers = @{'Accept' = 'application/json'; 'Content-Type' = 'application/json'; }
if ('${bamboo.ICE_Name}' -ne '') {
    $Headers.Add('x-ice-name', '${bamboo.ICE_Name}')
}
if ('${bamboo.Pool_Name}' -ne '') {
    $Headers.Add('x-pool-name', '${bamboo.Pool_Name}')
}
if ('${bamboo.Token_Name}' -ne '') {
    $Headers.Add('x-token-name', '${bamboo.Token_Name}')
}
if ('${bamboo.Token_Hash}' -ne '') {
    $Headers.Add('x-token-hash', '${bamboo.Token_Hash}')
}

add-type @"
    using System.Net;
    using System.Security.Cryptography.X509Certificates;
    public class TrustAllCertsPolicy : ICertificatePolicy {
        public bool CheckValidationResult(
            ServicePoint srvPoint, X509Certificate certificate,
            WebRequest request, int certificateProblem) {
            return true;
        }
    }
"@
$AllProtocols = [System.Net.SecurityProtocolType]'Tls,Tls11,Tls12'
[System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy

try
{
    $ResponseRaw = Invoke-WebRequest -Uri $Uri -Body $Body -Headers $Headers -Method Post -ErrorAction Stop -ContentType 'application/json'
    $Response = $ResponseRaw.BaseResponse
    $Msg = "Execution request to Avo Assure completed."
    $Result = $ResponseRaw.Content
}
catch
{
    $Response = $_.Exception.Response
    $Msg = "Error while sending execution request to Avo Assure."
    Write-Host $_.Exception
    $Reader = New-Object System.IO.StreamReader($Response.GetResponseStream())
    $Reader.BaseStream.Position = 0
    $Reader.DiscardBufferedData()
    $Result = $Reader.ReadToEnd()
}
Write-Host
Write-Host $Msg
Write-Host "Status Code: $($Response.StatusCode.value__)"
Write-Host "Response: $($Result)"

6. Leave Argument, Environment Variables, and Working subdirectory fields empty.

7. Click on ‘Save’.

6. Configuration is completed. Click on ‘Run Plan’ to start the execution.

7. Before starting the execution, make sure that ICE is connected.

8. Once the execution is completed, reports will be generated and can be viewed in the Avo Assure Reports plugin.

9. Bamboo will also have response data that looks like the below image. This data is available in the logs tab of the build summary.

Last updated