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

-branch should include the repository prefix #132

Closed
kasimon opened this issue Jun 6, 2019 · 6 comments
Closed

-branch should include the repository prefix #132

kasimon opened this issue Jun 6, 2019 · 6 comments
Assignees

Comments

@kasimon
Copy link

kasimon commented Jun 6, 2019

The branch parameter should honor the prefix if one is configured for a given source. Otherwise if two sources use the same branch name, it is impossible to specify which one is ment. For example if there are two sources, "devel" and "staging", and both have a branch "branchname", I would like to run g10k with -branch devel_branchname to exactly specify which branch is ment.

@xorpaul xorpaul self-assigned this Jun 7, 2019
@xorpaul
Copy link
Owner

xorpaul commented Aug 8, 2019

I don't understand how you're talking about the -puppetfile mode in the subject and then about the prefix setting inside a source YAML config, but I guess you meant to write -branch mode instead.

For me the -branch parameter should only specify the Git branch that g10k should try to resolve, bot the Puppet environment.

How about I'll add a -puppetenv parameter to g10k which would support the behavior you expect?
Would that be OK for you?

@kasimon
Copy link
Author

kasimon commented Aug 9, 2019

Sorry, you are right, I got a bit confused, I mixed up updating only a single environment with using -puppetfile mode. And yes, if you want to keep the -branch parameter as it is, having a -puppetenv parameter that includes the repository prefix would would be very useful.

@kasimon kasimon changed the title -branch should honor prefix setting in Puppetfile mode -branch should include the repository prefix Aug 9, 2019
xorpaul added a commit that referenced this issue Aug 16, 2019
…_whitelist (#139)

* add an example config with a git repository in which all branches can be resolved

* add resolveSourcePrefix() and fix up resolvePuppetEnvironment(), preparation for #132

* add test files

* add default purge_levels

* fix unTar error messages

* add stringSliceContains helper function

* add tests for purge_levels and purge_whitelist in different combinations

* add support for purge_levels and purge_whitelist

* add tests for different purge_level combinations

* add support for puppetfile purge_level

* add deployment_purge_whitelist

* add support for deploy setting hash
@xorpaul
Copy link
Owner

xorpaul commented Aug 16, 2019

I've not added an extra parameter for this, but simply added the possibility to match the branch and the prefix+branch combination here: 48c3303#diff-df78fe67e2c9bffdb3673a5fd14d2bb7R84

Now with v.0.7.0 you should be able to specify the exact branch/environment with -branch devel_branchname

@kasimon
Copy link
Author

kasimon commented Aug 19, 2019

Awesome. If I have one repo with a prefix and one without a prefix and both contain the same branch, does g10k guarantee that when run with -branch <branchname>, always the one from the repo without the prefix is used?

@xorpaul
Copy link
Owner

xorpaul commented Aug 19, 2019

Ah, now I understand.

I've just tested it and g10k would sync both sources currently as anything else involving the -branch parameter would break current behavior.

As written previously I'm thinking about adding an additional parameter called -environment which can be used just like like the environment parameter of r10k.

r10k always uses the source name + "_" + the branch name of the repository.

An example:

sources:
  example:
    remote: 'https://github.com/xorpaul/g10k-environment.git'
    basedir: '/tmp/out/'
    prefix: true
  full:
    remote: 'https://github.com/xorpaul/g10k-fullworking-env.git'
    basedir: '/tmp/out/'
    prefix: false
  another:
    remote: 'https://github.com/xorpaul/g10k-fullworking-env.git'
    basedir: '/tmp/out/'
    prefix: 'foobar'
  • calling -environment with master does nothing.
  • calling -environment with foobar_master does nothing.
  • calling -environment with example_master deploys only the master branch of the example source.
  • calling -environment with another_master deploys only the master branch of the another source.

This way you should also be able to control which branch of which source you want to deploy.

How does this sound to you?

@xorpaul xorpaul reopened this Aug 19, 2019
@xorpaul
Copy link
Owner

xorpaul commented Aug 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

No branches or pull requests

2 participants