# 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

schedules:
- cron: "0 21-22 31 * *"
  displayName: Monthly build
  branches:
    include:
    - master
  always: true

pool:
  vmImage: ubuntu-latest

steps:
- task: NodeTool@0
  inputs:
    versionSpec: '10.x'
  displayName: 'Install Node.js'

- script: |
    npm install
  displayName: 'npm install'
- task: CmdLine@2
  inputs:
    script: 'curl -sSL https://www.sourceclear.com/install | sh'
- task: CmdLine@2
  inputs:
    script: 'srcclr scan .'
  env:
    SRCCLR_API_TOKEN: $(SRCCLR_API_TOKEN)

- task: CmdLine@2
  inputs:
    script: 'zip -r stackify-log-nodejs.zip lib/ proto/ package-lock.json index.js'
- task: Veracode@3
  inputs:
    ConnectionDetailsSelection: 'Endpoint'
    AnalysisService: 'Veracode'
    veracodeAppProfile: 'Retrace NodeJS Logger'
    version: 'AZ-Devops-Build-$(build.buildNumber)'
    filepath: 'stackify-log-nodejs.zip'
    maximumWaitTime: '360'
