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

Clone environment #172

Closed
dabeeeenster opened this issue Jul 8, 2021 · 15 comments · Fixed by #203, #238 or #242
Closed

Clone environment #172

dabeeeenster opened this issue Jul 8, 2021 · 15 comments · Fixed by #203, #238 or #242
Assignees
Labels
bug Something isn't working feature New feature or request front-end Issue related to the React Front End Dashboard
Projects

Comments

@dabeeeenster
Copy link
Contributor

dabeeeenster commented Jul 8, 2021

When creating a new environment, you currently take the default flag states for that project, which are currently not shown anywhere.

It would be better to be able to select which existing environment state you want to clone for the new environment.

@matthewelwell
Copy link
Contributor

As discussed with @gagantrivedi:

We need an endpoint that 'clones' an environment. This should take the existing environment id and a new name for the cloned environment as an input and return the new environment details. Something like:

POST /api/v1/environments/:id/clone

+ request

{
  "name": "<new environment name>"
}

+ Response

{
  "id": <new environment id>,
  "name": "<new environment name>",
  "project": {
    "id": <project id>,
    ...
  },
  "feature_states": [{...}]
}

@dabeeeenster dabeeeenster moved this from Backlog to In progress in Roadmap Jul 20, 2021
@dabeeeenster dabeeeenster linked a pull request Jul 23, 2021 that will close this issue
@dabeeeenster dabeeeenster added feature New feature or request front-end Issue related to the React Front End Dashboard labels Aug 2, 2021
@dabeeeenster
Copy link
Contributor Author

@kyle-ssg I think we should add an Environment drop down here:

image

hook it up to the API, and then we're done.

@kyle-ssg
Copy link
Member

kyle-ssg commented Aug 2, 2021

#238 Frontend's done for this under the flag "clone_environment", just need backend.
image

@kyle-ssg kyle-ssg linked a pull request Aug 2, 2021 that will close this issue
@dabeeeenster dabeeeenster moved this from In progress to Done in Roadmap Aug 2, 2021
@dabeeeenster
Copy link
Contributor Author

dabeeeenster commented Aug 2, 2021

This isnt working for me on staging.

  1. Create new project
  2. Create flag, default it to disabled.
  3. Set flag as enabled in development env
  4. Create new env, cloning dev env
  5. New env has flag disabled. Expected it to be enabled.

@dabeeeenster dabeeeenster reopened this Aug 2, 2021
@gagantrivedi
Copy link
Member

gagantrivedi commented Aug 2, 2021

The issue is the all the hooks installed on feature state are not aware of the cloning feature, and they fill the feature value with the default instead of using the cloned one.
One simple solution from top of my mind is too add something like source_env <fk to env> that can be used(if not null) by the hooks to copy the value. @matthewelwell what do you think?

@matthewelwell
Copy link
Contributor

Yeah, that sounds like a smart idea to me.

@gagantrivedi
Copy link
Member

Yeah, that sounds like a smart idea to me.

This may work for Feature state, but we have to copy segments and identities as well. and some of them don't have hooks.

@matthewelwell
Copy link
Contributor

Ok, so we just need to do that in the clone method on the environment I guess?

@gagantrivedi
Copy link
Member

gagantrivedi commented Aug 2, 2021

Ok, so we just need to do that in the clone method on the environment I guess?

I am planning to implement clone method on Feature state, feature segments and feature identity. each clone method will be responsible for creating clone of itself with a different env

@dabeeeenster
Copy link
Contributor Author

dabeeeenster commented Aug 3, 2021

Data to copy:

  • Feature States
  • Segment Overrides

Make initiating user the Admin of that environment

Nothing else

@kyle-ssg
Copy link
Member

kyle-ssg commented Aug 15, 2021

As far as I can see, this still doesn't work - feature states are not copied over, at least currently in production. Also if it's behind a feature flag we should perhaps delay closing this until it's enabled.

@kyle-ssg kyle-ssg assigned dabeeeenster and unassigned kyle-ssg Aug 15, 2021
@dabeeeenster
Copy link
Contributor Author

Some data are not cloning correctly. E.g. I cloned this environment:

image

and this is what copied:

image

Note the background_colour config value is different.

@dabeeeenster dabeeeenster added the bug Something isn't working label Aug 16, 2021
@gagantrivedi
Copy link
Member

@dabeeeenster can't reproduce. Can you list the steps?

@kyle-ssg
Copy link
Member

Can no longer replicate, has this feature been deployed / adjusted in production since the 15th @gagantrivedi ?

@dabeeeenster
Copy link
Contributor Author

Yep sorry I cant replicate this any more - closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feature New feature or request front-end Issue related to the React Front End Dashboard
Projects
No open projects
4 participants