This repository has been archived by the owner on Jan 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aa2ad9a
commit 8836441
Showing
5 changed files
with
106 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
Working with environment variables | ||
================================== | ||
|
||
In a project-focused conception RKD is allowing to define environment variables in three places. | ||
|
||
1) Dotenv | ||
--------- | ||
|
||
:code:`.env` file is loaded on each RKD startup from directory, where :code:`./rkdw` is launched. | ||
|
||
2) Document scope | ||
----------------- | ||
|
||
When operating on YAML there is a possibility to define a makefile-scoped environment variables, inline and loaded from dotenv file. | ||
|
||
.. code:: yaml | ||
version: org.riotkit.rkd/yaml/v1 | ||
environment: | ||
STOP: "Police brutality" | ||
env_files: | ||
- .env-prod | ||
tasks: {} | ||
3) Task scope | ||
------------- | ||
|
||
.. code:: yaml | ||
version: org.riotkit.rkd/yaml/v1 | ||
tasks: | ||
:task1: | ||
environment: | ||
STOP: "Police brutality" | ||
env_files: | ||
- .env-prod | ||
steps: | | ||
echo "STOP: ${STOP}" | ||
4) Operating system scope | ||
------------------------- | ||
|
||
Traditional, expected way how to pass the environment variables. | ||
|
||
.. code:: bash | ||
STOP="Police brutality" ./rkdw :task1 | ||
Priority | ||
-------- | ||
|
||
Later has higher priority. | ||
|
||
1. Dotenv loaded at startup | ||
2. Document scope | ||
3. Task scope | ||
4. Operating system |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,6 +100,7 @@ Keep learning | |
pipelines | ||
project-structure | ||
standardlib/index | ||
environment | ||
usage/index | ||
rts/index | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
Syntax reference | ||
~~~~~~~~~~~~~~~~ | ||
|
||
+-------------------------------------------------------------------------+------------------------------------------------------+---------------------------------+---------------------------------------------+ | ||
| Simplified Python | Python Class | YAML | Description | | ||
+=========================================================================+======================================================+=================================+=============================================+ | ||
| get_steps(task: MultiStepLanguageAgnosticTask) -> List[str]: | get_steps | steps: [""] | List of steps in any language (only if | | ||
| | | | extending MultiStep LanguageAgnosticTask) | | ||
+-------------------------------------------------------------------------+------------------------------------------------------+---------------------------------+---------------------------------------------+ | ||
| stdin() | N/A | input: "" | Standard input text | | ||
+-------------------------------------------------------------------------+------------------------------------------------------+---------------------------------+---------------------------------------------+ | ||
| @extends(ClassName) decorator on a main method | ClassName(BaseClass) | extends: package.name.ClassName | Which Base Task should be extended | | ||
+-------------------------------------------------------------------------+------------------------------------------------------+---------------------------------+---------------------------------------------+ | ||
| execute(task: BaseClassNameTask, ctx: ExecutionContext): | execute(self, ctx: ExecutionContext) | execute: "" | Python code to execute | | ||
+-------------------------------------------------------------------------+------------------------------------------------------+---------------------------------+---------------------------------------------+ | ||
| inner_execute(task: BaseClassNameTask, ctx: ExecutionContext): | inner_execute(self, ctx: ExecutionContext) | inner_execute: "" | Python code to execute inside | | ||
| | | | inner_execute (if implemented by Base Task) | | ||
+-------------------------------------------------------------------------+------------------------------------------------------+---------------------------------+---------------------------------------------+ | ||
| compile(task: BaseClassNameTask, event: CompilationLifecycleEvent): | compile(self, event: CompilationLifecycleEvent): | N/A | Python code to execute during | | ||
| | | | Context compilation process | | ||
+-------------------------------------------------------------------------+------------------------------------------------------+---------------------------------+---------------------------------------------+ | ||
| configure(task: BaseClassNameTask, event: ConfigurationLifecycleEvent): | configure(self, event: ConfigurationLifecycleEvent): | configure: "" | Python code to execute during Task | | ||
| | | | configuration process | | ||
+-------------------------------------------------------------------------+------------------------------------------------------+---------------------------------+---------------------------------------------+ | ||
| get_description() | get_description(self) | description: "" | Task description | | ||
+-------------------------------------------------------------------------+------------------------------------------------------+---------------------------------+---------------------------------------------+ | ||
| get_group_name() | get_group_name() | N/A | Group name | | ||
+-------------------------------------------------------------------------+------------------------------------------------------+---------------------------------+---------------------------------------------+ | ||
| internal=True in TaskDeclaration | internal=True in TaskDeclaration | internal: False | Is task considered | | ||
| | | | internal? (hidden on | | ||
| | | | :tasks list) | | ||
+-------------------------------------------------------------------------+------------------------------------------------------+---------------------------------+---------------------------------------------+ | ||
| become in TaskDeclaration (or commandline switch) | become in TaskDeclaration | become: root | Change user for task execution time | | ||
| | (or commandline switch) | | | | ||
+-------------------------------------------------------------------------+------------------------------------------------------+---------------------------------+---------------------------------------------+ | ||
| workdir in TaskDeclaration | workdir in TaskDeclaration | workdir: /some/path | Change working directory for task | | ||
| | | | execution time | | ||
+-------------------------------------------------------------------------+------------------------------------------------------+---------------------------------+---------------------------------------------+ | ||
| configure_argparse(task: BaseClassNameTask, parser: ArgumentParser) | configure_argparse(self, parser: ArgumentParser) | arguments: {} | Configure argparse.ArgumentParser object | | ||
+-------------------------------------------------------------------------+------------------------------------------------------+---------------------------------+---------------------------------------------+ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters