- Notifications
You must be signed in to change notification settings - Fork165
Add section to reference shared config in YAML#715
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
0b12c91051746603a0ab92d9fd5e8a7e8f0b0a4398131631bFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -20,21 +20,31 @@ You can share: | ||
| * Any kind of YAML data (advanced) | ||
| ## Creating shared configuration contexts | ||
| Create one or more shared configuration contexts at the account-level to use in pipelines. | ||
| 1. In the Codefresh UI, on the toolbar, click the **Settings** icon. | ||
| 1. From the sidebar, select [**Shared Configuration**](https://g.codefresh.io/account-admin/account-conf/shared-config){:target="\_blank"}. | ||
| 1. Click **Add Configuration Context** and select the type of shared configuration context to add. | ||
| 1. Enter a name for the shared configuration context and click **Save**. | ||
| 1. Add one or more variables in Key = Value format. | ||
| 1. To allow access to all users, toggle **Allow access to all users** ON. | ||
| 1. Click **Save**. | ||
| {% include | ||
| image.html | ||
| lightbox="true" | ||
| file="/images/pipeline/shared-configuration/shared-configuration.png" | ||
| url="/images/pipeline/shared-configuration/shared-configuration.png" | ||
| alt="Creating shared configurationcontexts" | ||
| caption="Creating shared configurationcontexts" | ||
| max-width="50%" | ||
| %} | ||
| You can create four types of shared configuration contexts: | ||
| * **Shared Configuration**: for environment variables | ||
| * **Shared Secret**: for encrypted environment variables of sensitive data (access tokens, etc.) | ||
| @@ -82,6 +92,7 @@ max-width="60%" | ||
| We recommend that you disable access for all values of type *shared secret* and *secret YAML* unless your organization has different needs. | ||
| ## Using shared environment variables | ||
| Each pipeline has a set of environment variables that can be defined in the *Workflow* screen. | ||
| @@ -113,12 +124,13 @@ Once you click *Add* the values from the shared configuration will be appended t | ||
| you have in your pipelines. In case of similar values the shared configuration will follow the [precedence rules]({{site.baseurl}}/docs/pipelines/variables/#user-provided-variables). | ||
| ## Using shared Helm values | ||
| To use a shared YAML snippet for Helm values you can install a new Helm chart either from the: | ||
| * [Helm chart list]({{site.baseurl}}/docs/deployments/helm/helm-charts-and-repositories/) | ||
| * [Helm environment board]({{site.baseurl}}/docs/deployments/helm/helm-environment-promotion/) | ||
| In both cases, when you see the Helm installation dialog you can import any of your YAML snippets | ||
| to override the default chart values. | ||
| @@ -199,7 +211,7 @@ The shared variables can now be used across your pipelines. | ||
| ## Sharing any kind of YAML data in pipelines | ||
| All the snippets from shared configuration are also available as context in the [Codefresh CLI](https://codefresh-io.github.io/cli/contexts/). | ||
| This means that you can manipulate them programmatically and read their values in the pipeline in any way you see fit. | ||
| @@ -223,15 +235,15 @@ spec: | ||
| ### Example - custom value manipulation | ||
| Let's say that you have a YAML segment with the followingcontent: | ||
| {% highlight yaml %} | ||
| favorite: | ||
| drink: coffee | ||
| food: pizza | ||
| {% endhighlight %} | ||
| Here is a pipeline step thatreadstheYAML snippet and extracts a value: | ||
| `YAML` | ||
| {% highlight yaml %} | ||
| @@ -254,9 +266,34 @@ I love eating pizza | ||
| ## Manipulating shared configuration programmatically | ||
| You can also manipulate shared configurations programmatically via the [Codefresh CLI](https://codefresh-io.github.io/cli/){:target="\_blank"} and the [Codefresh API](https://g.codefresh.io/api/){:target="\_blank"}. | ||
| For example, you can reference one or more shared configuration contexts directly in the YAML using `spec.contexts` as described below. | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. not sure i understand - how is this section relevant here? it begins with the words "For example" and describes how you can reference a shared configuration, when the paragraph before talks about create/update/delete operations on shared configurations which is a totally different thing.. Or am I missing something? ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Good point; i will update as needed | ||
| If you have a shared configuration named `test-hello` that includes the variable `test=hello`, you can add `spec.contexts.test-hello` to the pipeline YAML, and then reference this variable in the pipeline as you would any other variable. | ||
| {% highlight shell %} | ||
| {% raw %} | ||
| version: "1.0" | ||
| kind: pipeline | ||
| metadata: | ||
| name: default/test-shared-config-from-pipe-spec | ||
| spec: | ||
| contexts: | ||
| - test-hello | ||
| steps: | ||
| test: | ||
| image: alpine | ||
| commands: | ||
| - echo ${{test}} # should output "hello" | ||
| {% endraw %} | ||
| {% endhighlight %} | ||
| For detailed information on how to create/update/delete shared configuration contexts via the CLI, see [Contexts](https://codefresh-io.github.io/cli/contexts/){:target="\_blank"}. | ||
| For information on alltheoptions available in the _full Codefresh YAML_, see [Full pipeline specifications]({{site.baseurl}}/docs/integrations/codefresh-api/#full-pipeline-specification). | ||