Created
October 6, 2016 00:39
-
-
Save onlyanegg/7ba7524ca3c516021f0ebb0a4e4f53d6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% 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