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

(CODEMGMT-1177) Add environment definition feature #802

Closed
wants to merge 8 commits into from

Conversation

reidmv
Copy link
Contributor

@reidmv reidmv commented Feb 19, 2018

Opening PR for visibility and collaboration. Code works. Needs Engineering review.

README is rough but gives an idea of what this does.
https://github.com/reidmv/r10k/blob/CODEMGMT-1177/doc/puppetfile.mkd#environment

Ticket:
https://tickets.puppetlabs.com/browse/CODEMGMT-1177

This is necessary in order to later allow repos to be created that use a
gitdir besides the default .git, and to make checkout/cloning behaviors
more consistent across operations - especially those involving the git
dir.

A specific operation this enables is removal of the gitdir, followed by
creation of a new gitdir in its place. A working tree clone would force
removal or emptying of the entire working directory to swap out the
gitdir. Working with the gitdir separately opens up this use case.

The implementation choice of just ALWAYS working as a bare repo clone
followed by a checkout is to reduce codepaths. The work done to create a
working repository using gitdir=.git is the same work done to create a
working repository using gitdir=.git-altdir
This implementation supports only redirecting to another ref in the same
source.
This allows a Puppetfile environment redirect to point to a different
Git remote.
Some initial readme documentation for how to use the new `environment`
feature in a Puppetfile
This opens the doors to more advanced use cases around independently
deployed modules, such as described in CODEMGMT-1152 and OPTY-36.
@reidmv reidmv changed the title (DO NOT MERGE) CODEMGMT-1177 (CODEMGMT-1177) (DO NOT MERGE) Add environment definition feature Feb 19, 2018
@danzilio
Copy link
Contributor

I love this


To link the production environment branch to a code version:

1. The production branch should have one, and only one, file committed. The Puppetfile.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can I suggest a little less draconian rule? It should whitelist files like README.md, for example. This would allow users to document their workflow in the place where it's used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@binford2k What would you think about documenting the workflow in the Puppetfile? Example

(note: this example was created for an old workflow iteration, ignore the actual instructions in it)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The concern with allowing more than the Puppetfile is potential conflicts and "flickering" during deployments with files of the same name in the code the Puppetfile "links" to. This already happens for the Puppetfile itself, of course.

It's also just an implementation limitation. In theory it could be engineered around.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not fully opposed to the idea, but certain files already have known meaning. For example, the nice pretty rendered view that GitHub gives you of README.md.

@reidmv reidmv force-pushed the CODEMGMT-1177 branch 3 times, most recently from 1280925 to 34d69d4 Compare February 27, 2018 22:23
Replace with a method and an explicit one-two call for clarity and
easier understanding of how the redirect is working.
@reidmv reidmv changed the title (CODEMGMT-1177) (DO NOT MERGE) Add environment definition feature (CODEMGMT-1177) Add environment definition feature Mar 1, 2018
@reidmv reidmv force-pushed the CODEMGMT-1177 branch 7 times, most recently from c48bb9f to 8bf6d05 Compare April 19, 2018 19:18
In order to reduce the Git confusion of seeing a file called
"Puppetfile" in multiple environments but which is different in each,
make the filename unique per environment.
@reidmv
Copy link
Contributor Author

reidmv commented Sep 27, 2019

Closing in favor of #983.

#983 implements a cleaner generalization of the pattern/capability, which can then be easily built on.

@reidmv reidmv closed this Sep 27, 2019
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.

3 participants