Skip to content

Commit

Permalink
feat: automatically analyze newly created projects (#514)
Browse files Browse the repository at this point in the history
This change forces analysis when a new project is created. This ensures
the project is initially populated with results in the Phylum UI, which
helps for users configuring Phylum analysis exclusively through the CI
integrations. This is doubly true when the set of dependency files do
not include a manifest, which is the other trigger for automatically
forcing analysis.

The desire expressed from users of the integrations is that setting up
the integration and running it the first time should cause the project
dependencies to be ingested without needing to set the
`--force-analysis` flag or wait until a PR with a modified dependency
file emerges. They also don't want to have to use the Phylum CLI to
populate the project(s) before scanning them with the CI integrations.
  • Loading branch information
maxrake authored Dec 13, 2024
1 parent 85d69fa commit 2683fe4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/phylum/ci/ci_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,8 @@ def _ensure_project_exists(self) -> None:
LOG.info(cleandoc(project_created_msg))
if self._project_file_already_existed:
LOG.warning("Overwrote previous `.phylum_project` file found at: %s", self._phylum_project_file)
LOG.warning("Forcing analysis to ensure new project is initially populated ...")
self._force_analysis = True

def _created_group(self) -> bool:
"""Ensure a Phylum group is created and in place, when specified.
Expand Down
4 changes: 2 additions & 2 deletions src/phylum/ci/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ def get_args(args: Optional[Sequence[str]] = None) -> tuple[argparse.Namespace,
"-f",
"--force-analysis",
action="store_true",
help="""Specify this flag to force analysis, even when no dependency file has changed. This flag is implicitly
set when *any* manifest is included, to maximize the chance that updated dependencies are accounted.""",
help="""Specify this flag to force analysis, even when no dependency file has changed. Implicitly set for newly
created projects or when *any* manifest is included, to account for possible dependency updates.""",
)
analysis_group.add_argument(
"-k",
Expand Down

0 comments on commit 2683fe4

Please sign in to comment.