You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _docs/yaml-examples/examples/vault-secrets-in-the-pipeline.md
+28-3Lines changed: 28 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,8 +8,7 @@ redirect_from:
8
8
toc:true
9
9
---
10
10
11
-
Codefresh offers a Vault plugin you may use from the[Step Marketplace](https://codefresh.io/steps/step/vault). The plugin imports key-value pairs from the Vault server, and exports them into the pipeline. Since this is a custom typed-step, variables are written to`/meta/env_vars_to_export`, as opposed to`/codefresh/volume/env_vars_to_export`.
12
-
11
+
Codefresh offers a Vault plugin you may use from the[Step Marketplace](https://codefresh.io/steps/step/vault). The plugin imports key-value pairs from the Vault server, and exports them into the pipeline.
@@ -34,10 +33,21 @@ The example application retrieves the system variable "password," from the pipel
34
33
35
34
Also in the example application is a simple unit test that ensures we are able to read and write data to the database.
36
35
37
-
You cannot run the application locally, as it needs to run in the pipeline in orderfor the teststopass.
36
+
You cannot run the application locally, as it needs to run in the pipeline in orderto use our environment variablestoconnect.
38
37
39
38
##Create the Pipeline
40
39
40
+
We will be running the following pipeline that contains three step types: a vault step, a[git-clone]({{site.baseurl}}/docs/codefresh-yaml/steps/git-clone/) step, and a[freestyle step]({{site.baseurl}}/docs/codefresh-yaml/steps/freestyle/).
You should be able to copy and paste this YAML in the in-line editor of the Codefresh UI. It will automatically clone the project for you.
42
52
43
53
Note that you need to change the`VAULT_ADDR`,`VAULT_AUTH`, and`VAULT_AUTH_TOKEN` arguments under the first step to your respective values.
@@ -88,4 +98,19 @@ The above pipeline does the following:
88
98
-Spins up a [Service Container]({{site.baseurl}}/docs/codefresh-yaml/service-containers/) running Redis on port 6379 , and sets the password to the database using our exported environment variable
89
99
-Sets `maven.repo.local` to cache Maven dependencies into the local codefresh volume to [speed up builds]({{site.baseurl}}/docs/learn-by-example/java/spring-boot-2/#caching-the-maven-dependencies)
90
100
-Runs unit tests and packages the jar. Note how you can directly refer to the service container's name (`my-redis-db-host`) when we set `server.host`
101
+
102
+
You will see that the variable was correctly exported to the pipeline by running a simple `echo` command: