Skip to content

Commit ed192c4

Browse files
authored
Snyk reporting per branch (#2483)
* Snyk scan per branch tracking * npm ci used to build the app * Reduce tests logs * Reverting npm ci change
1 parent 0f80a8f commit ed192c4

File tree

2 files changed

+53
-13
lines changed

2 files changed

+53
-13
lines changed

jest-config.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
},
77
"testRegex": "(test|spec)\\.tsx?$",
88
"moduleFileExtensions": ["ts", "tsx", "js", "jsx", "json", "node"],
9-
"verbose": true,
9+
"verbose": false,
1010
"collectCoverage": true,
1111
"coverageReporters": ["text", "html"],
1212
"coverageDirectory": "dist/coverage",
@@ -30,5 +30,6 @@
3030
]
3131
],
3232
"setupFiles": ["./spec/setup/test-setup.js"],
33-
"snapshotSerializers": ["enzyme-to-json/serializer"]
33+
"snapshotSerializers": ["enzyme-to-json/serializer"],
34+
"silent": true
3435
}

scripts/build-win64.bat

Lines changed: 50 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,16 @@ call snyk config set api=%SNYK_API_TOKEN%
4545
sed -i -e "s/\"buildNumber\"[[:space:]]*\:[[:space:]]*\".*\"/\"buildNumber\": \"%PARENT_BUILD_VERSION%\"/g" package.json
4646
sed -i -e "s/\"version\"[[:space:]]*\:[[:space:]]\"\(.*\)\"/\"version\": \"\1-%PARENT_BUILD_VERSION%\"/g" package.json
4747

48-
echo "Installing dependencies..."
48+
echo ==========================================================================
49+
echo === Installing dependencies
50+
echo ==========================================================================
51+
4952
call npm install
5053

51-
echo "Sign screen-share indicator..."
54+
echo ==========================================================================
55+
echo === Signing screen share indicator and native window handle helper
56+
echo ==========================================================================
57+
5258
echo %SS_FOLDER%
5359
call smctl sign --fingerprint %DIGICERT_FINGERPRINT% --input %SCREENSHARE_INDICATOR_PATH% --tool signtool --verbose
5460
smctl sign verify --input node_modules\screen-share-indicator-frame\ScreenShareIndicatorFrame.exe
@@ -69,10 +75,21 @@ IF %errorlevel% neq 0 (
6975
exit /b -1
7076
)
7177

72-
# Run Snyk Security Tests
73-
echo "Running snyk security tests"
74-
call snyk test --file=package-lock.json --org=%SNYK_ORG%
75-
call snyk monitor --file=package-lock.json --org=%SNYK_ORG% --project-name=%SNYK_PROJECT_NAME%
78+
:: ================================
79+
:: Snyk test & monitor
80+
:: ================================
81+
echo ==========================================================================
82+
echo === Running Snyk Security Tests
83+
echo ==========================================================================
84+
85+
echo Current branch: %BRANCH_NAME%
86+
call snyk test --file=package-lock.json --org=%SNYK_ORG% --project-name=%SNYK_PROJECT_NAME% --target-reference="%BRANCH_NAME%"
87+
call snyk monitor --file=package-lock.json --org=%SNYK_ORG% --project-name%SNYK_PROJECT_NAME% --target-reference="%BRANCH_NAME%"
88+
89+
IF %ERRORLEVEL% NEQ 0 (
90+
echo Snyk detected vulnerabilities! Failing the build...
91+
exit /b %ERRORLEVEL%
92+
)
7693

7794
:: Set expiry if required
7895
IF "%EXPIRY_PERIOD%"=="" (
@@ -82,10 +99,16 @@ IF "%EXPIRY_PERIOD%"=="" (
8299
call gulp setExpiry --period %EXPIRY_PERIOD%
83100
)
84101

85-
echo "Running tests, code coverage, linting and building..."
102+
echo ==========================================================================
103+
echo === Running tests, code coverage, linting and building
104+
echo ==========================================================================
105+
86106
call npm run unpacked-win
87107

88-
echo "creating 64 bit msi..."
108+
echo ==========================================================================
109+
echo === Creating 64 bit msi
110+
echo ==========================================================================
111+
89112

90113
call node -e "console.log(require('./package.json').version);" > version.txt
91114
set /p baseVer=<version.txt
@@ -96,7 +119,11 @@ if NOT DEFINED SYMVER (
96119
exit /b -1
97120
)
98121

99-
echo "creating targets directory for symphony version: " %SYMVER%
122+
echo ==========================================================================
123+
echo === Creating targets directory for symphony version: %SYMVER%
124+
echo ==========================================================================
125+
126+
100127
rmdir /q /s targets
101128
mkdir targets
102129
set targetsDir="%CD%\targets\"
@@ -114,7 +141,10 @@ set rootDir="%CD%"
114141

115142
cd %installerDir%
116143

117-
echo "Signing Symphony.exe file.."
144+
echo ==========================================================================
145+
echo === Signing Symphony.exe files
146+
echo ==========================================================================
147+
118148
smctl sign --tool signtool --fingerprint %DIGICERT_FINGERPRINT% --input %SYMPHONY_EXE_PATH% --file-name
119149
smctl sign verify --input %SYMPHONY_EXE_PATH%
120150
IF %errorlevel% neq 0 (
@@ -134,7 +164,10 @@ IF %errorlevel% neq 0 (
134164

135165
node ..\..\scripts\windows_update_checksum.js "..\..\dist\Symphony-%SYMVER%-win-x64.exe" "..\..\dist\latest.yml"
136166

137-
echo "Building new installer with Wix Sharp"
167+
echo ==========================================================================
168+
echo === Building new installer with Wix Sharp
169+
echo ==========================================================================
170+
138171
call "BuildWixSharpInstaller.bat"
139172

140173
echo "Signing MSI file.."
@@ -155,10 +188,16 @@ if ERRORLEVEL 1 (
155188
call npm install -g markdown-pdf
156189
)
157190

191+
192+
echo ==========================================================================
193+
echo === Generate documentation
194+
echo ==========================================================================
195+
158196
echo "Generating installation instructions"
159197
call %appdata%\npm\markdown-pdf install_instructions_win.md
160198
copy install_instructions_win.pdf "%targetsDir%\Install-Instructions-%archiveName%.pdf"
161199

200+
162201
echo Generate release notes
163202
cd %rootDir%
164203
call %appdata%\npm\markdown-pdf RELEASE_NOTES.md

0 commit comments

Comments
 (0)