Parcourir la source

Formula reset to specific refs (example: Gerrit review)

tags/0.4
Adam Tengler il y a 8 ans
Parent
révision
3eb85ad514
2 fichiers modifiés avec 89 ajouts et 2 suppressions
  1. +47
    -0
      README.rst
  2. +42
    -2
      salt/master/env.sls

+ 47
- 0
README.rst Voir le fichier

@@ -57,6 +57,53 @@ Salt master with alternative installation source and version (optional) - pip
engine: pip
version: 2016.3.0rc2

Salt master with specified formula to install through apt-get

.. code-block:: yaml

salt:
master:
enabled: true
...
environment:
prd:
keysone:
source: pkg
name: salt-formula-keystone

Clone master branch of keystone formula as local feature branch

.. code-block:: yaml

salt:
master:
enabled: true
...
environment:
dev:
formula:
keystone:
source: git
address: git@github.com:openstack/salt-formula-keystone.git
revision: master
branch: feature

Salt master with specified formula refs (for example for Gerrit review)

.. code-block:: yaml

salt:
master:
enabled: true
...
environment:
dev:
formula:
keystone:
source: git
address: https://git.openstack.org/openstack/salt-formula-keystone
revision: refs/changes/56/123456/1

Salt master syndicate master of masters

.. code-block:: yaml

+ 42
- 2
salt/master/env.sls Voir le fichier

@@ -151,11 +151,50 @@ salt_master_{{ environment_name }}_{{ formula_name }}_formula:
git.latest:
- name: {{ formula.address }}
- target: /usr/share/salt-formulas/env/_formulas/{{ formula_name }}
- rev: {{ formula.revision }}
{% if formula.get("revision", "").split("/")[0] == "refs" %}
- rev: {{ formula.branch|default("master") }}
{%- if grains['saltversion'] < "2015.8.0" %}
- branch: {{ formula.branch|default("master") }}
{%- endif %}
{% else %}
- rev: {{ formula.revision|default(formula.branch) }}
{%- if grains['saltversion'] < "2015.8.0" %}
- branch: {{ formula.branch|default(formula.revision) }}
{%- endif %}
{% endif %}
- force_reset: {{ formula.force_reset|default(False) }}
- require:
- file: salt_env_{{ environment_name }}_dirs
- pkg: git_packages

{%- if formula.get("revision", "").split("/")[0] == "refs" %}

salt_master_{{ environment_name }}_{{ formula_name }}_formula_refs_workaround_fetch:
module.run:
- name: git.fetch
- cwd: /usr/share/salt-formulas/env/_formulas/{{ formula_name }}
- opts: {{ formula.address }} {{ formula.revision }}
- require:
- git: salt_master_{{ environment_name }}_{{ formula_name }}_formula

salt_master_{{ environment_name }}_{{ formula_name }}_formula_refs_workaround_reset:
module.run:
- name: git.reset
- cwd: /usr/share/salt-formulas/env/_formulas/{{ formula_name }}
- opts: --hard FETCH_HEAD
- require:
- module: salt_master_{{ environment_name }}_{{ formula_name }}_formula_refs_workaround_fetch

salt_master_{{ environment_name }}_{{ formula_name }}_formula_refs_workaround_rebase:
module.run:
- name: git.rebase
- cwd: /usr/share/salt-formulas/env/_formulas/{{ formula_name }}
- rev: origin/{{ formula.branch|default("master") }}
- require:
- module: salt_master_{{ environment_name }}_{{ formula_name }}_formula_refs_workaround_reset

{%- endif %}

salt_env_{{ environment_name }}_{{ formula_name }}_link:
file.symlink:
- name: /usr/share/salt-formulas/env/{{ formula_name }}
@@ -245,4 +284,5 @@ salt_master_{{ environment_name }}_{{ state_name }}_state:

{# end new #}

{%- endif %}
{%- endif %}


Chargement…
Annuler
Enregistrer