Skip to content

[pull] develop from boegel:develop #2

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

Merged
merged 360 commits into from
May 28, 2025
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
360 commits
Select commit Hold shift + click to select a range
e56cace
Fix linting errors
Apr 8, 2025
1c230d6
Fix missing f for f-strings:
Apr 8, 2025
9ef09dc
Avoid failure when only some passed easyconfigs exist
Flamefire Apr 9, 2025
3ff6130
Merge pull request #4847 from Flamefire/same-file-fix
boegel Apr 9, 2025
46060d7
Merge branch 'develop' into slurm_job_output
boegel Apr 9, 2025
cc96e4e
When iterating, make all iteropts except builddependencies lists
bartoldeman Apr 9, 2025
24f6b8a
Add option to ignore all CUDA sanity failures to not break current Ea…
Apr 9, 2025
92073b1
Implement an option te report, but ignore _all_ failures
Apr 9, 2025
aecd62d
Fix typo and missing comma
Apr 9, 2025
1a5ed61
Create copy for all options in ITERATE_OPTS-iterate_opts
bartoldeman Apr 9, 2025
3052441
Correct ITERATE_OPTIONS
bartoldeman Apr 9, 2025
8a909b0
Merge pull request #4842 from appolloford/slurm_job_output
boegel Apr 9, 2025
1535bc9
Adapt test to changed iter_opts dict
bartoldeman Apr 9, 2025
e246ee8
Check for self.cfg.iterate_options instead of #iters>1
bartoldeman Apr 10, 2025
64ca7d8
Add test for PR 4848 testing modification of preconfigopts
bartoldeman Apr 10, 2025
74d7349
Replaced all num_X with len(files_x), we don't need separate counters
Apr 10, 2025
31dc541
Update easybuild/framework/easyblock.py
casparvl Apr 10, 2025
9266344
Removed some forgotten num_files_X and replaced with len(files_X)
Apr 10, 2025
2a03e2e
Change option names
Apr 10, 2025
931cd8c
Fix cuda-compute-capabilities description to be more specific that fa…
Apr 10, 2025
a466f36
Various changes from code review
Apr 10, 2025
1bbff1b
Replaced more occurences of cc by devcode
Apr 10, 2025
22c3c23
only store relative paths in the files_X variables
Apr 10, 2025
4166d34
Processed various review comments...
Apr 10, 2025
45bfcda
Fix hound issues
Apr 10, 2025
3b9b386
Renamed function
Apr 10, 2025
0688117
Various review comments processed
Apr 10, 2025
050226f
Fixed hound issues:
Apr 10, 2025
c8a448a
Make sure to raise an error if cuobjdump doesnt exist, or if it retur…
Apr 10, 2025
dd2be94
Raise info to warning when we're not erroring on failure
Apr 10, 2025
798eae8
Add "-" before "DMKL_ILP64" CFLAGS
thanghn90 Apr 12, 2025
b0d5d5f
Fix linting issues
Apr 14, 2025
5c0adce
Deduplicate code by replacing get_cuda_device_code_and_ptx_architectu…
Apr 14, 2025
9c2167f
Grammar fix
Apr 14, 2025
4ba7942
Fix whitespace
Apr 14, 2025
8d94d87
Fix undefined name
Apr 14, 2025
4682aa9
Merge pull request #4850 from thanghn90/develop
Micket Apr 14, 2025
0b615e1
Create mock setup for get_cuda_object_dump_raw and get_cuda_architecture
Apr 15, 2025
f9e99a2
Fix naming in config and put in the correct (alphabetical) place in t…
Apr 15, 2025
aca934d
Make sure archives are also checked. Libary does _not_ seem to be an …
Apr 15, 2025
7fde91b
Initial (working) version of a unit test for get_cuda_object_dump_raw
Apr 15, 2025
2258d91
Fix hound issues
Apr 15, 2025
f782df8
More test cases
Apr 15, 2025
3ba1d7b
Remove a stray print statement
Apr 15, 2025
79d7084
Add remaining test cases for get_cuda_architecture and get_cuda_objec…
Apr 15, 2025
316e71f
Change if-elif-else into a nested if-else, with an if-if. This is sin…
Apr 15, 2025
494bd95
Don't keep accumulating the fail_msg after we have logged it
Apr 15, 2025
9e164e3
Merge pull request #4834 from Flamefire/super-calls
Micket Apr 15, 2025
8a9ea6d
added f to fstring...
Apr 15, 2025
a2960c2
Replace Surplus with Additional in warning
Apr 15, 2025
a62cdaa
Updateing toy builds. 10 test cases defined, of which 3 are implement…
Apr 15, 2025
11cf157
Architectures can be 9.0a or 10.0a now, i.e. sm_90a is a valid optimi…
Apr 16, 2025
8d9720e
Some missing f-strings and small refinements in the summary reporting…
Apr 16, 2025
b426226
Removed old tests and replaced them with new ones. New tests check al…
Apr 16, 2025
e53143e
Fix hound issues
Apr 16, 2025
5f533ea
Fix linting issues
Apr 16, 2025
2ee867b
Remove f-string, as there are no placeholders in this string
Apr 16, 2025
9c32b67
Fix unit test expected result
Apr 16, 2025
b9a670f
merge develop
Apr 17, 2025
3a82615
Merge pull request #4843 from Flamefire/fix-unbound-var
smoors Apr 22, 2025
2a1693c
Remove superflous assignment in _sanity_check_step
Flamefire Apr 23, 2025
b60302a
replace depecretation warning about reproducible tarballs on Python o…
lexming Apr 23, 2025
0a5a598
Enhance rpath sanity check to skip anything whose absolute path
jfgrimm Apr 23, 2025
517cbcd
fix typo
jfgrimm Apr 23, 2025
8c89fb9
linting
jfgrimm Apr 23, 2025
dd4d4db
Add warning if wrappers are being overwritten
ocaisa Apr 23, 2025
539bb56
Merge branch 'export_rpath_wrappers' of github.com:ocaisa/easybuild-f…
ocaisa Apr 23, 2025
ef951d9
Add warning if wrappers are being overwritten
ocaisa Apr 23, 2025
2e939a6
Use self.log.info instead of self.log.debug
jfgrimm Apr 23, 2025
d2cfb88
Merge pull request #4806 from Flamefire/nosource-checksum-fix
jfgrimm Apr 23, 2025
64a4b19
remove --rpath-wrappers-dir configuration option
boegel Apr 23, 2025
841b82b
copy rpath_args.py script alongside RPATH wrapper scripts, and use it
boegel Apr 23, 2025
e9e7870
avoid that test_toolchain_prepare_rpath_external produces output
boegel Apr 23, 2025
c863497
make sure that parent directory for RPATH wrappers exists before copy…
boegel Apr 23, 2025
4606da6
use relative path to rpath_args.py script when creating RPATH wrapper…
boegel Apr 23, 2025
62e0a28
only copy rpath_args.py script and use relative path to it when custo…
boegel Apr 23, 2025
f6f5e93
fix excessively long comments
boegel Apr 23, 2025
71cc6eb
Merge pull request #47 from boegel/export_rpath_wrappers
ocaisa Apr 23, 2025
8d8e70f
Merge pull request #4596 from ocaisa/export_rpath_wrappers
boegel Apr 23, 2025
d5fef2c
replace PATH_JOIN_TEMPLATE in ModuleGeneratorLua with _path_join_cmd(…
lexming Apr 24, 2025
8e46ad8
add support for environment variables in set_environment method of mo…
lexming Apr 24, 2025
5f3b4d1
fix formatting of inline comments in test_env
lexming Apr 24, 2025
788e925
update test_make_module_req to adapt to new _path_join_cmd method in …
lexming Apr 24, 2025
510f517
update test_make_module_step to adapt to new _path_join_cmd method in…
lexming Apr 24, 2025
67aeaa2
update test_toy_module_fulltxt to adapt to new _path_join_cmd method …
lexming Apr 24, 2025
72cdac7
update test_toy_python to adapt to new _path_join_cmd method in Modul…
lexming Apr 24, 2025
5c594ad
fix code formatting in test_make_module_step
lexming Apr 24, 2025
ad20bd0
update test_make_module_extra to adapt to new _path_join_cmd method i…
lexming Apr 24, 2025
354d0b6
Merge pull request #4854 from jfgrimm/rpath-sanity-resolve-path
lexming Apr 24, 2025
4d9f077
use new ModEnvVarType.STRICT_PATH_WITH_FILES for CMAKE_LIBRARY_PATH t…
lexming Apr 24, 2025
8a41852
update test_toy_module_fulltxt to new strcit type for CMAKE_LIBRARY_PATH
lexming Apr 24, 2025
a343eac
migrate EasyBlock.expand_module_search_path into ModuleEnvironmentVar…
lexming Apr 25, 2025
2abcf3c
replace test_expand_module_search_path with test_module_environment_v…
lexming Apr 25, 2025
144c28a
remove unused module from test.framework.modules
lexming Apr 25, 2025
df75916
remove unused module from test.framework.easyblock
lexming Apr 25, 2025
0dac7fa
print summary after the build
Apr 26, 2025
79e458a
Merge pull request #4861 from smoors/summary
branfosj Apr 30, 2025
e598740
Fix `is_patch_for` for patch dicts
Flamefire Apr 30, 2025
64ad44b
Promote debug output of ignored easyconfig to warning
Flamefire Apr 30, 2025
26d1d56
add context manager to handle fake modules in EasyBlock
lexming May 5, 2025
faf0720
generate fake modules for each extension installed instead of a singl…
lexming May 5, 2025
f3ce86e
resolve search paths in fake modules in the same way as regular modules
lexming May 5, 2025
dd6474a
replace explicit fake module creation in make_devel_module with fake_…
lexming May 5, 2025
e954997
replace explicit fake module creation in ExtensionEasyBlock sanity ch…
lexming May 5, 2025
7b0b55e
add test_extension_fake_modules to test.framework.easyblock
lexming May 5, 2025
bd183b3
set ext_defaultclass in test_extensions_sanity_check
lexming May 5, 2025
774d514
Merge branch 'develop' into fake-module-per-extension
lexming May 5, 2025
27004ab
prepare toolchain of extensions inside fake module environment
lexming May 6, 2025
dfcdeec
add exts_defaultclass to tests with extensions in test.framework.options
lexming May 6, 2025
fa7bb5a
add exts_defaultclass to tests with extensions in test.framework.toy_…
lexming May 6, 2025
3d20625
add exts_defaultclass to toy-0.0-gompi-2018a-test.eb
lexming May 6, 2025
458ba24
fix wrong usage of modextrapaths in toy-0.0-gompi-2018a-test.eb by us…
lexming May 6, 2025
a9489fa
update order of hooks in test_toy_build_hooks for per-extension fake …
lexming May 6, 2025
7e025b2
run skip_extensions inside a fake module environment
lexming May 6, 2025
c840ea9
fix diverging state between tests with depends_on enabled/disabled in…
lexming May 6, 2025
fea2ae1
maintain alphabetical order
May 7, 2025
d58e681
Merge branch 'develop' into low-warn-reprod-archives
boegel May 7, 2025
e1ee851
Merge pull request #4474 from smoors/data
branfosj May 7, 2025
7063bf9
implement exponential backoff in download_file + expose option to spe…
boegel May 7, 2025
84a1449
allow max. 8 attempts to download PR diff in fetch_files_from_pr
boegel May 7, 2025
1932e12
enhance test for download_file
boegel May 7, 2025
578fc5f
Merge pull request #4852 from lexming/low-warn-reprod-archives
boegel May 7, 2025
3db78ba
allow specifying initial wait time after first download attempt in do…
boegel May 7, 2025
eaa4b13
tweak max. wait time to download PR/commit diff to 10*(2^6) = 640sec …
boegel May 7, 2025
774620c
count the `data_sources`
branfosj May 8, 2025
e7a8a68
improved syntax
branfosj May 8, 2025
6950b51
Merge pull request #4873 from branfosj/count
jfgrimm May 8, 2025
57f5f81
include `data_sources` when checking checksums
branfosj May 9, 2025
1145a07
remember that sources can be a dict
branfosj May 9, 2025
d060c2f
Merge pull request #4874 from branfosj/check
smoors May 9, 2025
91e5089
use full words in summary
May 9, 2025
8a4e45b
Merge pull request #4875 from smoors/summary-full
branfosj May 10, 2025
4fb884b
Add a test that triggers the if missing_ptx_ccs: if path in ignore_fi…
May 12, 2025
a02d198
Remove blank line
May 12, 2025
45f659c
Now make sure test 1.a. actually fails on the test case @ocaisa found…
May 12, 2025
f9f3050
Fix the test so that it now passes once the issue is fixed... It was …
May 12, 2025
1a5cd5d
Fix the issue with the missing ignore_msg
May 12, 2025
19cfe04
Apply suggestions from code review
casparvl May 12, 2025
7e3a2dd
Remove check_cuobjdump, as it is not needed anymore
May 12, 2025
2442d44
Format file lists on separate lines for better readability of the logs
May 12, 2025
97cef2b
Still need to do some formatting, but things now go to trace output f…
May 12, 2025
8f0135a
add deprecation for EasyBlock.expand_module_search_path
lexming May 13, 2025
4fc1270
Merge pull request #4865 from Flamefire/fix-patch-for
lexming May 13, 2025
c358e27
Print both to trace output (with short version of advice), and to log…
May 13, 2025
588c342
Fix hound issues - and hopefully CI checks
May 13, 2025
09a182f
Fix missing condition
May 13, 2025
1787c47
Added missing f to f-string
May 13, 2025
0f85f13
Modify tests for the new syntax, and to also check the trace output
May 13, 2025
4b78bd7
Fix hound issues
May 13, 2025
581767c
Apply suggestions from code review
ocaisa May 14, 2025
55b757a
add constants for max. attempts and initial wait time for downloads
boegel May 14, 2025
660ee44
appease the Hound
boegel May 14, 2025
250d36a
Merge pull request #4870 from boegel/from_pr_retries
lexming May 14, 2025
22d90f4
obtain PR/commit diff via GitHub API rather than downloading `*.diff`…
boegel May 15, 2025
f027c51
Apply suggestions from code review
ocaisa May 15, 2025
8b6c40d
Apply suggestions from code review
ocaisa May 15, 2025
d6620d4
Apply suggestions from code review
ocaisa May 15, 2025
39e5561
Update easybuild/framework/easyblock.py
casparvl May 15, 2025
2bbfff9
Update easybuild/framework/easyblock.py
casparvl May 15, 2025
f009b7d
Fix unit tests for the new setup where we check if CUDA is a dep, ins…
May 15, 2025
a901ba5
Don't set EBROOTCUDA anymore, it's no longer needed
May 15, 2025
e304b17
Keep failure message short: just list the number of files, and refer …
May 15, 2025
4273f16
Make defining a non-empty failure message conditional on an actual fa…
May 15, 2025
c2cdb87
We don't need to track with is_failure, we can just check if any of t…
May 15, 2025
e9ec501
Fix too long line
May 15, 2025
a17a42c
Fix unit tests to accomodate for the difference in the error message …
May 15, 2025
fce140b
correctly use github_api_get_request in fetch_files_from_commit
boegel May 16, 2025
14e0b43
fix error message if commit diff could not be downloaded
boegel May 16, 2025
9923050
use develop branch for PRs that target removed 5.0.x branch in fetch_…
boegel May 16, 2025
bbb2a35
only wait in download_file when it makes sense to wait (when HTTP sta…
boegel May 16, 2025
8cf1be5
take into account that HTTPError may be raised when calling github_ap…
boegel May 16, 2025
dbaf194
Merge pull request #4880 from boegel/download_file_wait
ocaisa May 16, 2025
af43fab
Merge branch 'develop' into from_pr_commit_github_api
boegel May 16, 2025
bfaa974
also ignore errors raised during test step when --ignore-test-failure…
boegel May 16, 2025
11e3f08
enhance test_toy_failing_test_step to also check use of --ignore-test…
boegel May 16, 2025
7653e00
remove unused import
boegel May 16, 2025
0b91c33
fix error pattern in test_fetch_files_from_commit
boegel May 16, 2025
803f28d
avoid duplicate 'HTTP error' in error message when HTTPError is raise…
boegel May 16, 2025
8182a62
Merge pull request #4879 from boegel/fix_github_tests
branfosj May 16, 2025
9e9a3aa
Merge pull request #4848 from bartoldeman/iteropts-expand-all
boegel May 16, 2025
bb0a777
add 'shell_vars' option to modextravars to control resolution of shel…
lexming May 16, 2025
190156b
rename --cuda-sanity-check-error-on-fail to --cuda-sanity-check-error…
boegel May 16, 2025
b14cceb
Add fake modulefile for CUDA in Tcl format as well
May 16, 2025
abc108b
Spread over two writes
May 16, 2025
b6eb063
Merge branch 'develop' into cuda-device-code-sanity-check
May 16, 2025
6e212be
Merge pull request #4881 from boegel/fix_ignore_test_fail
lexming May 16, 2025
22858ec
also rename to --cuda-sanity-check-error-on-failed-checks in comments…
boegel May 16, 2025
2655a07
Merge pull request #2 from boegel/cuda-device-code-sanity-check
jfgrimm May 16, 2025
46de48e
Added possibility to exlunde environment variables from a report on-d…
Crivella May 14, 2025
fbf6a3a
lint
Crivella May 14, 2025
28c9b7b
Fix typo
Crivella May 15, 2025
2f8a1aa
Improved test and added default exclude regexes from known web-tokens
Crivella May 15, 2025
4e85b8d
Added default pattern for excluding environment variables based on name
Crivella May 15, 2025
f34baa5
lint
Crivella May 15, 2025
ada91d9
Update easybuild/tools/testing.py
Crivella May 15, 2025
ec5dc94
Improved test to check separately different default behaviors
Crivella May 16, 2025
04476d3
Fixed now failing test
Crivella May 16, 2025
ceacffa
also consider shared libraries under lib/python*/site-packages in CUD…
boegel May 16, 2025
76e9033
Merge pull request #4878 from boegel/from_pr_commit_github_api
smoors May 16, 2025
e73900c
Merge pull request #3 from boegel/cuda-device-code-sanity-check
jfgrimm May 16, 2025
7e92cd5
extend test_toy_cuda_sanity_check to also check whether shared librar…
boegel May 16, 2025
5cef2e0
Merge pull request #4 from boegel/cuda-device-code-sanity-check
jfgrimm May 16, 2025
270eb21
fix download progress bar
May 16, 2025
777a00e
part 2
May 16, 2025
9b12b1b
add CHECKSUMS_JSON constant for 'checksums.json'
boegel May 17, 2025
d7cc593
Merge pull request #2 from boegel/download-bar
smoors May 17, 2025
6e02e34
Merge pull request #4868 from lexming/fake-module-per-extension
boegel May 18, 2025
491b7a3
Merge pull request #4858 from lexming/fix-cmake-library-path
boegel May 18, 2025
33e0ded
rename decorator for obtain_file to update progress bar on return
boegel May 18, 2025
0d831da
Merge pull request #4885 from smoors/download-bar
boegel May 18, 2025
274a696
Merge branch 'develop' into modenvvar-expand-paths
lexming May 19, 2025
790f7a9
Support options for patch command
Flamefire May 20, 2025
637d149
Merge pull request #4886 from Flamefire/support-patch-opts
boegel May 20, 2025
a5891e7
Merge pull request #4851 from Flamefire/sanity-check-module-assign-re…
boegel May 20, 2025
1118cc0
Merge pull request #4692 from jfgrimm/cuda-device-code-sanity-check
boegel May 20, 2025
9cf65b5
Better variable names
Crivella May 20, 2025
4cf9c83
Simplified logic using the check inside the loop
Crivella May 20, 2025
aa4c879
check whether exts_defaultclass is set after call to prepare_for_exte…
boegel May 21, 2025
b0da73a
don't set exts_defaultclass in toy easyconfig that has extensions, re…
boegel May 21, 2025
e219933
Merge pull request #4888 from boegel/fix_exts_defaultclass_check
ocaisa May 21, 2025
510e8f0
minor changes to ModuleGenerator w.r.t. resolve environment variables…
boegel May 21, 2025
b3842b4
fix docstring + deprecation warning for ModuleGenerator.unpack_setenv…
boegel May 21, 2025
db919e4
rename 'shell_vars' options in modextravars to 'resolve_env_vars' (+ …
boegel May 21, 2025
9d0215e
mark EasyBlock.expand_module_search_path as removed, has been replace…
boegel May 21, 2025
7fa8b10
Revert changes for custom exclude patterns and only leave default ones
Crivella May 21, 2025
584b6f7
Merge pull request #11 from boegel/modenvvar-expand-paths
lexming May 21, 2025
3ce7693
Merge pull request #10 from boegel/modextra-envars
lexming May 21, 2025
4b57587
Merge pull request #4877 from Crivella/feature-exclude_env_from_report
boegel May 21, 2025
76d4e97
Merge pull request #4855 from lexming/modextra-envars
boegel May 21, 2025
0e469b0
Merge pull request #4859 from lexming/modenvvar-expand-paths
boegel May 21, 2025
3b44769
Update easyblock.py
pavelToman May 22, 2025
ee83e86
Update default.py
pavelToman May 22, 2025
df2830b
Update toy_build.py
pavelToman May 22, 2025
85c734c
Update easyblock.py - fix whitespace
pavelToman May 22, 2025
9dfac20
Update toy_build.py - fix whitespace
pavelToman May 22, 2025
99222ba
Fix dep-graph command: outdated import
lorisercole May 22, 2025
79f1f80
replace full trace message for extension check command with simple pa…
boegel May 23, 2025
202d628
use 'OK' instead of 'PASS' to keep output in sanity check more consis…
boegel May 23, 2025
3940f09
Merge pull request #4891 from lorisercole/fix/dep-graph
boegel May 23, 2025
7bc1f0e
Merge pull request #4892 from boegel/exts_check_msg
lexming May 23, 2025
e0ec34b
clean up logging for check_readelf_rpath in sanity_check_rpath
boegel May 23, 2025
1e655d4
only pick up check_readelf_rpath if check_readelf_rpath option passed…
boegel May 23, 2025
2689e8a
Merge pull request #4768 from pavelToman/patch-1
boegel May 23, 2025
d03abbb
prepare release notes for EasyBuild v5.1.0 + bump version to 5.1.0
boegel May 24, 2025
e0701df
fix fake_module_environment context manager, make sure that cleanup o…
boegel May 26, 2025
4b02c2c
also mention PR #4895 in release notes for EasyBuild v5.1.0
boegel May 26, 2025
8e6079e
Merge pull request #4895 from boegel/fix_fake_module_environment
lexming May 26, 2025
efab41e
Merge pull request #4893 from boegel/eb510
lexming May 26, 2025
8b79eb8
Merge pull request #4900 from easybuilders/5.1.x
boegel May 26, 2025
47a7c24
bump version to 5.1.1dev
boegel May 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 49 additions & 2 deletions easybuild/tools/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"""
import copy
import os
import re
import sys
from datetime import datetime
from time import gmtime, strftime
Expand All @@ -58,6 +59,48 @@

_log = fancylogger.getLogger('testing', fname=False)

DEFAULT_EXCLUDE_FROM_TEST_REPORT_ENV_VAR_NAMES = [
'KEY',
'SECRET',
'TOKEN',
'PASSWORD',
'API',
'AUTH',
'CREDENTIAL',
'PRIVATE',
'LICENSE',
'LICENCE',
]
DEFAULT_EXCLUDE_FROM_TEST_REPORT_VALUE_REGEX = [
# From PR comments https://github.com/easybuilders/easybuild-framework/pull/4877
r'AKIA[0-9A-Z]{16}', # AWS access key
r'[A-Za-z0-9/+=]{40}', # AWS secret key
r'eyJ[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+', # JWT token
r'gh[pousr]_[A-Za-z0-9_]{36,}', # GitHub token
r'xox[baprs]-[A-Za-z0-9-]+', # Slack token

# https://github.com/odomojuli/regextokens
# This is too aggressive and can end up excluding any alphanumeric string with length multiple of 4
# r'^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)?$', # Base64
r'[1-9][0-9]+-[0-9a-zA-Z]{40}', # Twitter token
r'EAACEdEose0cBA[0-9A-Za-z]+', # Facebook token
r'[0-9a-fA-F]{7}.[0-9a-fA-F]{32}', # Instagram token
r'AIza[0-9A-Za-z-_]{35}', # Google API key
r'4/[0-9A-Za-z-_]+', # Google OAuth 2.0 Auth code
r'ya29.[0-9A-Za-z-_]+', # Google OAuth 2.0 access token
r'[rs]k_live_[0-9a-z]{32}', # Picatic/Stripe API key
r'sqOatp-[0-9A-Za-z-_]{22}', # Square Access token
r'access_token,production$[0-9a-z]{161[0-9a,]{32}', # PayPal token
r'55[0-9a-fA-F]{32}', # Twilio token
r'key-[0-9a-zA-Z]{32}', # Mailgun API key
r'[0-9a-f]{32}-us[0-9]{1,2}', # Mailchimp API key
r'[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}', # Google Cloud Oauth 2.0 token
r'[A-Za-z0-9_]{21}--[A-Za-z0-9_]{8}', # Google Cloud API key
r'[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}', # Heroku token
r'sk-(.*-)?[A-Za-z0-9]{20}T3BlbkFJ[A-Za-z0-9]{20}', # OpenAI API key
r'waka_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}', # WakaTime API key
]


def regtest(easyconfig_paths, modtool, build_specs=None):
"""
Expand Down Expand Up @@ -265,8 +308,12 @@ def create_test_report(msg, ecs_with_res, init_session_state, pr_nrs=None, gist_
for key in sorted(environ_dump.keys()):
if env_filter is not None and env_filter.search(key):
continue
else:
environment += ["%s = %s" % (key, environ_dump[key])]
if any(x in key.upper() for x in DEFAULT_EXCLUDE_FROM_TEST_REPORT_ENV_VAR_NAMES):
continue
value = environ_dump[key]
if any(re.match(rgx, value) for rgx in DEFAULT_EXCLUDE_FROM_TEST_REPORT_VALUE_REGEX):
continue
environment += ["%s = %s" % (key, value)]

test_report.extend(["#### Environment", "```"] + environment + ["```"])

Expand Down
63 changes: 60 additions & 3 deletions test/framework/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -1317,26 +1317,83 @@ def test_github_create_test_report(self):
'log_file': logfile,
}),
]
environ = {
'USER': 'test',
}
JWT_HDR = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9'
JWT_PLD = 'eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNzA4MzQ1MTIzLCJleHAiOjE3MDgzNTUxMjN9'
JWT_SIG = 'SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c'
secret_environ = {
# Test default removal based on variable value
'TOTALLYPUBLICVAR1': 'AKIAIOSFODNN7EXAMPLE', # AWS_ACCESS_KEY
'TOTALLYPUBLICVAR2': 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY', # AWS_SECRET_KEY
'TOTALLYPUBLICVAR3': '.'.join([JWT_HDR, JWT_PLD, JWT_SIG]), # JWT
'TOTALLYPUBLICVAR4': 'ghp_123456789_ABCDEFGHIJKlmnopqrstuvwxyz', # GH_TOKEN
'TOTALLYPUBLICVAR5': 'xoxb-1234567890-1234567890123-ABCDEFabcdef', # SLACK_TOKEN

# Test default removal based on variable name
'API_SOMETHING': '1234567890',
'MY_PASSWORD': '1234567890',
'ABC_TOKEN': '1234567890',
'AUTH_XXX': '1234567890',
'LICENSE': '1234567890',
'WORLD_KEY': '1234567890',
'PRIVATE_INFO': '1234567890',
'SECRET_SECRET': '1234567890',
'INFO_CREDENTIALS': '1234567890',
}
init_session_state = {
'easybuild_configuration': ['EASYBUILD_DEBUG=1'],
'environment': {'USER': 'test'},
'environment': {**environ, **secret_environ},
'module_list': [{'mod_name': 'test'}],
'system_info': {'name': 'test'},
'time': gmtime(0),
}

res = create_test_report("just a test", ecs_with_res, init_session_state)
patterns = [
"**SUCCESS** _test.eb_",
"**FAIL (build issue)** _fail.eb_",
"01 Jan 1970 00:00:00",
"EASYBUILD_DEBUG=1",
"USER = test",
]
for pattern in patterns:
self.assertIn(pattern, res['full'])

for pattern in patterns[:2]:
# Test that known token regexes for ENV vars are excluded by default
exclude_patterns = [
'TOTALLYPUBLICVAR1',
'TOTALLYPUBLICVAR2',
'TOTALLYPUBLICVAR3',
'TOTALLYPUBLICVAR4',
'TOTALLYPUBLICVAR5',

'API_SOMETHING',
'MY_PASSWORD',
'ABC_TOKEN',
'AUTH_XXX',
'LICENSE',
'WORLD_KEY',
'PRIVATE_INFO',
'SECRET_SECRET',
'INFO_CREDENTIALS',
]
for pattern in exclude_patterns:
# .lower() test that variable name is not case sensitive for excluding
self.assertNotIn(pattern.lower(), res['full'])

res = create_test_report("just a test", ecs_with_res, init_session_state)
for pattern in patterns:
self.assertIn(pattern, res['full'])

for pattern in patterns[:2]:
self.assertIn(pattern, res['overview'])

for pattern in exclude_patterns:
# .lower() test that variable name is not case sensitive for excluding
self.assertNotIn(pattern.lower(), res['full'])

# mock create_gist function, we don't want to actually create a gist every time we run this test...
def fake_create_gist(*args, **kwargs):
return 'https://gist.github.com/%s/test' % GITHUB_TEST_ACCOUNT
Expand All @@ -1353,7 +1410,7 @@ def fake_create_gist(*args, **kwargs):
self.assertIn(pattern, res['full'])

for pattern in patterns[:3]:
self.assertIn(pattern, res['full'])
self.assertIn(pattern, res['overview'])

self.assertIn("**SUCCESS** _test.eb_", res['overview'])

Expand Down
36 changes: 28 additions & 8 deletions test/framework/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -3390,26 +3390,46 @@ def toy(extra_args=None):
return test_report_txt

# define environment variables that should (not) show up in the test report
test_var_secret = 'THIS_IS_JUST_A_SECRET_ENV_VAR_FOR_EASYBUILD'
os.environ[test_var_secret] = 'thisshouldremainsecretonrequest'
test_var_secret_regex = re.compile(test_var_secret)
# The name contains an auto-excluded pattern `SECRET`
test_var_secret_always = 'THIS_IS_JUST_A_SECRET_ENV_VAR_FOR_EASYBUILD'
os.environ[test_var_secret_always] = 'thisshouldremainsecretonrequest'
test_var_secret_always_regex = re.compile(test_var_secret_always)
# The name contains an autoexcluded value as a recognized GH token
test_var_secret_always2 = 'THIS_IS_JUST_A_TOTALLY_PUBLIC_ENV_VAR_FOR_EASYBUILD'
os.environ[test_var_secret_always2] = 'ghp_123456789_ABCDEFGHIJKlmnopqrstuvwxyz'
test_var_secret_always_regex2 = re.compile(test_var_secret_always2)
# This should be in general present and excluded on demand
test_var_secret_ondemand = 'THIS_IS_A_CUSTOM_ENV_VAR_FOR_EASYBUILD'
os.environ[test_var_secret_ondemand] = 'thisshouldbehiddenondemand'
test_var_secret_ondemand_regex = re.compile(test_var_secret_ondemand)
test_var_public = 'THIS_IS_JUST_A_PUBLIC_ENV_VAR_FOR_EASYBUILD'
os.environ[test_var_public] = 'thisshouldalwaysbeincluded'
test_var_public_regex = re.compile(test_var_public)

# default: no filtering
test_report_txt = toy()
self.assertTrue(test_var_secret_regex.search(test_report_txt))
self.assertTrue(test_var_secret_ondemand_regex.search(test_report_txt))
self.assertTrue(test_var_public_regex.search(test_report_txt))
for rgx in [
test_var_secret_always_regex,
test_var_secret_always_regex2,
]:
res = rgx.search(test_report_txt)
self.assertFalse(res, "No match for %s in %s" % (rgx.pattern, test_report_txt))

# filter out env vars that match specified regex pattern
filter_arg = "--test-report-env-filter=.*_SECRET_ENV_VAR_FOR_EASYBUILD"
filter_arg = "--test-report-env-filter=.*_IS_A_CUSTOM_ENV_VAR_FOR_EASYBUILD"
test_report_txt = toy(extra_args=[filter_arg])
res = test_var_secret_regex.search(test_report_txt)
self.assertFalse(res, "No match for %s in %s" % (test_var_secret_regex.pattern, test_report_txt))
for rgx in [
test_var_secret_ondemand_regex,
test_var_secret_always_regex,
test_var_secret_always_regex2,
]:
res = rgx.search(test_report_txt)
self.assertFalse(res, "No match for %s in %s" % (rgx.pattern, test_report_txt))
self.assertTrue(test_var_public_regex.search(test_report_txt))
# make sure that used filter is reported correctly in test report
filter_arg_regex = re.compile(r"--test-report-env-filter='.\*_SECRET_ENV_VAR_FOR_EASYBUILD'")
filter_arg_regex = re.compile(r"--test-report-env-filter='.\*_IS_A_CUSTOM_ENV_VAR_FOR_EASYBUILD'")
tup = (filter_arg_regex.pattern, test_report_txt)
self.assertTrue(filter_arg_regex.search(test_report_txt), "%s in %s" % tup)

Expand Down