From 1c1393659bb8adb3273e2434725ae1664287a1c9 Mon Sep 17 00:00:00 2001 From: Clement Delafargue Date: Tue, 8 Oct 2019 14:46:25 +0200 Subject: Add optional build flavor configuration --- README.md | 1 + dhall/Config.dhall | 2 ++ files/clever-set-build-flavor.sh | 9 +++++++++ tasks/deploy.yml | 9 +++++++++ tasks/setup.yml | 1 + 5 files changed, 22 insertions(+) create mode 100755 files/clever-set-build-flavor.sh diff --git a/README.md b/README.md index 469667b..ef14393 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ Variables for the application - _Obsolete_: `clever_metrics`: metrics used to be disabled by default. Now they are enabled by default and can be explicitly disabled with `clever_disable_metrics`. - `clever_disable_metrics`: a boolean to disable metrics support. Optional, default to `false`. - `clever_env_output_file`: as a post deploy task you might need to retrieve the full Clever environment configuration (i.e. with addon env variables). If this variable is set to a filename then the env will be retrieved after a successful deploy inside this file. Optional. +- `clever_build_flavor`: an optional text value used to configure the size of the dedicated build instance (for instance `S` or `XL`). If not defined, it delegates to clever cloud default behaviour. Setting `disabled` disables the dedicated build instance altogether. Variables specific to deployment, default should be fine: - `clever_cli_version`: Version of clever cli tools, default to `0.9.3`. diff --git a/dhall/Config.dhall b/dhall/Config.dhall index 1b9388e..e092e2c 100644 --- a/dhall/Config.dhall +++ b/dhall/Config.dhall @@ -15,6 +15,7 @@ let Config = , clever_disable_metrics : Bool , clever_addons : List Addon , clever_env : Environment + , clever_build_flavor : Optional Text } let mkConfig = @@ -32,6 +33,7 @@ let mkConfig = , clever_disable_metrics = False , clever_addons = [] : List Addon , clever_env = {=} + , clever_build_flavor = None Text } : Config {} diff --git a/files/clever-set-build-flavor.sh b/files/clever-set-build-flavor.sh new file mode 100755 index 0000000..52ad223 --- /dev/null +++ b/files/clever-set-build-flavor.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -e + +function setBuildFlavor { + clever scale --build-flavor "${BUILD_FLAVOR}" +} + +setBuildFlavor diff --git a/tasks/deploy.yml b/tasks/deploy.yml index 751d78f..5e0ba0c 100644 --- a/tasks/deploy.yml +++ b/tasks/deploy.yml @@ -16,6 +16,15 @@ DOMAIN: "{{ clever_domain | default(domain) }}" CONFIGURATION_FILE: "{{ clever_login_file }}" +- name: Configure Build Instance + when: clever_build_flavor is defined + command: "{{ ansible_env.HOME }}/{{ clever_user_path }}/clever-set-build-flavor.sh" + args: + chdir: "{{ clever_app_root }}" + environment: + BUILD_FLAVOR: "{{ clever_build_flavor }}" + CONFIGURATION_FILE: "{{ clever_login_file }}" + - name: Push Environment shell: "clever env import --json < {{ clever_app_confdir }}/env" args: diff --git a/tasks/setup.yml b/tasks/setup.yml index a2d5b90..3bf7965 100644 --- a/tasks/setup.yml +++ b/tasks/setup.yml @@ -29,3 +29,4 @@ with_items: - clever-set-domain.sh - clever-set-drain.sh + - clever-set-build-flavor.sh -- cgit v1.2.3 From b1536bd484c818e8b3e26c271d35306882ef9956 Mon Sep 17 00:00:00 2001 From: Clement Delafargue Date: Fri, 19 Jun 2020 12:09:22 +0200 Subject: Inline `clever scale --build-flavor` command --- files/clever-set-build-flavor.sh | 9 --------- tasks/deploy.yml | 3 +-- tasks/setup.yml | 1 - 3 files changed, 1 insertion(+), 12 deletions(-) delete mode 100755 files/clever-set-build-flavor.sh diff --git a/files/clever-set-build-flavor.sh b/files/clever-set-build-flavor.sh deleted file mode 100755 index 52ad223..0000000 --- a/files/clever-set-build-flavor.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -set -e - -function setBuildFlavor { - clever scale --build-flavor "${BUILD_FLAVOR}" -} - -setBuildFlavor diff --git a/tasks/deploy.yml b/tasks/deploy.yml index 5e0ba0c..ca1e54a 100644 --- a/tasks/deploy.yml +++ b/tasks/deploy.yml @@ -18,11 +18,10 @@ - name: Configure Build Instance when: clever_build_flavor is defined - command: "{{ ansible_env.HOME }}/{{ clever_user_path }}/clever-set-build-flavor.sh" + command: "clever scale --build-flavor {{ clever_build_flavor }}" args: chdir: "{{ clever_app_root }}" environment: - BUILD_FLAVOR: "{{ clever_build_flavor }}" CONFIGURATION_FILE: "{{ clever_login_file }}" - name: Push Environment diff --git a/tasks/setup.yml b/tasks/setup.yml index 3bf7965..a2d5b90 100644 --- a/tasks/setup.yml +++ b/tasks/setup.yml @@ -29,4 +29,3 @@ with_items: - clever-set-domain.sh - clever-set-drain.sh - - clever-set-build-flavor.sh -- cgit v1.2.3 From 44ed075932b67c9a9924095f6bdf88bfa70eee09 Mon Sep 17 00:00:00 2001 From: Clement Delafargue Date: Fri, 19 Jun 2020 14:59:50 +0200 Subject: Specify clever-tools version constaints in README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ef14393..2747962 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ It handles the publication over git, as well as domain names, environment variab Requirements ------------ +This role requires `clever-tools` version `2.6.1` or higher. Role Variables -------------- -- cgit v1.2.3 From 8a5d45d789cdb5739f2f6e8490e02b9ffdfa8b2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Delafargue?= <39330590+clementd-fretlink@users.noreply.github.com> Date: Fri, 19 Jun 2020 15:06:14 +0200 Subject: Update default `clever-tools` version in the readme Co-authored-by: paulrbr-fl <43074087+paulrbr-fl@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2747962..7a4557b 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ Variables for the application - `clever_build_flavor`: an optional text value used to configure the size of the dedicated build instance (for instance `S` or `XL`). If not defined, it delegates to clever cloud default behaviour. Setting `disabled` disables the dedicated build instance altogether. Variables specific to deployment, default should be fine: -- `clever_cli_version`: Version of clever cli tools, default to `0.9.3`. +- `clever_cli_version`: Version of clever cli tools, default to `2.6.1`. - `clever_user_path`: Path relative to ansible_user home dir where cli tools and helpers are installed default to `.local/bin`. - `clever_app_root`: Path of the application to deploy, default to `app_root` if defined or `"{{ playbook_dir }}/.."`, ie ansible directory in the root of the application. - `clever_app_confdir`: Path where to store clever cloud data specific to this application, default to `"{{ clever_app_root }}/.clever_cloud"` -- cgit v1.2.3