saltstack-formulas / template-formula

SaltStack formula template filled with dummy content
http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Other
119 stars 85 forks source link

test(pillar): use static test/salt/pillar/top.sls #238

Closed baby-gnu closed 2 years ago

baby-gnu commented 3 years ago

The kitchen-salt provisionner have the pillars_from_directories option to recusively copy directories under target pillar root.

This has 3 advantages:

PR progress checklist (to be filled in by reviewers)


What type of PR is this?

Primary type

Secondary type

Does this PR introduce a BREAKING CHANGE?

No.

Related issues and/or pull requests

Describe the changes you're proposing

Pillar / config required to test the proposed changes

Debug log showing how the proposed changes work

Documentation checklist

Testing checklist

Additional context

myii commented 3 years ago

Thanks, @baby-gnu. This looks like a nice idea.

This will also necessitate some changes in how the ssf-formula works, so I'm going to need a little while to get around to this. Currently got a bit of a backlog due to the 3003.2 release, etc.

baby-gnu commented 3 years ago

This will also necessitate some changes in how the ssf-formula works, so I'm going to need a little while to get around to this. Currently got a bit of a backlog due to the 3003.2 release, etc.

Thanks, it was an idea inspired by a user in SaltStack matrix room, it's not urgent.

myii commented 3 years ago

@baby-gnu I thought I'd familiarise myself with these changes by adapting it for the salt-formula. This is the commit I used, which is passing in the CI:

A couple of things I came across so far, which are valid for this PR as well:

  1. There's no need to use pillars: {} since that's the default provided by kitchen-salt.
  2. (I haven't done this in the commit there but) We probably need to remove the following line as well, since it prevents the top.sls from being git added except using -f:

https://github.com/saltstack-formulas/template-formula/blob/8d506ea93eca196c60e178f8dd2eb2a7ad6594e9/.gitignore#L129


Tested it out with:

$ salt-call --local \
            --id test-minion.example.net \
            --file-root=./ \
            --pillar-root=./test/salt/pillar/ \
            --out=yaml \
            state.show_sls salt
baby-gnu commented 3 years ago

You are right, I'll remove it on the final rework of this PR

  • (I haven't done this in the commit there but) We probably need to remove the following line as well, since it prevents the top.sls from being git added expect using -f:

I'm really not sure, I think we should keep it to avoid having a top.sls in the states tree, so I propose to use:

top.sls
!test/salt/pillar/top.sls

This way, all top.sls will be ignored except the test/salt/pillar/top.sls one.

myii commented 2 years ago

Thanks for the patience, @baby-gnu -- merged.

Rebased your changes on the latest version of this formula (the CI instances had changed).

The main notes regarding the additional commit:

  1. Moved pillars_from_directories under provisioner instead of under suites, as discussed in the working group meetings.
  2. Used test/salt/pillar/default.sls instead of test/salt/pillar/defaults.sls, to maintain consistency with the large number of formulas out there (default suite has a default.sls pillar).
  3. Other minor consistency fixes, such as updating .travis.yml and CODEOWNERS.
saltstack-formulas-travis commented 2 years ago

:tada: This PR is included in version 5.0.4 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: