-
Notifications
You must be signed in to change notification settings - Fork 22
/
azure-pipelines-1.yml
76 lines (62 loc) · 2.14 KB
/
azure-pipelines-1.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Node.js
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
trigger:
- master
name: $(TeamProject)_$(Build.DefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r)
pool:
vmImage: 'ubuntu-latest'
resources:
containers:
- container: 'iast_agent_server'
image: 'veracode/iast-agent-server:latest'
ports:
- 10010:10010
env:
VERACODE_API_KEY_ID: $(veracode_api_key_id)
VERACODE_API_KEY_SECRET: $(veracode_api_key_secret)
services:
iast_agent_server: iast_agent_server
steps:
- task: Bash@3
displayName: 'Initialize IAST'
inputs:
targetType: 'inline'
script: |
# Wait for Agent Server to start up.
status_code=000
while [ $status_code -eq 000 ]
do
status_code=`curl --write-out "%{http_code}" --silent --output /dev/null --insecure $(AGENT_SERVER_URL)`
done
echo Agent Server status: $status_code
# Set the BUILD_TAG.
export BUILD_TAG='$(Build.BuildNumber)'
echo Using BUILD_TAG: $BUILD_TAG
# Allocate a session_id
SESSION_ID=`curl -H "Content-Type:application/json" -H "x-iast-event:session_start" --silent --insecure -X POST -d "{\"BUILD_TAG\":\"${BUILD_TAG}\"}" ${AGENT_SERVER_URL}/events | jq -r '.session_id'`
echo Using session_id: $SESSION_ID
# Download the IAST Agent files.
# curl --silent --output /dev/null --insecure ${AGENT_SERVER_URL}/downloads | sh
curl --silent --insecure ${AGENT_SERVER_URL}/downloads | sh
ls -la
- task: NodeTool@0
displayName: 'Install Node.js'
inputs:
versionSpec: '8.x'
- task: Npm@1
displayName: 'Build'
inputs:
command: 'install'
- task: Npm@1
displayName: 'Test'
inputs:
command: 'custom'
customCommand: 'run test-iast'
- task: Bash@3
displayName: 'Get IAST Results'
inputs:
targetType: 'inline'
script: |
curl -H "Accept:text/plain" --silent --insecure -X GET $(AGENT_SERVER_URL)/results?session_id=${SESSION_ID}