What's the best practice for handling system-specific information under version control?

后端 未结 6 1667
情书的邮戳
情书的邮戳 2021-01-05 11:26

I\'m new to version control, so I apologize if there is a well-known solution to this. For this problem in particular, I\'m using git, but I\'m curious about how to deal wit

6条回答
  •  春和景丽
    2021-01-05 11:34

    You should always separate historization (what a Source Control is for) from deployment.

    A deployment involves:

    • an identified set of data (for which a tag or label provided by the SCM comes in handy)
    • a process manipulating those data (for at least copying them at the right place, but also expanding some compressed files, and so on...)

    Amongst the various operation a deployment does, you should include a de-variabilization phase.

    A variable is a keyword representing anything likely to change depending on your deployment platform (which can be a PC for continuous integration, a linux for basic homologation, an old Solaris8 for pre-production homologation, and a Full F15K Solaris10 with zones for production: it short it can varies a lot). See Jonathan Leffler's answer for practical examples.

    A variable can represent a path, a JVM version, some JVM settings and so on, and what you are putting in an SCM should be a data with variables in it, never hard-coded settings.

    The next step would be to include in your executable a way to detect any change in a setting files in order to update while running some parameters (avoiding the the all "shutdown / change settings / restart" sequence).
    That means they are two types of deployment variables:

    • static ones (which will never change),
    • dynamic ones (which should be ideally taken into account during the runtime session)

提交回复
热议问题