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

add hook step-type example#374

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

Merged
mikhail-klimko merged 1 commit intomasterfromCR-4823
Feb 22, 2022
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions_data/home-content.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -112,6 +112,8 @@
localurl: /docs/codefresh-yaml/deployment-environments/
- title: Hooks
localurl: /docs/codefresh-yaml/hooks/
- title: Plugins
localurl: /docs/codefresh-yaml/steps/#creating-your-own-step
- title: Examples
localurl: /docs/yaml-examples/examples/

Expand Down
44 changes: 39 additions & 5 deletions_docs/codefresh-yaml/hooks.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,11 +14,6 @@ Hooks can be a [freestyle step]({{site.baseurl}}/docs/codefresh-yaml/steps/frees

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

Also, Hooks can use [steps/plugins](https://steps.codefresh.io) and need to define:

1. The type field for the step/plugin.
1. The arguments needed for the step/plugin.

## Pipeline hooks

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


## Running [steps/plugins](https://steps.codefresh.io) in hooks:

Hooks can use [steps/plugins](https://steps.codefresh.io). With plugin you have to specify:

- The type field for the step/plugin.
- The arguments needed for the step/plugin.

`codefresh.yml`
{% highlight yaml %}
{% raw %}
version: "1.0"

hooks: #run slack-notifier hook on build completion
on_finish:
steps:
exec:
type: slack-notifier
arguments:
SLACK_HOOK_URL: '${{SLACK_WEBHOOK_URL}}'
SLACK_TEXT: '${{SLACK_TEXT}}'

steps:
step1:
title: "Freestyle step"
type: "freestyle"
image: alpine
commands:
- echo "Codefresh"
hooks: #run slack-notifier hook on step completion
on_finish:
steps:
exec:
type: slack-notifier
arguments:
SLACK_HOOK_URL: '${{SLACK_WEBHOOK_URL}}'
SLACK_TEXT: '${{SLACK_TEXT}}'
{% endraw %}
{% endhighlight %}

## Controlling errors inside pipeline/step hooks

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).
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp