-
Notifications
You must be signed in to change notification settings - Fork 226
Przepeck/windows ci sdl #3680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
przepeck
wants to merge
93
commits into
main
Choose a base branch
from
przepeck/windows_ci_sdl
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+333
−3
Open
Przepeck/windows ci sdl #3680
Changes from all commits
Commits
Show all changes
93 commits
Select commit
Hold shift + click to select a range
dbcff80
added sign and bdba drafts to the windows ci pipeline
przepeck 16451bc
updating signing files
przepeck 806d161
excluded from sdl check new .bat files
przepeck ce76f48
refactoring to create separate pipe for SDL
przepeck e55f2ef
fixed stage structure
przepeck 3d49841
moved git pulls to use user credentials
przepeck 7d671bd
changed links to testing fork and valid raw content
przepeck 619bb22
fit to new credentials
przepeck 876c2d1
changed curl to cloning repo to use credentials
przepeck d2f39a2
added cleanup, using local signfile
przepeck ba7123e
minor fixes, adding python option to siginig script
przepeck a2c3ab0
corrected paths
przepeck 6d4b189
added debug steps
przepeck 1f1b5c9
corrected parameters
przepeck 7d954d7
commented build stage to speed up testing and debugging
przepeck d298fd2
testing correct credentials
przepeck 7349653
corrected path to bdba scans
przepeck 62e754f
corrected path to bdba scans
przepeck af61db8
corrected path to bdba scans v2
przepeck 8385fc4
corrected path to bdba scans v3
przepeck 7079755
changes in filenames and cleaning temporal files
przepeck fe55f01
changes in filenames and cleaning temporal files v2
przepeck 19ceae2
changes in filenames and cleaning temporal files v3
przepeck 0a91e06
minor changes in errors and added signtool to PATH
przepeck 7e5e2ba
corrected path for signing script
przepeck df30d1f
corrected path for signing script v2
przepeck 8af3f83
fixed error raising after sdl actions
przepeck 740f060
changed incorrect file in macro
przepeck 5b5e779
removed redundant exit condition
przepeck 543a682
removed redundant exit conditions v2
przepeck aefc7ab
enabling build step
przepeck 5ba84a9
corrected path to log
przepeck 2db4779
changed location
przepeck a46a54f
commented stages for debug reasons
przepeck 8f33e3f
checking if OVMS_PASS is correct
przepeck e6dc3d7
enbale using special chars in password
przepeck 41387af
enbale using special chars in password v2
przepeck d21bf9f
enbale using special chars in password v3
przepeck ff904e1
enbale using special chars in password v4
przepeck cc7b574
enable using special chars in password v5 - debug
przepeck 2860237
enable using special chars in password v6
przepeck f6a7412
enable using special chars in password v7
przepeck f164b87
enable using special chars in password v8
przepeck cc13d86
enable using special chars in password v9
przepeck c9174cb
enable using special chars in password v10
przepeck 3ddef00
enable using special chars in password v11
przepeck fc84ec7
enable using special chars in password v12
przepeck a9af04c
enable using special chars in password v13 - debug
przepeck fb42447
enable using special chars in password v14 - debug
przepeck 7801c08
enable using special chars in password v15 - revert changes
przepeck e05565f
enabling special characters in the password for siging
przepeck 56b0d4f
enabling special characters in the password for siging v2
przepeck c47049b
reverting previous changes
przepeck 344948f
next debug try to get valid password
przepeck f6e801b
next debug try to get valid password v2
przepeck 0a5cfb1
debugging BDBA
przepeck 53fd7d9
using withCredentials to get user's password
przepeck 882f70b
using withCredentials to get user's password v2
przepeck 1998f6d
using withCredentials to get user's password v3
przepeck 5723ead
uncommenting bdba for debug reasons
przepeck 7d5f034
changing path for artifacts
przepeck cff96af
changing tar command to work
przepeck 01335e0
changing tar command to work v2
przepeck 97fe9af
uncommenting build and cleanup stages
przepeck 5772227
implemeneted copilot suggestions
przepeck d15b828
corrected cleanup, changed stages
przepeck ac7ade6
corrected stage conditions
przepeck e190e26
deleted previous conditions
przepeck 1e44c09
changed repositories to be parametrized
przepeck 91f39b1
changed error checking in bdba execution
przepeck c5251c6
setting unstable message after finding vulnerabilities
przepeck 297857d
removed comment
przepeck 20a0507
change bdba repo to use external config
przepeck e231fa5
changed repo cloning to be independent from windows_signing
przepeck 5e037b9
commenting build stage for debug reasons
przepeck d1fa07d
changed repo's name
przepeck f9e312d
uncommenting build and test stage
przepeck 1852f27
Merge branch 'main' into przepeck/windows_ci_sdl
dtrawins afc88f4
changed cleaning script
przepeck 78dd649
adding pulling for repos instead of cloning, adding RELEASE TYPE
przepeck 78408c7
archiving signed ovms package
przepeck 6af3e55
adding downloading files from package
przepeck cdbad9d
fixed condition location
przepeck c03e1cc
fixed pull files stage
przepeck 07f8a03
fixed curl
przepeck e7783f7
coping signed files to archive it
przepeck b605471
fixed zipping
przepeck c2bfe55
removing ovms directory if exists to enable bdba scans version overri…
przepeck 66ac7ad
changed order of the stages to enable bdba scans version override
przepeck 16be5b0
review suggestions v1
przepeck cc22766
review suggestions v2 - adding parameter for branches for external re…
przepeck 181be56
corrected variable name
przepeck 83b1986
adding archiving sha256 file
przepeck File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
pipeline { | ||
options { | ||
timeout(time: 2, unit: 'HOURS') | ||
} | ||
agent { | ||
label 'win_ovms' | ||
} | ||
environment { | ||
BDBA_CREDS = credentials('BDBA_KEY') | ||
} | ||
stages { | ||
stage ("Build and test windows") { | ||
when { expression { env.PACKAGE_URL == "" } } | ||
steps { | ||
script { | ||
echo "JOB_BASE_NAME: ${env.JOB_BASE_NAME}" | ||
echo "WORKSPACE: ${env.WORKSPACE}" | ||
echo "OVMS_PYTHON_ENABLED: ${env.OVMS_PYTHON_ENABLED}" | ||
def windows = load 'ci/loadWin.groovy' | ||
if (windows != null) { | ||
try { | ||
windows.setup_bazel_remote_cache() | ||
windows.install_dependencies() | ||
windows.clean() | ||
windows.build() | ||
windows.unit_test() | ||
windows.check_tests() | ||
def safeBranchName = env.BRANCH_NAME.replaceAll('/', '_') | ||
def python_presence = "" | ||
if (env.OVMS_PYTHON_ENABLED == "1") { | ||
python_presence = "with_python" | ||
} else { | ||
python_presence = "without_python" | ||
} | ||
bat(returnStatus:true, script: "ECHO F | xcopy /Y /E ${env.WORKSPACE}\\dist\\windows\\ovms.zip \\\\${env.OV_SHARE_05_IP}\\data\\cv_bench_cache\\OVMS_do_not_remove\\ovms-windows-${python_presence}-${safeBranchName}-latest.zip") | ||
} finally { | ||
windows.archive_build_artifacts() | ||
windows.archive_test_artifacts() | ||
} | ||
} else { | ||
error "Cannot load ci/loadWin.groovy file." | ||
} | ||
} | ||
} | ||
} | ||
stage ("Pull files"){ | ||
when { expression { env.PACKAGE_URL != "" } } | ||
steps{ | ||
script { | ||
def windows = load 'ci/loadWin.groovy' | ||
if (windows != null) { | ||
try { | ||
windows.download_package() | ||
} finally { | ||
echo "Pull files finished" | ||
} | ||
} else { | ||
error "Cannot load ci/loadWin.groovy file." | ||
} | ||
} | ||
} | ||
} | ||
stage ("BDBA scans"){ | ||
when { expression { env.BDBA_SCAN == "true" } } | ||
steps { | ||
script { | ||
def windows = load 'ci/loadWin.groovy' | ||
if (windows != null) { | ||
try { | ||
windows.clone_sdl_repo() | ||
windows.clone_bdba_repo() | ||
windows.bdba() | ||
def logFile = "${env.WORKSPACE}\\win_bdba.log" | ||
def lastLine = bat(script: "powershell -Command \"Get-Content -Path '${logFile}' | Select-Object -Last 1\"", returnStdout: true).trim() | ||
if (!lastLine.contains("Found 0 vulnerabilities")) { | ||
unstable(message: lastLine) | ||
} | ||
} finally { | ||
windows.archive_bdba_reports() | ||
} | ||
} else { | ||
error "Cannot load ci/loadWin.groovy file." | ||
} | ||
} | ||
} | ||
} | ||
stage ("Signing files"){ | ||
when { expression { env.SIGN_FILES == "true" } } | ||
steps { | ||
echo "OVMS_PYTHON_ENABLED: ${env.OVMS_PYTHON_ENABLED}" | ||
withCredentials([ | ||
usernamePassword( | ||
credentialsId: 'PRERELEASE_SIGN', | ||
usernameVariable: 'PRERELEASE_USER', | ||
passwordVariable: 'PRERELEASE_PASS'), | ||
usernamePassword( | ||
credentialsId: 'RELEASE_SIGN', | ||
usernameVariable: 'RELEASE_USER', | ||
passwordVariable: 'RELEASE_PASS'), | ||
]) { | ||
script { | ||
if (env.RELEASE_TYPE == "RELEASE") { | ||
env.SIGNING_USER = env.RELEASE_USER | ||
env.OVMS_PASS = env.RELEASE_PASS | ||
} else if (env.RELEASE_TYPE == "PRE-RELEASE") { | ||
env.SIGNING_USER = env.PRERELEASE_USER | ||
env.OVMS_PASS = env.PRERELEASE_PASS | ||
} else { | ||
error "Unknown RELEASE_TYPE: ${env.RELEASE_TYPE}" | ||
} | ||
def windows = load 'ci/loadWin.groovy' | ||
if (windows != null) { | ||
try { | ||
windows.clone_sdl_repo() | ||
windows.sign() | ||
} finally { | ||
windows.archive_sign_results() | ||
} | ||
} else { | ||
error "Cannot load ci/loadWin.groovy file." | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
@echo off | ||
set "BDBA_KEY=%1" | ||
set "OVMS_PATH=..\%2" | ||
set "CONFIG_PATH=..\%3" | ||
cd repo_ci_infra | ||
|
||
python -m venv venv | ||
|
||
call venv\Scripts\activate | ||
|
||
python -m pip install --upgrade pip | ||
|
||
if exist requirements.txt ( | ||
pip install -r requirements.txt | ||
) | ||
|
||
for /f "tokens=2 delims==." %%I in ('wmic os get localdatetime /value') do set datetime=%%I | ||
set datestamp=%datetime:~0,8% | ||
set timestamp=%datetime:~8,4% | ||
set filename=ovms_windows_%datestamp%_%timestamp% | ||
set zipname="%filename%.zip" | ||
|
||
copy %OVMS_PATH%\\ovms.zip %OVMS_PATH%\\%zipname% | ||
przepeck marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if errorlevel 1 ( | ||
echo Failed to copy %OVMS_PATH%\ovms.zip to %OVMS_PATH%\%zipname%. | ||
exit /b 1 | ||
) | ||
|
||
echo "BDBA_KEY=%BDBA_KEY%" | ||
echo "OVMS_PATH=%OVMS_PATH%" | ||
|
||
python binary_scans\ovms_bdba.py --key %BDBA_KEY% --config_dir=%CONFIG_PATH% --type windows --build_dir %OVMS_PATH% --artifacts %zipname% --report_name %filename% 2>&1 | tee ..\win_bdba.log | ||
if errorlevel 1 exit /b %errorlevel% | ||
|
||
tar -a -c -f ..\ovms_windows_bdba_reports.zip ovms_windows* | ||
del "%OVMS_PATH%\%zipname%" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
@echo off | ||
set "OVMS_USER=%1" | ||
set "OVMS_FILES=..\..\%2" | ||
set "PYTHON=%3" | ||
set PATH=%PATH%;C:\Jenkins\workspace\ovmsc\signfile;C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64 | ||
|
||
cd sdl_repo\windows_signing | ||
|
||
if /I "%PYTHON%"=="1" ( | ||
set "PYTHON_OPT=--python" | ||
) else ( | ||
set "PYTHON_OPT=" | ||
) | ||
|
||
python check_signing.py --user=%OVMS_USER% --path=%OVMS_FILES% %PYTHON_OPT% --auto --verbose --print_all 2>&1 | tee ..\..\win_sign.log | ||
python check_signing.py --zip --path=%OVMS_FILES% %PYTHON_OPT% --auto | ||
|
||
for %%f in (ovms_windows_python_*) do ( | ||
copy "%%f" "%OVMS_FILES%" | ||
) | ||
for /f "tokens=* delims=" %%a in ('type ..\..\win_sign.log ^| tail -n 1') do ( | ||
echo %%a | findstr /C:"[ OK ]" >nul | ||
if not errorlevel 1 ( | ||
exit /b 0 | ||
) else ( | ||
exit /b 1 | ||
) | ||
) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to load it in every stage?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It helps us to run stages separately, every stage should have its own context