Skip to content

Conversation

sfc-gh-jwilkowski
Copy link
Contributor

Pre-review checklist

  • I've confirmed that instructions included in README.md are still correct after my changes in the codebase.
  • I've added or updated automated unit tests to verify correctness of my new code.
  • I've added or updated integration tests to verify correctness of my new code.
  • I've confirmed that my changes are working by executing CLI's commands manually on MacOS.
  • I've confirmed that my changes are working by executing CLI's commands manually on Windows.
  • I've confirmed that my changes are up-to-date with the target branch.
  • I've described my changes in the release notes.
  • I've described my changes in the section below.

Changes description

...

@sfc-gh-snowflakedb-snyk-sa
Copy link
Contributor

sfc-gh-snowflakedb-snyk-sa commented Mar 21, 2025

🎉 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)

@sfc-gh-jwilkowski sfc-gh-jwilkowski force-pushed the jw/SNOW-1942875-init-cicd-templates branch from 9df5bfd to d4088d9 Compare March 21, 2025 12:12
@sfc-gh-jwilkowski sfc-gh-jwilkowski force-pushed the jw/SNOW-1942875-init-cicd-templates branch from d4088d9 to 2dc6ebb Compare March 21, 2025 13:11
@@ -0,0 +1,13 @@
# Copyright (c) 2025 Snowflake Inc.
Copy link
Collaborator

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:
Copy link
Collaborator

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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leftover file

Comment on lines +297 to +307
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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(
Copy link
Collaborator

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.",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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,
Copy link
Collaborator

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)
Copy link
Collaborator

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants