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/pipelines/annotations.md
+8-2Lines changed: 8 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -134,9 +134,9 @@ steps:
134
134
135
135
136
136
137
-
##Add annotations to the current build/image
137
+
####Example 3: Add annotations to the current build/image
138
138
139
-
Define annotations at the root level of the`build` step toadd an annotation to the current build or image without defining the entity type and ID.
139
+
Toadd an annotation to the current build or image without defining the entity type and ID, add it at the root level of the`build` step.
140
140
141
141
This method provides a way to add annotations without the entity type and ID, compared to post-step operations where you explicitly define the target type and ID.
142
142
@@ -176,6 +176,12 @@ codefresh get annotation build 5ce26f5ff2ed0edd561fa2fc
176
176
177
177
You can also define`entity_type` as`image` and don't enter any`entity_id`. In this case the image created from the build step will be annotated.
178
178
179
+
##`cf_predecessor` for BUILD_ID of parent pipeline
180
+
Codefresh has native support to navigate from parent to child builds.
181
+
To navigate from the child build to its parent, we have the`cf_predecessor` annotation.
182
+
183
+
The`cf_predecessor` annotation is automatically added to builds executed by calls to a[`codefresh-run` plugin](https://codefresh.io/steps/step/codefresh-run){:target="\_blank"}.
184
+
By querying the value of this annotation in the child build, you can get the ID of the parent build.
Copy file name to clipboardExpand all lines: _docs/pipelines/variables.md
+70-13Lines changed: 70 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -121,6 +121,7 @@ Gerrit has `change-Id` and `Changes` that you can map to `CF_PULL_REQUEST` varia
121
121
| {% raw %}`${{CF_PIPELINE_NAME}}`{% endraw %}| The full path of the pipeline, i.e. "project/pipeline"|
122
122
| {% raw %}`${{CF_STEP_NAME}}`{% endraw %}| the name of the step, i.e. "MyUnitTests"|
123
123
| {% raw %}`${{CF_URL}}`{% endraw %}| The URL of Codefresh system|
124
+
| {% raw %}`${{CF_OUTPUT_URL}}`{% endraw %}| Display link to an external URL on step execution. For example, display the link to a parent-build from the child-build.<br>See[Export external link with CF_OUTPUT_URL](#export-external-link-with-cf_output_url) in this article.|
124
125
| {% raw %}`${{CI}}`{% endraw %}| The value is always`true`|
125
126
| {% raw %}`${{CF_KUBECONFIG_PATH}}`{% endraw %}| Path to injected kubeconfig if at least one Kubernetes cluster is[configured]({{site.baseurl}}/docs/integrations/kubernetes/#connect-a-kubernetes-cluster). You can easily run[custom kubectl commands]({{site.baseurl}}/docs/deployments/kubernetes/custom-kubectl-commands/) since it is automatically setup by Codefresh in all pipelines.|
126
127
| Any variable specified in the pipeline settings| For example, if you configure the pipeline settings with a variable named PORT, you can put the variable in your YAML build descriptor as {% raw %}`${{PORT}}`{% endraw %}.|
@@ -169,13 +170,13 @@ Variables that are created by steps can have members. The members depend on the
@@ -208,8 +209,6 @@ When a pull request is closed in GitHub, the following variables are also availa
208
209
| {% raw %}`${{CF_PULL_REQUEST_HEAD_COMMIT_SHA}}`{% endraw %}| the commit SHA on the head branch (the branch that we want to push)|
209
210
210
211
##Gerrit changeId & change message variables
211
-
212
-
213
212
Gerrit has no explicit concept of pull requests, as in other version control systems, to map trigger event payloads to builds. Instead, Gerrit uses`Changes` which serves a similar purpose and functionality as pull requests. You can achieve the same functionality in Codefresh with our`CF_PULL_REQUEST` group of environment variables.
214
213
215
214
@@ -224,11 +223,11 @@ Gerrit has no explicit concept of pull requests, as in other version control sys
224
223
225
224
##User-defined variables
226
225
227
-
User variables can be defined at6 levels:
226
+
User variables can be defined atsix levels:
228
227
229
-
1. Manually within a step using the[export](http://linuxcommand.org/lc3_man_pages/exporth.html){:target="\_blank"} command or in any**subsequent** stepwith the[cf_export](#using-cf_export-command) command
1. Specific buildExecution (after clicking the "Build" button open the "Build Variables" section, or use the[CLI]({{site.baseurl}}/docs/integrations/codefresh-api/#example---triggering-pipelines))
228
+
1. Manually within a step using the[export](http://linuxcommand.org/lc3_man_pages/exporth.html){:target="\_blank"} command, or in any**subsequent** stepusing the[cf_export](#using-cf_export-command) command
229
+
1.[Freestyle step definition]({{site.baseurl}}/docs/pipelines/steps/freestyle/#examples),using the`environment` field
230
+
1. Specific buildexecution (after clicking the "Build" button open the "Build Variables" section, or use the[CLI]({{site.baseurl}}/docs/integrations/codefresh-api/#example---triggering-pipelines))
232
231
1. Pipeline Definition (under "Environment variables" section in the[pipeline view]({{site.baseurl}}/docs/pipelines/pipelines/#creating-new-pipelines))
233
232
1.[Shared Configuration]({{site.baseurl}}/docs/pipelines/configuration/shared-configuration/) (defined under your account settings, and used using the "Import from shared configuration" button under the "Environment Variables" section in the pipeline view)
234
233
1. Variables defined on the Project level (Under the variables tab on any project view)
@@ -237,6 +236,12 @@ The options are listed in order of priority (from the most important to the leas
237
236
238
237
For example if a pipeline variable is defined both in project level and as an execution parameter of a specific build, then the final result will be the value defined as a build parameter and the project level variable will not take effect.
239
238
239
+
240
+
241
+
242
+
243
+
244
+
240
245
##Exporting environment variables from a freestyle step
241
246
242
247
Steps defined within steps are scoped to the step they were created in (even if you used the`export` command). To use variables across steps, we provide a shared file through which you can import and export variables.
@@ -245,12 +250,19 @@ There are two ways to add variables to the shared file:
245
250
* Using the`cf_export` command
246
251
* Writing directly to the file
247
252
253
+
254
+
255
+
256
+
257
+
248
258
###Exporting variables with`cf_export`
249
259
Within every freestyle step, the`cf_export` command allows you to export variables across steps by writing to the shared variables file.
250
260
261
+
251
262
>**NOTE**
252
263
The variables exported through`cf_export` overrides those at the pipeline-level.
253
264
265
+
254
266
You can either:
255
267
- Explicitly state a VAR=VAL pair
256
268
- State the name of an existing*exported* environment variable (like EXISTING_VAR).
@@ -365,6 +377,51 @@ steps:
365
377
366
378
Use this technique if you have complex expressions that have issues with the`cf_export` command.
367
379
380
+
##Export external link with`CF_OUTPUT_URL`
381
+
382
+
Codefresh has native support to trigger child builds from parent builds, and to navigate from the parent to the child build through the`codefresh-run` plugin ([link](https://codefresh.io/steps/step/codefresh-run)).
383
+
Using the`CF_OUTPUT_URL` variable, you can also navigate from the child build back to the parent build.
384
+
385
+
Simply add a step to the child build with an in-step link to the parent build. The URL link to the parent build is displayed as part of the step details in the Builds page.
386
+
387
+
{{site.data.callout.callout_tip}}
388
+
**TIP**
389
+
Every build executed by a call to a`codefresh-run` plugin is enriched with a special annotation that precisely identifies its parent, the[`cf_predecessor` annotation]({{site.baseurl}}/docs/pipelines/annotations/#cf_predecessor-for--build_id--of-parent-pipeline).
390
+
You can get the ID of the parent build by querying the value of this annotation in the child build.
391
+
{{site.data.callout.end}}
392
+
393
+
394
+
#####Add`CF_OUTPUT_URL` with`cf_export`
395
+
Create a link to the parent-build using`cf_export` and`CF_OUTPUT_URL`.
396
+
`
397
+
398
+
#####Example step in child build to output link to parent
399
+
400
+
Add the following step at the beginning of the pipeline.
401
+
402
+
>**NOTE**
403
+
The name of the variable exported by `cf_export` must have the format `<name|key_of_step>_CF_OUTPUT_URL`. It's value is the URL of the parent build to link to.
In the Builds page, the step details of the child build displays the**Output URL** which is the link to the parent build, as in the image below.
422
+
423
+

424
+
368
425
##Masking variables in logs
369
426
370
427
Codefresh has the built-in capability to automatically mask variables in logs if they are encrypted. The values of encrypted variables will be replaced with asterisks in build logs.