Skip to content
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

[DPG] update quick-start-tool #24942

Merged
merged 21 commits into from
Jun 23, 2022
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
f1aeb2f
Merge pull request #1 from Azure/master
BigCat20196 Jun 7, 2021
89cb1ee
Merge pull request #2 from Azure/main
BigCat20196 Jun 21, 2021
ceb1300
Merge pull request #3 from Azure/main
BigCat20196 Jul 1, 2021
23da66e
Merge pull request #4 from Azure/main
BigCat20196 Jul 7, 2021
25145b5
Merge pull request #5 from Azure/main
BigCat20196 Jul 9, 2021
b24885e
Merge pull request #6 from Azure/main
BigCat20196 Jul 12, 2021
2ef256c
Merge pull request #7 from Azure/main
BigCat20196 Jul 27, 2021
10a97e5
Merge pull request #8 from Azure/main
BigCat20196 Aug 4, 2021
24f65c3
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python …
BigCat20196 Oct 9, 2021
3fdba01
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python …
BigCat20196 Oct 12, 2021
3e8eb8e
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python …
BigCat20196 Oct 13, 2021
92b06a6
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python …
BigCat20196 Oct 28, 2021
40ce8cc
Merge branch 'main' of https://github.com/BigCat20196/azure-sdk-for-p…
BigCat20196 Jun 22, 2022
675245f
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python …
BigCat20196 Jun 22, 2022
3426f55
add generate ci
BigCat20196 Jun 22, 2022
60a00e5
fix ci template path]
BigCat20196 Jun 22, 2022
6ad3264
update
BigCat20196 Jun 22, 2022
c641384
update
BigCat20196 Jun 22, 2022
38c4a40
format
BigCat20196 Jun 22, 2022
eb5146e
Update scripts/quickstart_tooling_dpg/main.py
msyyc Jun 23, 2022
7571f00
Update scripts/quickstart_tooling_dpg/main.py
msyyc Jun 23, 2022
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
25 changes: 25 additions & 0 deletions scripts/quickstart_tooling_dpg/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
_TEMPLATE = Path(__file__).resolve().parent / "template"
_TEMPLATE_TESTS = Path(__file__).resolve().parent / "template_tests"
_TEMPLATE_SAMPLES = Path(__file__).resolve().parent / "template_samples"
_TEMPLATE_CI = Path(__file__).resolve().parent / "template_ci"


def check_parameters(
Expand All @@ -25,6 +26,27 @@ def check_parameters(
_LOGGER.info(f'{output} is created')


def generate_ci(template_path: Path, folder_path: Path, package_name: str) -> None:
ci = Path(folder_path, "ci.yml")
ci_template_path = template_path / 'ci.yml'
service_name = folder_path.name
name = package_name.split('-')[-1]
if not ci.exists():
with open(ci_template_path, "r") as file_in:
content = file_in.readlines()
content = [line.replace("ServiceName", service_name).replace('PackageName', name) for line in content]
else:
with open(str(ci), "r") as file_in:
msyyc marked this conversation as resolved.
Show resolved Hide resolved
content = file_in.readlines()
for line in content:
if f'{package_name}\n' in line:
return
content.append(f' - name: {package_name}\n')
content.append(f' safeName: {package_name.replace("-", "")}\n')
with open(str(ci), "w") as file_out:
msyyc marked this conversation as resolved.
Show resolved Hide resolved
file_out.writelines(content)


def generate_test_sample(template_path: Path, target_path: Path, **kwargs: Any) -> None:
if not os.path.exists(target_path):
os.makedirs(target_path)
Expand Down Expand Up @@ -71,6 +93,9 @@ def build_package(**kwargs) -> None:
_LOGGER.info("Build start: %s", package_name)
check_parameters(output_folder)

#generate ci
generate_ci(_TEMPLATE_CI, Path(output_folder).parent, package_name)

# generate swagger readme
env = Environment(loader=FileSystemLoader(_TEMPLATE), keep_trailing_newline=True)
swagger_readme = generate_swagger_readme(output_folder, env, **kwargs)
Expand Down
33 changes: 33 additions & 0 deletions scripts/quickstart_tooling_dpg/template_ci/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# DO NOT EDIT THIS FILE
# This file is generated automatically and any changes will be lost.

trigger:
branches:
include:
- main
- hotfix/*
- release/*
- restapi*
paths:
include:
- sdk/ServiceName/

pr:
branches:
include:
- main
- feature/*
- hotfix/*
- release/*
- restapi*
paths:
include:
- sdk/ServiceName/

extends:
template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml
parameters:
ServiceDirectory: ServiceName
Artifacts:
- name: azure-mgmt-PackageName
safeName: azuremgmtPackageName