-
Notifications
You must be signed in to change notification settings - Fork 5k
ci: fix warnings with wildcards and archive system-tests #18695
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
Changes from 14 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
9f725c1
ci: fix warnings with wildcards
v1v ecceee2
ci: use make as a wrapper and python as the implementation
v1v a9c95d9
ci: support windows
v1v 3f2c1bc
fix: autopep8 lint
v1v 809b906
fix symlinks, permissions and use python instead make
v1v b66aa23
more verbose, skip some folders that causes issues in windows
v1v 660ddd1
Support multiplatform and overriide copy_tree to filter problematic f…
v1v 594eb00
platform agnostic
v1v f5c4ad8
comment to support system-tests
v1v 57541c3
prepare context to filter what to archive
v1v dc124f5
refactor and support system-tests search for Linux
v1v 714c8ed
Support system-tests archiving in windows
v1v 324870c
fix: script path
v1v 8605d36
Force where to look for
v1v 7de9a9c
Update .ci/scripts/pre_archive_test.py
v1v 8b737da
ci: use cmd step
v1v 5150beb
ci: rephrase a bit the docs
v1v b6606c4
Update Jenkinsfile
v1v ee7f570
fix: use hardcode paths
v1v fd04fee
Merge remote-tracking branch 'upstream/master' into feature/fix-warni…
v1v 6557388
ci: cosmetic change in the log
v1v bd8d0d5
fix: the evil regex in groovy with backslashes
v1v 626840d
Revert "fix: use hardcode paths"
v1v 6af8dfb
Support OS in the name of the archived files
v1v 1a069b1
Merge remote-tracking branch 'upstream/master' into feature/fix-warni…
v1v f7a03a6
ci: platform agnostic
v1v 1838113
ci: fix the script approval for File.Separator
v1v cf807c2
Merge remote-tracking branch 'upstream/master' into feature/fix-warni…
v1v 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,34 @@ | ||
| #!/usr/bin/env python3 | ||
|
|
||
| import os | ||
| import distutils | ||
| from distutils import dir_util | ||
|
|
||
| # Support filtering in the distutils.dir_util.copy_tree | ||
| #ORIG_COPY_TREE = distutils.dir_util.copy_tree | ||
| # | ||
| # | ||
| # def my_copy_tree(src, *args, **kwargs): | ||
| # '''function my_copy_tree | ||
| # Override distutils.dir_util.copy_tree to filter the system-tests | ||
| # ''' | ||
| # if src.endswith('system-tests'): | ||
| # return [] | ||
| # return ORIG_COPY_TREE(src, *args, **kwargs) | ||
| # | ||
| # | ||
| #distutils.dir_util.copy_tree = my_copy_tree | ||
v1v marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| if __name__ == "__main__": | ||
|
|
||
| if not os.path.exists('build'): | ||
| os.makedirs('build') | ||
|
|
||
| # Top level folders to be excluded | ||
| EXCLUDE = set(['.ci', '.git', '.github', 'vendor', 'dev-tools']) | ||
| for root, dirs, files in os.walk('.'): | ||
| dirs[:] = [d for d in dirs if d not in EXCLUDE] | ||
| if root.endswith(('build')) and not root.startswith((".{}build".format(os.sep))): | ||
| dest = os.path.join('build', root.replace(".{}".format(os.sep), '')) | ||
| print("Copy {} into {}".format(root, dest)) | ||
| distutils.dir_util.copy_tree(root, dest, preserve_symlinks=1) | ||
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,10 @@ | ||
| #!/usr/bin/env python3 | ||
|
|
||
| import os | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
|
|
||
| for root, dirs, files in os.walk('build'): | ||
| if root.endswith(('system-tests')): | ||
| print(root.replace(".{}".format(os.sep), '')) |
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 |
|---|---|---|
|
|
@@ -847,17 +847,62 @@ def withBeatsEnv(boolean archive, Closure body) { | |
| } | ||
| } finally { | ||
| if (archive) { | ||
| catchError(buildResult: 'SUCCESS', stageResult: 'UNSTABLE') { | ||
| junitAndStore(allowEmptyResults: true, keepLongStdio: true, testResults: "**/build/TEST*.xml") | ||
| archiveArtifacts(allowEmptyArchive: true, artifacts: '**/build/TEST*.out') | ||
| } | ||
| archiveTestOutput(testResults: '**/build/TEST*.xml', artifacts: '**/build/TEST*.out') | ||
| } | ||
| reportCoverage() | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| This method archives and report the tests output. | ||
| It searches for certain folders to bypass some issues when working with big repositories. In addition, | ||
|
||
|
|
||
| OUTPUT: | ||
| - JUnit | ||
| - Artifacts in Jenkins | ||
| - Artifacts in GCP | ||
| */ | ||
| def archiveTestOutput(Map args = [:]) { | ||
| catchError(buildResult: 'SUCCESS', stageResult: 'UNSTABLE') { | ||
| if (isUnix()) { | ||
| fixPermissions("${WORKSPACE}") | ||
| } | ||
| shOrBat(label: 'Prepare test output', script: 'python .ci/scripts/pre_archive_test.py') | ||
mdelapenya marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| dir('build') { | ||
| junitAndStore(allowEmptyResults: true, keepLongStdio: true, testResults: args.testResults) | ||
| archiveArtifacts(allowEmptyArchive: true, artifacts: args.artifacts) | ||
| } | ||
| catchError(buildResult: 'SUCCESS', message: 'Failed to archive the build test results', stageResult: 'SUCCESS') { | ||
| def folder = shOrBat(label: 'Find system-tests', returnStdout: true, script: 'python .ci/scripts/search_system_tests.py') | ||
| log(level: 'INFO', text: "system-tests has been found in ${folder}") | ||
| if (folder.trim()) { | ||
| def name = folder.replaceAll('/', '-').replaceAll('\\', '-').replaceAll('build', '') | ||
| tar(file: "${name}.tgz", archive: true, dir: folder) | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| This method encapsulates the OS shell. | ||
| */ | ||
| def shOrBat(Map args = [:]) { | ||
| if (isUnix()) { | ||
| return sh(args) | ||
| } else { | ||
| def command = args.script | ||
| if (args.containsKey('returnStdout') && args.returnStdout) { | ||
| command = """@echo off | ||
| ${args.script} | ||
| """ | ||
| args.script = command | ||
| } | ||
| return bat(args) | ||
| } | ||
| } | ||
|
|
||
| def withBeatsEnvWin(Closure body) { | ||
| final String chocoPath = 'C:\\ProgramData\\chocolatey\\bin' | ||
| final String chocoPython3Path = 'C:\\Python38;C:\\Python38\\Scripts' | ||
|
|
@@ -881,10 +926,7 @@ def withBeatsEnvWin(Closure body) { | |
| body() | ||
| } | ||
| } finally { | ||
| catchError(buildResult: 'SUCCESS', stageResult: 'UNSTABLE') { | ||
| junitAndStore(allowEmptyResults: true, keepLongStdio: true, testResults: "**\\build\\TEST*.xml") | ||
| archiveArtifacts(allowEmptyArchive: true, artifacts: '**\\build\\TEST*.out') | ||
| } | ||
| archiveTestOutput(testResults: "**\\build\\TEST*.xml", artifacts: "**\\build\\TEST*.out") | ||
| } | ||
| } | ||
| } | ||
|
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.