Skip to content

Add a development mode for contributions in "flogo ensure"#3

Open
debovema wants to merge 3 commits intosquare-it:ensure-development-modefrom
debovema:ensure-development-mode
Open

Add a development mode for contributions in "flogo ensure"#3
debovema wants to merge 3 commits intosquare-it:ensure-development-modefrom
debovema:ensure-development-mode

Conversation

@debovema
Copy link
Member

@debovema debovema commented Oct 5, 2018

What kind of change does this PR introduce? (check one with "x")

[] Bugfix
[x] Feature
[] Code style update (formatting, local variables)
[] Refactoring (no functional changes, no api changes)
[] Other... Please describe:

Fixes: N/A

What is the current behavior?
When developing a contribution for Flogo, it is often mandatory to make updates in core repositories of Flogo (such as TIBCOSoftware/flogo-contrib and TIBCOSoftware/flogo-lib repositories). Before a Pull Request can be created, these updates are commited and pushed to a forked repository on a new branch but must be imported in Go as if they were coming from official repositories. It is a tedious work to manage this workflow.

What is the new behavior?
The new behavior is to simplify the development of contributions in Flogo environment.
Especially, it adds following features :

  • In flogo ensure command, a -dev switch enables the creation of symbolic links from vendor to pkg for explicit constraints in Gopkg.toml.

For instance, the following constraint:

[[constraint]]
  name = "github.com/TIBCOSoftware/flogo-contrib"
  branch = "some-branch"
  source = "github.com/alternate-account/flogo-contrib"

will remove the $APP_HOME/src/APP_NAME/vendor/github.com/TIBCOSoftware/flogo-contrib directory and replace it by a symbolic link to $APP_HOME/pkg/dep/sources/https---github.com-alternate-account-flogo--contrib.
Whereas the original $APP_HOME/src/APP_NAME/vendor/github.com/TIBCOSoftware/flogo-contrib directory which is just a copy of its counterpart in $APP_HOME/pkg with the right branch/version copied, the link points to a full Git working directory using the right branch/version too.
This is easier to manage updates to be commited and pushed to the fork in a single place.

  • In flogo installcommand, new flags are defined:
    • switch -s to specify an alternate source in a [[constraint]] of Gopkg.toml file
    • switch -u to force the update of a [[constraint]] in Gopkg.toml file if it already exists in Gopkg.lock file (currently it is ignored and a message asks to add it manually in the file)
    • switch -o to create an [[override]] instead of a [[constraint]] of Gopkg.toml file

For instance:

flogo install -u -v some-branch -s github.com/alternate-account/flogo-contrib github.com/TIBCOSoftware/flogo-contrib
flogo install -u -v some-branch -s github.com/alternate-account/flogo-lib github.com/TIBCOSoftware/flogo-lib
flogo install -u -o -v master github.com/apache/thrift

will create the following sections:

[[constraint]]
  name = "github.com/TIBCOSoftware/flogo-contrib"
  branch = "some-branch"
  source = "github.com/alternate-account/flogo-contrib"

[[constraint]]
  name = "github.com/TIBCOSoftware/flogo-lib"
  branch = "some-branch"
  source = "github.com/alternate-account/flogo-lib"

[[override]]
  name = "github.com/apache/thrift"
  branch = "master"

Once the alternate configuration is set in Gopkg.toml, a call to flogo ensure -dev will prepare the application for development mode.

How to install to test?

go get -u github.com/TIBCOSoftware/flogo-cli/...

cd $GOPATH/src/github.com/TIBCOSoftware/flogo-cli

git remote add square-it https://github.com/square-it/flogo-cli.git
git pull square-it ensure-development-mode

go get -u ./...

and to switch back to the official Flogo CLI, simply run:

rm -rf $GOPATH/src/github.com/TIBCOSoftware/flogo-cli

go get -u github.com/TIBCOSoftware/flogo-cli/...

@debovema debovema force-pushed the ensure-development-mode branch from 2e797ea to ca80fe4 Compare October 5, 2018 12:27
Copy link
Member

@emilienthomas emilienthomas left a comment

Choose a reason for hiding this comment

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

OK

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