Browse Source

Formula reset to specific refs (example: Gerrit review)

tags/0.4
Adam Tengler 8 years ago
parent
commit
3eb85ad514
2 changed files with 89 additions and 2 deletions
  1. +47
    -0
      README.rst
  2. +42
    -2
      salt/master/env.sls

+ 47
- 0
README.rst View File

engine: pip engine: pip
version: 2016.3.0rc2 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 Salt master syndicate master of masters


.. code-block:: yaml .. code-block:: yaml

+ 42
- 2
salt/master/env.sls View File

git.latest: git.latest:
- name: {{ formula.address }} - name: {{ formula.address }}
- target: /usr/share/salt-formulas/env/_formulas/{{ formula_name }} - 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: - require:
- file: salt_env_{{ environment_name }}_dirs - file: salt_env_{{ environment_name }}_dirs
- pkg: git_packages - 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: salt_env_{{ environment_name }}_{{ formula_name }}_link:
file.symlink: file.symlink:
- name: /usr/share/salt-formulas/env/{{ formula_name }} - name: /usr/share/salt-formulas/env/{{ formula_name }}


{# end new #} {# end new #}


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


Loading…
Cancel
Save