From c4148c07d5e2c9bfc13ed89b3a07bacc996ae6de Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Thu, 6 Aug 2020 01:40:31 +0100 Subject: [PATCH 1/3] Initial commit --- .gitignore | 2 ++ README.md | 74 +++++++++++++++++++++++++++++++++++++++++ confd/settings.php.twig | 11 ++++++ workspace.yml | 0 4 files changed, 87 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 confd/settings.php.twig create mode 100644 workspace.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ebe9bff --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/settings.php +/workspace.override.yml diff --git a/README.md b/README.md new file mode 100644 index 0000000..654d4a0 --- /dev/null +++ b/README.md @@ -0,0 +1,74 @@ +# Demo: Working with Workspace + +## Examples + +### Simple command + +```yaml +command('say-hello'): | + #!bash + echo 'Hello World' +``` + +### Using attributes + +```yaml +attribute('message'): Hello World! + +command('say-hello'): | + #!bash|@ + echo @('message') +``` + +### Using arguments + +```yaml +command('say-hello '): | + #!bash|= + echo ={ @('message') } from ={ input.argument('name') } +``` + +### Using arguments with envrionment variables + +```yaml +command('say-hello '): + env: + MESSAGE: = @('message') + NAME: = input.argument('name') + exec: | + #!bash|= + echo "$MESSAGE from $NAME" +``` + +### Managing secrets + +```yaml +# ws secret generate-random-key +key('default'): 'd38be3b7aa42fdbfb14c0d25f07bc1875edd5f13f640cd7d9e3bd7f67b3c3716' + +# ws secret encrypt 'Hello World!' +attribute('message'): = decrypt('YTozOntpOjA7czo3OiJkZWZhdWx0IjtpOjE7czoyNDoidJHP5MrjXU+iRjfzCnb+pQxjO+fudniUIjtpOjI7czoyODoi6kP/Zq8a3fzSMK/tC8XToLgJ9yPY8hNAe4BO3iI7fQ==') + +command('say-hello'): | + #!bash|@ + echo @('message') +``` + +### Configuration files + +```yaml +command('apply config'): | + #!php + $ws->confd('workspace:/confd')->apply(); + +confd('workspace:/confd'): + - { src: 'settings.php', dst: 'workspace:/settings.php' } + +attributes: + database: + driver: mysql + host: mysql + name: drupal + username: user + password: = decrypt('YTozOntpOjA7czo3OiJkZWZhdWx0IjtpOjE7czoyNDoi6LHweHpBsrOBtVHCFO/L4nuMnxuCejIiIjtpOjI7czoyMjoirG3KlBnw952zVvLWUSmdPAqJsql/vCI7fQ==') +``` diff --git a/confd/settings.php.twig b/confd/settings.php.twig new file mode 100644 index 0000000..8412512 --- /dev/null +++ b/confd/settings.php.twig @@ -0,0 +1,11 @@ + '{{ @('database.driver') }}', + 'host' => '{{ @('database.host') }}', + 'database' => '{{ @('database.name') }}', + 'username' => '{{ @('database.username') }}', + 'password' => '{{ @('database.password') }}', + 'prefix' => '', + 'collation' => 'utf8mb4_general_ci', +]; diff --git a/workspace.yml b/workspace.yml new file mode 100644 index 0000000..e69de29 From 8f5254045f62ab1cdc83555ed81a16673416cde6 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Wed, 9 Sep 2020 17:33:50 +0100 Subject: [PATCH 2/3] Finish demo --- workspace.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/workspace.yml b/workspace.yml index e69de29..15f2d87 100644 --- a/workspace.yml +++ b/workspace.yml @@ -0,0 +1,18 @@ +command('apply-config'): | + #!php + $ws->confd('workspace:/confd')->apply(); + +confd('workspace:/confd'): + - { src: 'settings.php', dst: 'workspace:/settings.php' } + +attributes: + database: + driver: mysql + host: mysql + name: drupal + username: user + password: secret + +command('say-hello'): | + #!bash + passthru echo 'Hello World' From b3d22ce6f445dc47ee76d711858f57575cd71e4b Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Thu, 2 Oct 2025 23:03:55 +0100 Subject: [PATCH 3/3] Move all files to working-with-workspace/demo/ --- .gitignore => working-with-workspace/demo/.gitignore | 0 README.md => working-with-workspace/demo/README.md | 0 {confd => working-with-workspace/demo/confd}/settings.php.twig | 0 workspace.yml => working-with-workspace/demo/workspace.yml | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename .gitignore => working-with-workspace/demo/.gitignore (100%) rename README.md => working-with-workspace/demo/README.md (100%) rename {confd => working-with-workspace/demo/confd}/settings.php.twig (100%) rename workspace.yml => working-with-workspace/demo/workspace.yml (100%) diff --git a/.gitignore b/working-with-workspace/demo/.gitignore similarity index 100% rename from .gitignore rename to working-with-workspace/demo/.gitignore diff --git a/README.md b/working-with-workspace/demo/README.md similarity index 100% rename from README.md rename to working-with-workspace/demo/README.md diff --git a/confd/settings.php.twig b/working-with-workspace/demo/confd/settings.php.twig similarity index 100% rename from confd/settings.php.twig rename to working-with-workspace/demo/confd/settings.php.twig diff --git a/workspace.yml b/working-with-workspace/demo/workspace.yml similarity index 100% rename from workspace.yml rename to working-with-workspace/demo/workspace.yml