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

Commit3110088

Browse files
add hook step-type example
1 parente0c47ce commit3110088

File tree

2 files changed

+41
-5
lines changed

2 files changed

+41
-5
lines changed

‎_data/home-content.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@
112112
localurl:/docs/codefresh-yaml/deployment-environments/
113113
-title:Hooks
114114
localurl:/docs/codefresh-yaml/hooks/
115+
-title:Plugins
116+
localurl:/docs/codefresh-yaml/steps/#creating-your-own-step
115117
-title:Examples
116118
localurl:/docs/yaml-examples/examples/
117119

‎_docs/codefresh-yaml/hooks.md‎

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ Hooks can be a [freestyle step]({{site.baseurl}}/docs/codefresh-yaml/steps/frees
1414

1515
For simple commands we suggest you use a small image such as`alpine`, but any Docker image can be used in hooks.
1616

17-
Also, Hooks can use[steps/plugins](https://steps.codefresh.io) and need to define:
18-
19-
1. The type field for the step/plugin.
20-
1. The arguments needed for the step/plugin.
21-
2217
##Pipeline hooks
2318

2419
Codefresh allows you to run a specific step before each pipeline as well as after it has finished.
@@ -262,6 +257,45 @@ The order of events in the example above is the following.
262257
1. The`on_finish` segment always executes at the end
263258

264259

260+
##Running[steps/plugins](https://steps.codefresh.io) in hooks:
261+
262+
Hooks can use[steps/plugins](https://steps.codefresh.io). With plugin you have to specify:
263+
264+
- The type field for the step/plugin.
265+
- The arguments needed for the step/plugin.
266+
267+
`codefresh.yml`
268+
{% highlight yaml %}
269+
{% raw %}
270+
version: "1.0"
271+
272+
hooks: #run slack-notifier hook on build completion
273+
on_finish:
274+
steps:
275+
exec:
276+
type: slack-notifier
277+
arguments:
278+
SLACK_HOOK_URL: '${{SLACK_WEBHOOK_URL}}'
279+
SLACK_TEXT: '${{SLACK_TEXT}}'
280+
281+
steps:
282+
step1:
283+
title: "Freestyle step"
284+
type: "freestyle"
285+
image: alpine
286+
commands:
287+
- echo "Codefresh"
288+
hooks: #run slack-notifier hook on step completion
289+
on_finish:
290+
steps:
291+
exec:
292+
type: slack-notifier
293+
arguments:
294+
SLACK_HOOK_URL: '${{SLACK_WEBHOOK_URL}}'
295+
SLACK_TEXT: '${{SLACK_TEXT}}'
296+
{% endraw %}
297+
{% endhighlight %}
298+
265299
##Controlling errors inside pipeline/step hooks
266300

267301
By default if a step fails within a pipeline, the whole pipeline will stop and be marked as failed. This is also true for`on_elected` segments as well. If they fail, then the whole pipeline will fail (regardless of the position of the segment in a pipeline or step).

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp