Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitadd2af7

Browse files
Variables can now be used in hooks
1 parent7fa3e04 commitadd2af7

File tree

2 files changed

+2
-39
lines changed

2 files changed

+2
-39
lines changed

‎_docs/codefresh-yaml/hooks.md‎

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -557,51 +557,12 @@ steps:
557557
{% endhighlight %}
558558

559559

560-
##Variable Interpolation in hook segments
561-
562-
[Codefresh variables]({{site.baseurl}}/docs/codefresh-yaml/variables/) are**not** interpolated inside the main hook segments.
563-
564-
The following will NOT work:
565-
566-
{% highlight yaml %}
567-
{% raw %}
568-
hooks:
569-
on_finish:
570-
exec:
571-
image: alpine:latest
572-
commands:
573-
- echo $CF_BUILD_ID
574-
{% endraw %}
575-
{% endhighlight %}
576-
577-
However, you can use interpolations inside the`environment` block. The following WILL work:
578-
579-
580-
{% highlight yaml %}
581-
{% raw %}
582-
hooks:
583-
on_finish:
584-
exec:
585-
image: alpine:latest
586-
environment:
587-
- WCF_BUILD_ID=${{CF_BUILD_ID}}
588-
commands:
589-
- echo $WCF_BUILD_ID
590-
{% endraw %}
591-
{% endhighlight %}
592-
593-
In other words, interpolation in the 'environment' block works just fine. And you can use the environment variables set there in the commands block.
594-
595-
There is one MAJOR caveat. This only works for variables present when the build starts. It does NOT work for any variables created or modified in the pipeline_while it runs_. So basically the`CF_*` variables and anything sent in by the pipeline or trigger settings will work as expected, but custom variables created with`cf_export` will not work.
596-
597-
598560
##Limitations of pipeline/step hooks
599561

600562
With the current implementation of hooks, the following limitations are present:
601563

602564
* The[debugger]({{site.baseurl}}/docs/configure-ci-cd-pipeline/debugging-pipelines/) cannot inspect commands inside hook segments
603565
* Hooks are not supported for[parallel steps]({{site.baseurl}}/docs/codefresh-yaml/advanced-workflows/)
604-
* Exporting variables with[cf_export]({{site.baseurl}}/docs/codefresh-yaml/variables/#using-cf_export-command) does not work inside hooks
605566
* Storage integrations don't resolve in hooks (for example,[test reports]({{site.baseurl}}/docs/testing/test-reports/#producing-allure-test-reports-from-codefresh-pipelines))
606567

607568

‎_docs/whats-new/whats-new.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ toc: true
1212
###September 2021
1313

1414
- Custom plugins can be used in hooks -[documentation]({{site.baseurl}}/docs/codefresh-yaml/hooks/#limitations-of-pipelinestep-hooks)
15+
- Variables can now be used in hooks -[documentation]({{site.baseurl}}/docs/codefresh-yaml/hooks/#limitations-of-pipelinestep-hooks)
16+
- New`CF_STEP_NAME` variable -[documentation]({{site.baseurl}}/docs/codefresh-yaml/variables/#system-provided-variables)
1517

1618
###August 2021
1719

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp