Skip to content

Conversation

@anuccio1
Copy link
Contributor

@anuccio1 anuccio1 commented Feb 22, 2018

Some notes:

  • There is a fossa-core PR: https://github.com/fossas/FOSSA/pull/2339

  • custom (custom) is the fetcher for managed builds

  • It doesn't make sense to me that locator is a config option (i removed it). Users should not need to know and understand the locator spec, i.e. know where to put git+ and $. We should just infer all of this.

  • I added a ExistingProject config value that defaults to false. If set to true, then they are adding an existing fossa repo.

NOTE: might not be the best way to implement default behavior, as existing users builds will need to be updated

@anuccio1 anuccio1 requested review from elldritch and xizhao February 22, 2018 09:07
Copy link
Contributor

@elldritch elldritch left a comment

Choose a reason for hiding this comment

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

Nits. I'd prefer custom over cust. It's not that much longer and makes a lot more sense.

Generally LGTM.

Server string
Fetcher string // for now we don't allow users to set this
Project string
Revision string
Copy link
Contributor

Choose a reason for hiding this comment

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

A few notes here:

  • I'm not sure how I feel about changing this because we already have customers using fossa live and this is potentially a breaking change to their configurations.
  • That said, I don't think anybody sets the Locator field, so changing this should be relatively safe.
  • Users can already specify project and revision via command line flags. This struct only defines the format of the configuration file, and is different from the shape of the configuration struct we use internally. I think I might actually prefer taking out Locator and not putting anything else in -- when would anybody ever want to specify revision via configuration file?

func initialize(c *cli.Context) (cliConfig, error) {
var config = cliConfig{
apiKey: c.String("api_key"),
fetcher: c.String("fetcher"),
Copy link
Contributor

Choose a reason for hiding this comment

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

If we don't want users to set this, we should probably not include it as a flag.

if config.project == "" {
analysisLogger.Fatal("could not infer project name from either `.fossa.yaml` or `git` remote named `origin`")
if config.revision == "" {
analysisLogger.Fatal("could not infer revision name from either `.fossa.yml` or `git` remote named `origin`")
Copy link
Contributor

Choose a reason for hiding this comment

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

[nit] These log statements should actually be Sentence case.

@xizhao
Copy link
Contributor

xizhao commented Feb 23, 2018

I understand this is WIP. I think the ideal flow is to use the custom response code to initiate a project creation workflow, so if we run into a case where we need to create a managed project, the CLI will ask the user for some info and it will write to config.

We should automatically figure out how to generate an id, maybe we could do something like
custom+{ORGID-HASH}_{VCS_HASH}${revision} and validate server side the orgid hash.

VCS_HASH should be consistently generated by fossa-cli so this is portable among different environments even if we miss config.

fossa-cli should by default be submitting the reference for our unresolved {revision}, and have fossa-core resolve the reference ID to a newly created revision id.

@anuccio1 anuccio1 force-pushed the alex/managed-builds branch 2 times, most recently from 5d8bcc2 to 6d3d3d4 Compare February 28, 2018 22:41
@anuccio1 anuccio1 force-pushed the alex/managed-builds branch from 83e29bd to 4d9806c Compare March 1, 2018 06:16
if revision == "" {
revision, err := repo.Head()
if err == nil {
c.CLI.Revision = revision.Hash().String()
Copy link
Contributor

Choose a reason for hiding this comment

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

will this get written to config in fossa init? we don't want to write the revision unless it was specified in config

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no

config/config.go Outdated
Modules: modules,
Debug: c.Bool("debug"),
ConfigFilePath: c.String("config"),
ExistingProject: c.Bool("existing_project"),
Copy link
Contributor

Choose a reason for hiding this comment

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

This shouldn't be a separate flag -- instead the user should just specify the project in cli or config.

i.e. if I want it to be an existing project, I specify it in .fossa.yml; i don't need another flag

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good idea

Copy link
Contributor Author

Choose a reason for hiding this comment

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

what if it's a custom project though? No github repo?

Copy link
Contributor

Choose a reason for hiding this comment

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

That's fine, then it will fail to config and be blank, which will require user to specify

Copy link
Contributor

Choose a reason for hiding this comment

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

That's fine, then it will fail to config and be blank, which will require user to specify

Copy link
Contributor Author

Choose a reason for hiding this comment

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

specify where though?

@anuccio1 anuccio1 changed the title WIP: DONT MERGE - removed locator from config. We now have project and revision removed locator from config. We now have project and revision Mar 2, 2018
@anuccio1 anuccio1 changed the title removed locator from config. We now have project and revision Managed builds support added Mar 2, 2018
@xizhao xizhao merged commit d0720f8 into master Mar 2, 2018
@elldritch elldritch deleted the alex/managed-builds branch March 3, 2018 03:35
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.

4 participants