-
Notifications
You must be signed in to change notification settings - Fork 79
Jw/snow 1942875 init cicd templates #2135
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
base: main
Are you sure you want to change the base?
Conversation
🎉 Snyk checks have passed. No issues have been found so far.✅ security/snyk check is complete. No issues have been found. (View Details) ✅ license/snyk check is complete. No issues have been found. (View Details) |
9df5bfd
to
d4088d9
Compare
d4088d9
to
2dc6ebb
Compare
@@ -0,0 +1,13 @@ | |||
# Copyright (c) 2025 Snowflake Inc. |
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.
I'd put that module inside init
plugin (../_plugins/init/cicd
) - currently it is not used by any other context and is not providing new commands
raise ClickException(f"Can not merge template with {type(other)}") | ||
|
||
errors = [] | ||
if self.minimum_cli_version != other.minimum_cli_version: |
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.
Why not just using max
here?
@@ -0,0 +1,24 @@ | |||
# Copyright (c) 2024 Snowflake Inc. |
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.
Leftover file
if _is_remote_source(template_source): | ||
template_root = _fetch_remote_template( | ||
url=template_source, path=template, destination=tmpdir # type: ignore | ||
) | ||
else: | ||
template_root = _fetch_local_template( | ||
template_source=SecurePath(template_source), | ||
path=template, | ||
destination=tmpdir, | ||
) | ||
return template_root |
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.
if _is_remote_source(template_source): | |
template_root = _fetch_remote_template( | |
url=template_source, path=template, destination=tmpdir # type: ignore | |
) | |
else: | |
template_root = _fetch_local_template( | |
template_source=SecurePath(template_source), | |
path=template, | |
destination=tmpdir, | |
) | |
return template_root | |
if _is_remote_source(template_source): | |
return _fetch_remote_template( | |
url=template_source, path=template, destination=tmpdir # type: ignore | |
) | |
return _fetch_local_template( | |
template_source=SecurePath(template_source), | |
path=template, | |
destination=tmpdir, | |
) |
return MessageResult(f"Initialized the new project in {path}") | ||
|
||
|
||
def clone( |
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.
"_fetch_cicd_template" would be a better name - "clone" assumes the template lives in remote repo
CIProviderOption = typer.Option( | ||
None, | ||
"--ci-provider", | ||
help=f"CI provider to generate workflow for.", |
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.
help=f"CI provider to generate workflow for.", | |
help=f"generate CI/CD workflow for given provider.", |
template: Optional[str] = TemplateOption, | ||
template_source: Optional[str] = SourceOption, | ||
ci_provider: Optional[CIProviderChoices] = CIProviderOption, | ||
ci_template_source: Optional[str] = CITemplateSourceOption, |
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.
Can we validate that "ci_provider" must be defined if "ci_template_source" is procided?
|
||
|
||
def post_generate(template_root: SecurePath, ci_provider: Optional[CIProvider]): | ||
CIProviderManager.project_post_gen_cleanup(ci_provider, template_root) |
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.
Why is this needed? What we assume about Ci/CD templates?
Pre-review checklist
Changes description
...