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

Support project labels #1145

Merged
merged 11 commits into from
Feb 3, 2023
Merged

Support project labels #1145

merged 11 commits into from
Feb 3, 2023

Conversation

zlav
Copy link
Member

@zlav zlav commented Feb 2, 2023

Overview

The CLI should be able to handle a new “label” option which will allow a string parameter with the label name. Up to 5 label options can be provided. This data will be accepted by the CLI upload route.

The CLI route accepts an array of strings as a query param “labels”.

Acceptance criteria

  • Project labels are accepted through the command line and the configuration file.
  • Only 5 are accepted at a time

Testing plan

The route is already supported on FOSSA cloud, so testing this was as easy as enabling labels and ensuring that the correct behavior was met when setting a --project-label flag.

References

Checklist

  • I added tests for this PR's change (or explained in the PR description why tests don't make sense).
  • If this PR introduced a user-visible change, I added documentation into docs/.
  • If this change is externally visible, I updated Changelog.md. If this PR did not mark a release, I added my changes into an # Unreleased section at the top.
  • If I made changes to .fossa.yml or fossa-deps.{json.yml}, I updated docs/references/files/*.schema.json. You may also need to update these if you have added/removed new dependency type (e.g. pip) or analysis target type (e.g. poetry).

@zlav zlav requested a review from a team as a code owner February 2, 2023 18:20
@zlav zlav requested a review from csasarak February 2, 2023 18:20
Copy link
Contributor

@csasarak csasarak left a comment

Choose a reason for hiding this comment

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

I added some questions for things to consider, but lgtm.

docs/references/files/fossa-yml.md Outdated Show resolved Hide resolved
docs/references/files/fossa-yml.md Outdated Show resolved Hide resolved
@@ -517,6 +517,7 @@ collectScanDestination maybeCfgFile envvars AnalyzeCliOpts{..} =
else do
apiOpts <- collectApiOpts maybeCfgFile envvars commons
let metaMerged = maybe analyzeMetadata (mergeFileCmdMetadata analyzeMetadata) (maybeCfgFile)
when (length (projectLabel metaMerged) > 5) $ fatalText "Projects are only allowed to have 5 associated project labels"
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to add a unit test for the failure on > 5 behavior?

@zlav zlav merged commit bc28a0e into master Feb 3, 2023
@zlav zlav deleted the feat/project-labels branch February 3, 2023 04:31
This pull request was closed.
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.

2 participants