Integrating Acunetix 360 with Travis CI
Travis CI is a hosted continuous integration service. It is used to test and deploy software projects hosted on GitHub and Bitbucket. You can log in to Travis CI with GitHub or Bitbucket, instruct Travis CI to test the code of a project, and then push it to GitHub or Bitbucket.
For further information, see What Systems Does Acunetix 360 Integrate With?.
Generating and Using Acunetix 360’s Travis CI Integration Scripts
Acunetix 360 uses cURL and PowerShell command-line tools to integrate with Travis.
How to generate Acunetix 360's Travis CI integration scripts
- Log in to Acunetix 360.
- From the main menu, go to Integrations > New Integration > Travis CI.
- From the Integration Script Generator section, select the relevant Scan Settings:
- From the Scan Type field, select an option
- From the Website drop-down, select a website
- From the Scan Profile drop-down, select a scan profile (this is not displayed if you select Full with Primary Profile as the Scan Type)
- In the script field, select Copy to clipboard to copy the script. (You will then paste this into the file described in How to Use Acunetix 360’s’s Travis Integration Script.)
How to use Acunetix 360's Travis integration script
- Navigate to your Git project and open .travis.yml file.
- Paste the copied script (from How to Generate Acunetix 360’s Travis CI Integration Scripts) into your .travis.yml file. Then commit and push it to the Git repository.
- Log in to your Travis account.
- Navigate to your Travis Project window.
You can copy and paste the cURL script below into your .yml file and use it as an example.
script: | curl -u "$USERID:$APITOKEN" -X POST https://online.acunetix360.com/api/1.0/scans/CreateFromPluginScanRequest -H 'Content-Type: application/json' -d "{'WebsiteId': '004c4483-7dba-460d-fee9-abc902e94424', 'ScanType': 'FullWithPrimaryProfile', 'VcsCommitInfoModel': {'CiBuildConfigurationName' : '$TRAVIS_JOB_NAME', 'CiBuildHasChange': '$TRAVIS_COMMIT', 'CiBuildId': '$TRAVIS_BUILD_ID', 'CiBuildServerVersion': '$TRAVIS_APP_HOST', 'CiBuildUrl': '$TRAVIS_BUILD_WEB_URL', 'Committer': '$USER', 'IntegrationSystem': 'TravisCI', 'VcsName': 'Git', 'VcsVersion': '$TRAVIS_COMMIT'}}" |
Or, you can copy and paste the Powershell script below into your .yml file and use it as an example.
Invoke-RestMethod -uri 'https://online.acunetix360.com/api/1.0/scans/CreateFromPluginScanRequest' -ContentType 'application/json; charset=UTF-8' -Method POST -Headers @@{ Authorization = "Basic $([System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($env:USERID +':'+$env:APITOKEN)))"} -Body $(@@{ WebsiteId='35d9a3bf-fbe7-41e5-56f3-ad2001b6e246'; ProfileId='6522b54b-ea22-4f0d-daf3-ad4202d557c0'; ScanType='FullWithSelectedProfile'; VcsCommitInfoModel = @@{CiBuildConfigurationName = $env:TRAVIS_JOB_NAME; CiBuildHasChange = $env:TRAVIS_COMMIT; CiBuildId = $env:TRAVIS_BUILD_ID; CiBuildServerVersion = $env:TRAVIS_APP_HOST; CiBuildUrl= $env:TRAVIS_BUILD_WEB_URL; Committer= $env:USER; IntegrationSystem = 'TravisCI'; VcsName = 'Git'; VcsVersion = $env:TRAVIS_COMMIT};}| ConvertTo-Json) |
- Select Settings.
- Navigate to Environmental Variables and add your Acunetix 360 API credentials as USERID and APITOKEN variables.
- Select More Options from the top-right menu, then select Trigger build to start a build.