aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorpaulrbr-fl <43074087+paulrbr-fl@users.noreply.github.com>2020-03-24 16:12:39 +0100
committerGitHub <noreply@github.com>2020-03-24 16:12:39 +0100
commit0815543375419c6e15ac67d57d19578dfcf2b290 (patch)
tree0773be49aed217cebe9e600c4acb0b7cc49921df
parent13602abcc2f50d0ad5b3eff47e5719bfa8b77ecd (diff)
parentc99eb17850e51327449e6fac5572c6cfc436d21c (diff)
downloadansible-clever-2.3.tar.gz
ansible-clever-2.3.tar.zst
ansible-clever-2.3.zip
Merge pull request #60 from paulrbr-fl/fix-base-envv2.3
fix `clever_base_env` by removing a variable if not necessary
-rw-r--r--.travis.yml6
-rw-r--r--defaults/main.yml4
-rw-r--r--templates/env.j28
-rwxr-xr-xtests/fake.sh14
-rw-r--r--tests/inventory2
-rw-r--r--tests/test.yml6
-rw-r--r--vars/main.yml3
7 files changed, 35 insertions, 8 deletions
diff --git a/.travis.yml b/.travis.yml
index 22e80b3..0fcb053 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -24,6 +24,12 @@ script:
24 - ansible-lint . 24 - ansible-lint .
25 - shellcheck **/*.sh 25 - shellcheck **/*.sh
26 - scripts/dhall_check.sh 26 - scripts/dhall_check.sh
27 # Run integration test
28 - mkdir -p ~/.local/bin
29 - cp tests/fake.sh ~/.local/bin/clever
30 - cp tests/fake.sh ~/.local/bin/git
31 - ansible-playbook tests/test.yml -i tests/inventory
27 32
28notifications: 33notifications:
29 slack: fretlink:pTIylIN7zkwRFuL3aHERmsbB 34 slack: fretlink:pTIylIN7zkwRFuL3aHERmsbB
35 webhooks: https://galaxy.ansible.com/api/v1/notifications/
diff --git a/defaults/main.yml b/defaults/main.yml
index d4aa86d..0e4bada 100644
--- a/defaults/main.yml
+++ b/defaults/main.yml
@@ -1,12 +1,12 @@
1--- 1---
2# defaults file for clever 2# defaults file for clever
3clever_cli_version: 1.4.2 3clever_cli_version: 1.6.3
4clever_user_path: .local/bin 4clever_user_path: .local/bin
5clever_app_root: "{{ app_root | default(playbook_dir + '/..') }}" 5clever_app_root: "{{ app_root | default(playbook_dir + '/..') }}"
6clever_app_confdir: "{{ clever_app_root }}/.clever_cloud" 6clever_app_confdir: "{{ clever_app_root }}/.clever_cloud"
7clever_login_file: "{{ clever_app_confdir }}/login" 7clever_login_file: "{{ clever_app_confdir }}/login"
8 8
9clever_haskell_entry_point: "{{ clever_entry_point | default('') }}" 9clever_haskell_entry_point: "{{ clever_entry_point | default(None) }}"
10clever_env: {} 10clever_env: {}
11 11
12clever_disable_metrics: false 12clever_disable_metrics: false
diff --git a/templates/env.j2 b/templates/env.j2
index d2bf446..66e5508 100644
--- a/templates/env.j2
+++ b/templates/env.j2
@@ -1,3 +1,9 @@
1{% for key, value in (clever_base_env | combine(clever_env)).items() %} 1{% for key, value in (clever_base_env | combine(clever_env)).items() %}
2{{ key }}="{{ value | tojson }}" 2{{ key }}="{{ value | to_json }}"
3{% endfor %} 3{% endfor %}
4
5{%- if clever_haskell_entry_point %}
6{# Haskell only #}
7{# https://www.clever-cloud.com/doc/get-help/reference-environment-variables/#haskell #}
8CC_RUN_COMMAND="{{'~/.local/bin/' + clever_haskell_entry_point | to_json }}"
9{% endif %}
diff --git a/tests/fake.sh b/tests/fake.sh
new file mode 100755
index 0000000..2835e85
--- /dev/null
+++ b/tests/fake.sh
@@ -0,0 +1,14 @@
1#!/usr/bin/env bash
2
3binary="${0/*\/}"
4fakeCommit="aaa000aaa000aaa000aaa000aaa000aaa000aaa0"
5
6if [ "${binary}" = "clever" ] && [ "${1}" = "--version" ]; then
7 echo "1.6.3"
8elif [ "${binary}" = "clever" ] && [ "${1}" = "activity" ]; then
9 echo "2020-02-02T20:20:02+02:00 OK DEPLOY ${fakeCommit} Git"
10elif [ "${binary}" = "git" ]; then
11 echo "${fakeCommit}"
12else
13 echo "${binary} called with arguments: ${*}"
14fi
diff --git a/tests/inventory b/tests/inventory
index 878877b..49d4fe2 100644
--- a/tests/inventory
+++ b/tests/inventory
@@ -1,2 +1,2 @@
1localhost 1localhost ansible_connection=local
2 2
diff --git a/tests/test.yml b/tests/test.yml
index 3e3c57f..663bc6b 100644
--- a/tests/test.yml
+++ b/tests/test.yml
@@ -2,4 +2,8 @@
2- hosts: localhost 2- hosts: localhost
3 remote_user: root 3 remote_user: root
4 roles: 4 roles:
5 - clever \ No newline at end of file 5 - role: clever
6 vars:
7 clever_token: 123abc
8 clever_secret: cba321
9 clever_app: app_00000000-0000-0000-0000-000000000000
diff --git a/vars/main.yml b/vars/main.yml
index 94ee792..a9625f0 100644
--- a/vars/main.yml
+++ b/vars/main.yml
@@ -2,9 +2,6 @@
2# vars file for clever 2# vars file for clever
3clever_base_env: 3clever_base_env:
4 CACHE_DEPENDENCIES: "true" 4 CACHE_DEPENDENCIES: "true"
5 # Haskell only
6 # https://www.clever-cloud.com/doc/get-help/reference-environment-variables/#haskell
7 CC_RUN_COMMAND: "~/.local/bin/{{ clever_haskell_entry_point }}"
8 CC_DISABLE_METRICS: "{{ clever_disable_metrics | lower }}" 5 CC_DISABLE_METRICS: "{{ clever_disable_metrics | lower }}"
9 PORT: "8080" 6 PORT: "8080"
10 7