heroes / salt-formulas-git

Created 4 months ago
Maintained by crameleon
Upstream/unpackaged formula submodules, read-only mirror of gitlab.infra.opensuse.org/infra/salt-formulas-git.git.
Members 1

Unpackaged formulas used in our Salt infrastructure.

Adding a new formula

  1. Create a repository in https://gitlab.infra.opensuse.org/saltstack-formulas/ * the "main" branch should be up to date with the upstream "main" branch * the production branch should be the default branch and be either the same as "main" or the same as the latest tagged upstream release

  2. Create the submodule here git submodule add --name example-formula gitlab@gitlab.infra.opensuse.org:saltstack-formulas/example-formula.git repositories/example-formula

  3. Link the state directory bin/link_formulas.py

  4. Add the symlink and the submodule directory (which should automagically add .gitmodules as well) and submit a merge request to production

  5. Wait for someone to merge it or merge it yourself, if you know what you are doing ;-)

Updating a formula

  1. Change to the formula repository (the formula directory under repositories/)

  2. If you have not already done so in the past, add the upstream as a remote git remote add upstream https://github.com/saltstack-formulas/example-formula.git

  3. If you have not already done so in the past, update the origin to a URL you can push to (you can configure HTTPS authentication, but usually SSH is easier) git remote set-url origin gitlab@gitlab.infra.opensuse.org:saltstack-formulas/example-formula.git

  4. Update the formula repository git fetch upstream

  • If we run the formula off the main branch: git checkout main git pull main git checkout -b update-main git push origin update-main

  • If we run the formula off a tagged release: git checkout refs/tags/<tag> git checkout -b update-<tag> git push origin update-<tag>

  1. Submit a merge request to merge the formula update branch to production, and wait for someone to merge it - or merge it yourself (ensure no upstream pillar changes break our existing code, otherwise submit a matching patch to salt.git to have it ready already)

  2. Update the submodule * Checkout the production branch first and update it with the merged changes(while still in the repositories/<formula> subdirectory) git checkout production git pull origin production

  • Update the submodule cd ../.. git checkout -b <formula> git add repositories/<formula> git commit -sm 'Update <formula>' git push origin <formula>
  1. Submit a merge request to production, and wait for someone to merge it - or merge it yourself - generally, if the formula repository update has already been approved, there is no need for a second review to update the submodule if you have done it before and know the process

Changes get automatically applied through the "deploy" job.