Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
17d1d96
enabling samples for azure-storage code
scbedd Jul 3, 2019
f097b09
Merge remote-tracking branch 'upstream/master'
scbedd Jul 12, 2019
6e9d154
Merge remote-tracking branch 'upstream/master'
scbedd Jul 15, 2019
1ffc224
Merge remote-tracking branch 'upstream/master'
scbedd Jul 22, 2019
163a161
Merge remote-tracking branch 'upstream/master'
scbedd Jul 23, 2019
abbed4e
Merge branch 'master' of https://github.com/scbedd/azure-sdk-for-python
scbedd Aug 7, 2019
164d415
individually run tests
scbedd Aug 7, 2019
c0c96da
handling test collection now
scbedd Aug 7, 2019
7eeec06
black
scbedd Aug 7, 2019
b58e88f
uncommenting code that had been commented to speed up dev loop
scbedd Aug 7, 2019
610081f
updating comments
scbedd Aug 7, 2019
3f12f1f
delibrately introducing failure to ensure that a failing test case pr…
scbedd Aug 7, 2019
e5be6f5
resolving failure. the tests all finish, but the CI step does properl…
scbedd Aug 7, 2019
affc652
properly handling the allowed return codes
scbedd Aug 7, 2019
d42e864
adjusting error output.
scbedd Aug 7, 2019
d2ea1b2
add azure-nspkg to the list of allowed return code 5
scbedd Aug 7, 2019
495b15f
leveraging logging module for build status output. as a happy acciden…
scbedd Aug 8, 2019
a824856
handling --cov vs --cov-append
scbedd Aug 8, 2019
21aa013
Merge branch 'consecutive-test-runs' of https://github.com/scbedd/azu…
scbedd Aug 8, 2019
68d1150
running black
scbedd Aug 8, 2019
ac37a7f
Merge remote-tracking branch 'upstream/master'
scbedd Aug 8, 2019
af05f08
Merge remote-tracking branch 'upstream/master'
scbedd Aug 9, 2019
83c7f82
Merge branch 'master' of https://github.com/scbedd/azure-sdk-for-python
scbedd Aug 9, 2019
a7f1fd7
Merge branch 'master' into consecutive-test-runs
scbedd Aug 9, 2019
698dd8b
handling the case where the very first library doesn't have any tests…
scbedd Aug 11, 2019
88b2c2d
adding a comment so this is clear
scbedd Aug 11, 2019
5260fdc
attempting with cov-append
scbedd Aug 11, 2019
0c5946e
removing duration output. logging number
scbedd Aug 11, 2019
8685c08
comment
scbedd Aug 11, 2019
c30d31a
trying without --cov-append. if the performance goes back up, will sw…
scbedd Aug 11, 2019
979cc9c
--cov-append performs HORRIFICALLY. doing manual combination into roo…
scbedd Aug 12, 2019
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
2 changes: 1 addition & 1 deletion .azure-pipelines/tests-nightly-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ jobs:
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFiles: 'junit/test-results.xml'
testResultsFiles: '**/junit/test-results.xml'
testRunTitle: '$(OSName) Python $(PythonVersion)'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ env*/

# Coverage report
**/.coverage
_coverage

# Build results
bin/
Expand Down
2 changes: 1 addition & 1 deletion eng/pipelines/templates/steps/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ steps:
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFiles: 'junit/test-results.xml'
testResultsFiles: '**/junit/test-results.xml'
testRunTitle: '${{ parameters.OSName }} Python ${{ parameters.PythonVersion }}'
58 changes: 39 additions & 19 deletions scripts/devops_tasks/build_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,42 +15,62 @@

from common_tasks import process_glob_string, run_check_call

root_dir = os.path.abspath(os.path.join(os.path.abspath(__file__), '..', '..', '..'))
build_packing_script_location = os.path.join(root_dir, 'build_package.py')
root_dir = os.path.abspath(os.path.join(os.path.abspath(__file__), "..", "..", ".."))
build_packing_script_location = os.path.join(root_dir, "build_package.py")


def build_packages(targeted_packages, distribution_directory):
# run the build and distribution
for package_name in targeted_packages:
print(package_name)
print('Generating Package Using Python {}'.format(sys.version))
run_check_call(['python', build_packing_script_location, '--dest', distribution_directory, package_name], root_dir)
print("Generating Package Using Python {}".format(sys.version))
run_check_call(
[
"python",
build_packing_script_location,
"--dest",
distribution_directory,
package_name,
],
root_dir,
)


if __name__ == '__main__':
parser = argparse.ArgumentParser(description = 'Build Azure Packages, Called from DevOps YAML Pipeline')
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Build Azure Packages, Called from DevOps YAML Pipeline"
)
parser.add_argument(
'-d',
'--distribution-directory',
dest='distribution_directory',
help='The path to the distribution directory. Should be passed $(Build.ArtifactStagingDirectory) from the devops yaml definition.',
required=True)
"-d",
"--distribution-directory",
dest="distribution_directory",
help="The path to the distribution directory. Should be passed $(Build.ArtifactStagingDirectory) from the devops yaml definition.",
required=True,
)

parser.add_argument(
'glob_string',
nargs='?',
help=('A comma separated list of glob strings that will target the top level directories that contain packages. '
'Examples: All == "azure-*", Single = "azure-keyvault"'))
"glob_string",
nargs="?",
help=(
"A comma separated list of glob strings that will target the top level directories that contain packages. "
'Examples: All == "azure-*", Single = "azure-keyvault"'
),
)

parser.add_argument(
'--service',
help=('Name of service directory (under sdk/) to build.'
'Example: --service applicationinsights'))
"--service",
help=(
"Name of service directory (under sdk/) to build."
"Example: --service applicationinsights"
),
)

args = parser.parse_args()

# We need to support both CI builds of everything and individual service
# folders. This logic allows us to do both.
if args.service:
service_dir = os.path.join('sdk', args.service)
service_dir = os.path.join("sdk", args.service)
target_dir = os.path.join(root_dir, service_dir)
else:
target_dir = root_dir
Expand Down
64 changes: 50 additions & 14 deletions scripts/devops_tasks/common_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,37 @@
from subprocess import check_call, CalledProcessError
import os
import sys
import logging

logging.getLogger().setLevel(logging.INFO)

OMITTED_CI_PACKAGES = ["azure-mgmt-documentdb", "azure-servicemanagement-legacy"]


def cleanup_folder(target_folder):
for file in os.listdir(target_folder):
file_path = os.path.join(target_folder, file)
try:
if os.path.isfile(file_path):
os.remove(file_path)
except Exception as e:
print(e)

DEFAULT_BUILD_PACKAGES = ['azure-keyvault', 'azure-servicebus']
OMITTED_CI_PACKAGES = ['azure-mgmt-documentdb', 'azure-servicemanagement-legacy']

# this function is where a glob string gets translated to a list of packages
# It is called by both BUILD (package) and TEST. In the future, this function will be the central location
# for handling targeting of release packages
def process_glob_string(glob_string, target_root_dir):
if glob_string:
individual_globs = glob_string.split(',')
individual_globs = glob_string.split(",")
else:
individual_globs = DEFAULT_BUILD_PACKAGES
individual_globs = "azure-*"
collected_top_level_directories = []

for glob_string in individual_globs:
globbed = glob.glob(os.path.join(target_root_dir, glob_string, 'setup.py')) + glob.glob(os.path.join(target_root_dir, "sdk/*/", glob_string, 'setup.py'))
globbed = glob.glob(
os.path.join(target_root_dir, glob_string, "setup.py")
) + glob.glob(os.path.join(target_root_dir, "sdk/*/", glob_string, "setup.py"))
collected_top_level_directories.extend([os.path.dirname(p) for p in globbed])

# dedup, in case we have double coverage from the glob strings. Example: "azure-mgmt-keyvault,azure-mgmt-*"
Expand All @@ -43,20 +58,41 @@ def process_glob_string(glob_string, target_root_dir):
else:
return remove_omitted_packages(collected_directories)


def remove_omitted_packages(collected_directories):
return [package_dir for package_dir in collected_directories if
os.path.basename(package_dir) not in OMITTED_CI_PACKAGES]
return [
package_dir
for package_dir in collected_directories
if os.path.basename(package_dir) not in OMITTED_CI_PACKAGES
]


def run_check_call(command_array, working_directory, acceptable_return_codes = [], run_as_shell = False):
def run_check_call(
command_array,
working_directory,
acceptable_return_codes=[],
run_as_shell=False,
always_exit=True,
):
try:
if run_as_shell:
print('Command Array: {0}, Target Working Directory: {1}'.format(' '.join(command_array), working_directory))
check_call(' '.join(command_array), cwd = working_directory, shell = True)
logging.info(
"Command Array: {0}, Target Working Directory: {1}".format(
" ".join(command_array), working_directory
)
)
check_call(" ".join(command_array), cwd=working_directory, shell=True)
else:
print('Command Array: {0}, Target Working Directory: {1}'.format(command_array, working_directory))
check_call(command_array, cwd = working_directory)
logging.info(
"Command Array: {0}, Target Working Directory: {1}".format(
command_array, working_directory
)
)
check_call(command_array, cwd=working_directory)
except CalledProcessError as err:
if err.returncode not in acceptable_return_codes:
print(err) #, file = sys.stderr
sys.exit(1)
logging.error(err) # , file = sys.stderr
if always_exit:
exit(1)
else:
return err
Loading