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/codefresh-yaml/hooks.md
-39Lines changed: 0 additions & 39 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -557,51 +557,12 @@ steps:
557
557
{% endhighlight %}
558
558
559
559
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
-
598
560
##Limitations of pipeline/step hooks
599
561
600
562
With the current implementation of hooks, the following limitations are present: