Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds basic text substitution to Deploy args #14

Merged
merged 5 commits into from
Aug 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: CI
on: [push]

jobs:
phpstan:
tests-and-static-analysis:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -12,4 +12,9 @@ jobs:
- name: PHPStan Static Analysis
uses: php-actions/phpstan@v3
with:
configuration: ./phpstan.neon
configuration: ./phpstan.neon
- name: PHPUnit Tests
uses: php-actions/phpunit@master
with:
bootstrap: vendor/autoload.php
configuration: phpunit.xml
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@
.idea
lagoon-sync
/scripts/*
!/scripts/default.yaml
!/scripts/default.yaml
./scratchpad
.phpunit.result.cache
.phpunit.cache
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,16 @@ All steps can take the following optional fields to set retry parameters

Currently, the toolbox supports the following functions.

#### Text Substitutions with environment variables

Some of the steps below support the notion of text substitution - that is, you're able to use string templates of the
form `{{ substitutionname }}` and before the step is run, it will replace the substitution with the appropriate text.

This system also allows for substitutions from environment variables. For instance, if you have an environment variable of the name
`SYSTEM_NAME`, you can use that in the step substitutions by referencing it as `{{ SYSTEM_NAME }}`

We use [twig](https://twig.symfony.com/) for formatting, which makes it simple to add default values, for instance, if `SYSTEM_NAME` is only available conditionally, we can do something like `{{ SYSTEM_NAME ?? 'default val' }}`

### Exec

The exec step allows you to run a command from inside the current advanced task's container, or within another pod.
Expand Down Expand Up @@ -147,9 +157,9 @@ The `exec` step allows you to do textual substitutions in the `command`.

It will do the following substitutions

* '%project%' for current project name
* '%environment%' for the current environment
* '%namespace%' for the current namespace
* '{{ project }}' for current project name
* '{{ environment }}' for the current environment
* '{{ namespace }}' for the current namespace

### scale

Expand Down
7 changes: 5 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@
"renoki-co/php-k8s": "^3.7",
"symfony/process": "^6.1",
"symfony/yaml": "^6.1",
"league/climate": "^3.8"
"league/climate": "^3.8",
"twig/twig": "^3.0",
"wyrihaximus/simple-twig": "^2.1"
},
"license": "MIT",
"require-dev": {
"phpstan/phpstan": "^1.10"
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^10"
}
}
Loading