GIT FLOW How do I keep files in the master branch and develop and the release do not merge by deleting?

Asked

Viewed 69 times

1

I have 3 format files. yml that I need them to always be on the master branch because it is they who run the automatic system post, but these files cannot be on the develop branch.

So I went and deleted them from the develop branch but every time I get a new release, when the merge happens it erases those files from the master branch.

How do I make that not happen?

Thank you.

1 answer

0

The files get erased because as they cease to exist in the development branch, when you merge, it understands that you want to delete them too, that’s how git works. It would also be possible to use git lfs and lock the file for editing.

But these files should not be the problem of your deployment process, in this case:

  • Your continuous integration process should eliminate them from the artifact to be published, that is, don’t put them in the artifact that will be generated in this process if it is run in the dev branch.

  • Can’t the file be in dev because of sensitive data like BD password? In this case you need to use a safe or environment variables, in the IC you are using, Jenkins, Azure Devops or Github Actions; and in place of the given one token, when running the CI process, this token is replaced by the sensitive data, so the developer does not have access to them.

  • In fact, it’s these yml acquisitions that cause deploy to be initialized in production (run pipeline, etc.) so the need for them to exist in master, if I keep them in dev every time I upload a commit in dev it will play for production as well.

  • Your pipeline should be responsible for taking only the required files to production, this includes a process of assembling the generated artifact, taking only the files to deploy. Are you using which tool as pipeline? Which language?

  • I’m using php with aws codedeploy plus the bitbucket pipeline.

  • During the pipeline process in Bitbucket deletes the files you don’t need and generates the clean artifact for Code Deploy, got it?

  • I was able to solve, in bitbucket-pipelines.yml adds the configuration that generates deploy only for the master branch, so the file can be in all other branches but when the push is done in master ai yes it generates the deploy.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.