Skip to content

Instantly share code, notes, and snippets.

@onlyanegg
Created October 6, 2016 00:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save onlyanegg/7ba7524ca3c516021f0ebb0a4e4f53d6 to your computer and use it in GitHub Desktop.
Save onlyanegg/7ba7524ca3c516021f0ebb0a4e4f53d6 to your computer and use it in GitHub Desktop.
{% set pod = pillar.pod %}
{% set branch = pillar['bamboo']['branches']['app'][pillar.deploy.app.branch] %}
{% set rev = pillar.deploy.app.revision %}
test_app_r{{ rev }}_artifacts_directory:
cmd.run:
- name: test ! -d {{ pillar.nfs.mount }}/artifacts/services/app/r{{ rev }}
- failhard: True
make_app_r{{ rev }}_artifacts_directory:
file.directory:
- name: {{ pillar.nfs.mount }}/artifacts/services/app/r{{ rev }}
- makedirs: True
{% for war in pillar.artifacts.app %}
download_{{ pod }}_{{ war }}_war:
cmd.run:
{% if grains.id.split('.')[2] == 'prod' %}
- name: curl --user '{{ pillar.bamboo.user }}:{{ pillar.bamboo.passwd }}' --insecure {{ pillar.bamboo.url }}/PRODUCTION-APP/shared/build-{{ rev }}/WAR/{{ war }}.war --fail -o {{ war }}.war
{% else %}
- name: curl --user '{{ pillar.bamboo.user }}:{{ pillar.bamboo.passwd }}' --insecure {{ pillar.bamboo.url }}/APP{{ branch }}/shared/build-{{ rev }}/build/dist/{{ war }}.war --fail -o {{ war }}.war
{% endif %}
- cwd: {{ pillar.nfs.mount }}/artifacts/services/app/r{{ rev }}
- runas: root
- failhard: True
remove_app_r{{ rev }}_artifacts_directory_{{ war }}:
file.absent:
- name: {{ pillar.nfs.mount }}/artifacts/services/app/r{{ rev }}
- onfail:
- cmd: download_{{ pod }}_{{ war }}_war
{% endfor %}
link_{{ pod }}_app_artifacts_directory:
file.symlink:
- name: {{ pillar.nfs.mount }}/artifacts/pods/{{ pod }}/app
- target: {{ pillar.nfs.mount }}/artifacts/services/app/r{{ rev }}
- force: True
{% set pod = pillar.pod %}
{% set branch = pillar['bamboo']['branches']['app'][pillar.deploy.app.branch] %}
{% set rev = pillar.deploy.app.revision %}
test_app_r{{ rev }}_artifacts_directory:
cmd.run:
- name: test ! -d {{ pillar.nfs.mount }}/artifacts/services/app/r{{ rev }}
- failhard: True
make_app_r{{ rev }}_artifacts_directory:
file.directory:
- name: {{ pillar.nfs.mount }}/artifacts/services/app/r{{ rev }}
- makedirs: True
{% for war in pillar.artifacts.app %}
download_{{ pod }}_{{ war }}_war:
cmd.run:
{% if grains.id.split('.')[2] == 'prod' %}
- name: curl --user '{{ pillar.bamboo.user }}:{{ pillar.bamboo.passwd }}' --insecure {{ pillar.bamboo.url }}/PRODUCTION-APP/shared/build-{{ rev }}/WAR/{{ war }}.war --fail -o {{ war }}.war
{% else %}
- name: curl --user '{{ pillar.bamboo.user }}:{{ pillar.bamboo.passwd }}' --insecure {{ pillar.bamboo.url }}/APP{{ branch }}/shared/build-{{ rev }}/build/dist/{{ war }}.war --fail -o {{ war }}.war
{% endif %}
- cwd: {{ pillar.nfs.mount }}/artifacts/services/app/r{{ rev }}
- runas: root
- failhard: True
{% endfor %}
remove_app_r{{ rev }}_artifacts_directory:
file.absent:
- name: {{ pillar.nfs.mount }}/artifacts/services/app/r{{ rev }}
- onfail:
- cmd: download_{{ pod }}_*_war
link_{{ pod }}_app_artifacts_directory:
file.symlink:
- name: {{ pillar.nfs.mount }}/artifacts/pods/{{ pod }}/app
- target: {{ pillar.nfs.mount }}/artifacts/services/app/r{{ rev }}
- force: True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment