-
Notifications
You must be signed in to change notification settings - Fork 5
/
azure-pipelines.yml
113 lines (109 loc) · 4.46 KB
/
azure-pipelines.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
trigger:
- main
variables:
isMain: $[eq(variables['Build.SourceBranch'], 'refs/heads/main')]
stages:
- stage: Snyk
pool:
vmImage: 'ubuntu-latest'
variables:
pnpm_config_cache: $(Pipeline.Workspace)/.pnpm-store
jobs:
- job: snyk
steps:
- task: UseNode@1
inputs:
version: '20.x'
displayName: 'Install Node.js'
- task: Cache@2
inputs:
key: 'pnpm | "$(Agent.OS)" | pnpm-lock.yaml'
path: $(pnpm_config_cache)
displayName: Cache pnpm
- script: |
corepack enable
corepack prepare [email protected] --activate
pnpm config set store-dir $(pnpm_config_cache)
displayName: 'Setup pnpm'
- script: |
pnpm install
displayName: 'pnpm install'
- task: Bash@3
displayName: 'Enable synk monitor mode'
condition: and(succeeded(), eq(variables.isMain, true))
inputs:
targetType: inline
script: |
echo "##vso[task.setvariable variable=snyk_cmd]monitor"
- task: Bash@3
displayName: 'Enable synk test mode'
condition: and(succeeded(), eq(variables.isMain, false))
inputs:
targetType: inline
script: |
echo "##vso[task.setvariable variable=snyk_cmd]test"
- task: CmdLine@2
displayName: 'Snyk scan'
inputs:
script: |
docker run --rm \
--env SNYK_TOKEN \
--env DEBUG=1 \
-v $(Build.SourcesDirectory):/app \
snyk/snyk:node-20 snyk ${SNYK_CMD} --severity-threshold=high --all-projects --org=${SNYK_ORG_ID} --remote-repo-url=GEL-next --project-tags=applicationid=A00C6A,componenttype=ui,buildnumber=0.0.$(Build.BuildId)
env:
SNYK_TOKEN: $(SNYK_TOKEN)
SNYK_ORG_ID: $(SNYK_ORG_ID)
- stage: Fortify
condition: and(succeeded(), eq(variables.isMain, true))
jobs:
- job: 'fortify_prepare'
displayName: 'fortify prepare'
pool:
vmImage: 'ubuntu-latest'
steps:
- task: Bash@3
displayName: 'Create dist folder'
inputs:
targetType: 'inline'
script: |
mkdir -p $(Build.SourcesDirectory)/.dist/src
mkdir -p $(Build.SourcesDirectory)/.dist/lib && echo '' >> $(Build.SourcesDirectory)/.dist/lib/blank.txt
rsync -aF -m $(Build.SourcesDirectory)/ $(Build.SourcesDirectory)/.dist/src/
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(Build.SourcesDirectory)/.dist'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/source.zip'
- publish: '$(Build.ArtifactStagingDirectory)/source.zip'
artifact: drop
- job: 'fortify_scan'
displayName: 'fortify scan'
dependsOn: 'fortify_prepare'
pool:
name: 'a00c6a-non-prod-self-hosted'
steps:
- checkout: none
- download: current
artifact: drop
- task: Bash@3
inputs:
targetType: 'inline'
script: |
curl -${JFROG_USER}:${JFROG_TOKEN} -T $(Pipeline.Workspace)/drop/source.zip "${JFROG_URL}/gel-next/0.0.$(Build.BuildId)/source.zip"
env:
JFROG_URL: $(JFROG_URL)
JFROG_USER: $(JFROG_USER)
JFROG_TOKEN: $(JFROG_TOKEN)
- task: Bash@3
inputs:
targetType: inline
script: |
curl -s -o /dev/null -w "%{http_code}" --request POST --url ${FORTIFY_URL} --header "Authorization: Basic ${FORTIFY_TOKEN}" --header "Content-Type: application/x-www-form-urlencoded" --data "APP_ID=${APP_ID}" --data "COMPONENT=GEL" --data "PJVERID=${FORTIFY_COMPONENT_PJVERID}" --data "EMAIL_ADDRESS=${FORTIFY_EMAIL}" --data "BUILD_LABEL=0.0.$(Build.BuildId)" --data "CODE_LANGUAGE=TypeScript" --data "BRANCH=main" --data "AF_LINK=${JFROG_URL}/gel-next/0.0.$(Build.BuildId)/source.zip"
env:
APP_ID: $(APP_ID)
FORTIFY_URL: $(FORTIFY_URL)
FORTIFY_TOKEN: $(FORTIFY_TOKEN)
FORTIFY_COMPONENT_PJVERID: $(FORTIFY_COMPONENT_PJVERID)
FORTIFY_EMAIL: $(FORTIFY_EMAIL)