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

Project config and working in teams with git (git flow) #7555

Closed
thijskaspers opened this issue Feb 11, 2021 · 2 comments
Closed

Project config and working in teams with git (git flow) #7555

thijskaspers opened this issue Feb 11, 2021 · 2 comments
Labels

Comments

@thijskaspers
Copy link

thijskaspers commented Feb 11, 2021

We are sometimes running into issues with project config and git, and I was wondering if the problem lies with our workflow, or is caused by project config somehow and if something can be done to prevent this.

The following happens quite often:

Colleague A is working on a bit of code (in a git feature branch) and is making some new fields and sections. The corresponding config files get submitted to git and a pull-request is made. After the pull-request is approved, the feature is merged into develop (but not yet released to the staging server).

Colleague B has to do some work on the same project the next day. He pulls the latest code from the development branch and downloads a database from the staging server, so he has a nice starting point. The problem here is that the downloaded database does not yet contain the latest changes from colleague A, since they haven't been rolled out yet. (Not every project of ours has continuous integration and immediately deploys to staging after code has been merged)

Colleague B then makes some changes to a field and saves the changes, and the result is that Craft sees there's a mismatch between project config and the database. There are sections and fields from colleague A present in project config, but missing from the database and what Craft does is it will remove the project config files corresponding to those sections and fields. If colleague B then does not manually check the project config files he's about to commit, he will remove precious work from another colleague, shame on him.

I guess the issue is with colleague B not running project-config/apply after downloading the database and before he begins development, but as far as he knows he has the latest development code and the latest database....

How do you guys manage this? Thanks in advance

Additional info

  • Craft version: 3.5.18
  • PHP version: 7.4
@zizther
Copy link

zizther commented Feb 11, 2021

@thijskaspers This is a scenario which sometimes happens on projects I work with. I've not found the perfect solution and it has bit me a couple of times. I have thought of either enforcing some rules to follow, or creating a script to get the latest database from an environment and run some commands to help automate the process.

It would be interesting to see how others deal with this

@brandonkelly
Copy link
Member

This is why the control panel presents a big nag alert when there are pending project config changes:

A nag alert in the Craft control panel, saying that there are pending project config YAML changes that need to be applied

Each of your developers should be instructed to pay attention to that, click “Review”, and then click the “Apply changes only” button, before making any additional changes that will affect the project config.

The Project Config utility, with an arrow pointed to the “Apply changes only” button

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants