Skip to content

Commit

Permalink
Merge pull request #60 from paulrbr-fl/fix-base-env
Browse files Browse the repository at this point in the history
fix `clever_base_env`  by removing a variable if not necessary
  • Loading branch information
paulrbr-fl authored Mar 24, 2020
2 parents 13602ab + c99eb17 commit 0815543
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 8 deletions.
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ script:
- ansible-lint .
- shellcheck **/*.sh
- scripts/dhall_check.sh
# Run integration test
- mkdir -p ~/.local/bin
- cp tests/fake.sh ~/.local/bin/clever
- cp tests/fake.sh ~/.local/bin/git
- ansible-playbook tests/test.yml -i tests/inventory

notifications:
slack: fretlink:pTIylIN7zkwRFuL3aHERmsbB
webhooks: https://galaxy.ansible.com/api/v1/notifications/
4 changes: 2 additions & 2 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
# defaults file for clever
clever_cli_version: 1.4.2
clever_cli_version: 1.6.3
clever_user_path: .local/bin
clever_app_root: "{{ app_root | default(playbook_dir + '/..') }}"
clever_app_confdir: "{{ clever_app_root }}/.clever_cloud"
clever_login_file: "{{ clever_app_confdir }}/login"

clever_haskell_entry_point: "{{ clever_entry_point | default('') }}"
clever_haskell_entry_point: "{{ clever_entry_point | default(None) }}"
clever_env: {}

clever_disable_metrics: false
Expand Down
8 changes: 7 additions & 1 deletion templates/env.j2
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
{% for key, value in (clever_base_env | combine(clever_env)).items() %}
{{ key }}="{{ value | tojson }}"
{{ key }}="{{ value | to_json }}"
{% endfor %}

{%- if clever_haskell_entry_point %}
{# Haskell only #}
{# https://www.clever-cloud.com/doc/get-help/reference-environment-variables/#haskell #}
CC_RUN_COMMAND="{{'~/.local/bin/' + clever_haskell_entry_point | to_json }}"
{% endif %}
14 changes: 14 additions & 0 deletions tests/fake.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

binary="${0/*\/}"
fakeCommit="aaa000aaa000aaa000aaa000aaa000aaa000aaa0"

if [ "${binary}" = "clever" ] && [ "${1}" = "--version" ]; then
echo "1.6.3"
elif [ "${binary}" = "clever" ] && [ "${1}" = "activity" ]; then
echo "2020-02-02T20:20:02+02:00 OK DEPLOY ${fakeCommit} Git"
elif [ "${binary}" = "git" ]; then
echo "${fakeCommit}"
else
echo "${binary} called with arguments: ${*}"
fi
2 changes: 1 addition & 1 deletion tests/inventory
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
localhost
localhost ansible_connection=local

6 changes: 5 additions & 1 deletion tests/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@
- hosts: localhost
remote_user: root
roles:
- clever
- role: clever
vars:
clever_token: 123abc
clever_secret: cba321
clever_app: app_00000000-0000-0000-0000-000000000000
3 changes: 0 additions & 3 deletions vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
# vars file for clever
clever_base_env:
CACHE_DEPENDENCIES: "true"
# Haskell only
# https://www.clever-cloud.com/doc/get-help/reference-environment-variables/#haskell
CC_RUN_COMMAND: "~/.local/bin/{{ clever_haskell_entry_point }}"
CC_DISABLE_METRICS: "{{ clever_disable_metrics | lower }}"
PORT: "8080"

Expand Down

0 comments on commit 0815543

Please sign in to comment.