| {%- from "runtest/map.jinja" import artifact_collector with context %} |
| {%- if artifact_collector.get('enabled', False) -%} |
| |
| required_artifact_pkgs: |
| pkg.installed: |
| - names: {{ artifact_collector.pkgs }} |
| |
| {%- for cmd_name, cmd_params in artifact_collector.cmds.iteritems() %} |
| {%- set cmd = cmd_params.cmd + " > " + cmd_params.dst %} |
| run_{{ cmd_name }}: |
| cmd.run: |
| - name: {{ cmd }} |
| |
| {%- if artifact_collector.get('artifactory', {}).get('enabled', False) %} |
| deploy_{{ cmd_name }}: |
| module.run: |
| - name: artifactory.deploy_artifact |
| - source_file: {{ cmd_params.dst }} |
| - endpoint: {{ artifact_collector.artifactory.endpoint }} |
| - require: |
| - pkg: required_artifact_pkgs |
| - kwargs: |
| user: {{ artifact_collector.artifactory.user }} |
| password: {{ artifact_collector.artifactory.password }} |
| host: {{ artifact_collector.artifactory.host }} |
| proto: {{ artifact_collector.artifactory.get('proto', 'https') }} |
| port: {{ artifact_collector.artifactory.get('port', 443) }} |
| {%- endif %} |
| |
| {%- endfor %} |
| |
| |
| {%- for artifact_name, artifact_params in artifact_collector.artifacts.iteritems() %} |
| {%- if salt['file.file_exists'](artifact_params.path) or salt['file.directory_exists'](artifact_params.path) %} |
| {%- set zip_file = "/tmp/"+artifact_name+".zip" %} |
| |
| zip_{{artifact_name}}: |
| module.run: |
| - name: archive.zip |
| - zip_file: {{ zip_file }} |
| - sources: {{ artifact_params.path }} |
| |
| {%- if artifact_collector.get('artifactory', {}).get('enabled', False) %} |
| deploy_{{artifact_name}}: |
| module.run: |
| - name: artifactory.deploy_artifact |
| - source_file: {{ zip_file }} |
| - endpoint: {{ artifact_collector.artifactory.endpoint }} |
| - require: |
| - pkg: required_artifact_pkgs |
| - kwargs: |
| user: {{ artifact_collector.artifactory.user }} |
| password: {{ artifact_collector.artifactory.password }} |
| host: {{ artifact_collector.artifactory.host }} |
| proto: {{ artifact_collector.artifactory.get('proto', 'https') }} |
| port: {{ artifact_collector.artifactory.get('port', 443) }} |
| {%- endif %} |
| |
| {%- endif %} |
| |
| {%- endfor %} |
| |
| {%- endif -%} |