Closed naegelin closed 10 years ago
+1
For clarity, we're talking about a salt master setting like so:
ext_pillar:
- git: dev git+ssh://git@github.com/iggy/salt_pillars.git
Where changing dev to master makes things magically work.
I followed the example here: http://docs.saltstack.com/en/latest/ref/pillar/all/salt.pillar.git_pillar.html?highlight=ext_pillar%20git
declaring multiple git sources (one for each branch) and defined a unique top.sls inside each branch.
UPDATE: This finally worked after rebuilding everything according to this link: http://docs.saltstack.com/en/latest/ref/pillar/all/salt.pillar.git_pillar.html?highlight=ext_pillar%20git
My problem was that I was not calling :
salt 'mydevhost' saltutil.refresh_pillar
Here is what the final setup looked like:
/etc/salt/master:
ext_pillar:
- git: master https://source.developers.google.com/p/project-01/ root=salt/pillar
- git: test https://source.developers.google.com/p/project-01/ root=salt/pillar
salt/pillar/top.sls: on TEST BRANCH:
test:
'mydev*':
- packages/test
salt/pillar/top.sls: on MASTER BRANCH:
base:
'myprod*':
- packages/prod
Just make sure to always call saltutil.refresh_pillar after making changes!
salt 'mydevhost' saltutil.refresh_pillar
In a recent test it came about that Pillars only work if defined in the Master Branch when using gitfs. I've tried this over and over and it always seems to hold true.
Example:
The following top.sls PILLAR file will fail (no pillars created) if pushed to the "test" branch where as the STATE file will behave as expected (testpillar will apply to host names starting with word test). The Base definition for the top.sls pillar in the master branch works.
contents of /salt/pillar/top.sls:
contents of /salt/pillar/testpillar.sls:
Either my understanding of the expected behavior is wrong or this is a major show stopper for people deploying different environments tied to git branches.