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

CF-5236: support CMD with entrypoint#28

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
itaysk merged 1 commit intomasterfromCF-5236
Mar 28, 2018
Merged
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
67 changes: 60 additions & 7 deletions_docs/codefresh-yaml/steps/freestyle.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,8 +25,14 @@ step_name:
commands:
- bash-command1
- bash-command2
cmd:
- arg1
- arg2
environment:
- key=value
entry_point:
- cmd
- arg1
fail_fast: false
when:
branch:
Expand All@@ -49,17 +55,64 @@ step_name:
| `description` | A basic, free-text description of the step. | Optional |
| `image` | The image from which the executable container is created. It can be an explicit ID of a Docker image, or a variable that references a **Build** or **Push** step. | Required |
| `working_directory` | The directory from which the commands are executed. It can be an explicit path in the container's file system, or a variable that references another step. The default `working_directory` is the cloned repository directory and not the working directory specified by the image. If you need to use the default working directory of the image use `IMAGE_WORK_DIR`. | Default |
| `commands` | One or more bash commands to execute. | Optional |
| `commands` | One or more commands to execute in a shell in the container, as array of strings. | Optional |
| `cmd` | docker CMD arguments to use along with the container entrypoint. can be string or array of strings. | Optional |
| `entry_point` | override the default container entrypoint. can be string or array of strings. | Optional |
| `environment` | A set of environment variables for the container. | Optional |
| `fail_fast` | If a step fails, and the process is halted. The default value is `true`. | Default |
| `when` | Define a set of conditions that need to be satisfied in order to execute this step. You can find more information in the [Conditional Execution of Steps]({{ site.baseurl }}/docs/codefresh-yaml/conditional-execution-of-steps/) article. | Optional |
| `on_success`, `on_fail` and `on_finish` | Define operations to perform upon step completion using a set of predefined [Post-Step Operations]({{ site.baseurl }}/docs/codefresh-yaml/post-step-operations/). | Optional |

<div class="bd-callout bd-callout-warning" markdown="1">
##### ENTRYPOINT

if you want to perform the entrypoint command that was described in the Dockerfile of the Docker image that you use in this step, you need to add this entrypoint command to list of commands of the freestyle step
</div>

**Exported resources:**
- Working Directory.

## Entry point

When using the original container entrypoint, you can use the `cmd` field to specify additional agruments to be used with the entrypoint. This can be a string, or an array of strings. For example:

```yaml
image: mwendler/cowsay
cmd:
- "Hello"
```

is equivalent to running `docker run mwendler/cowsay Hello` which is equivalent to running `cowsay Hello` inside the container.


You can override the container's default entrypoint using the `entry_point` field. This can be a string, or an array of strings. For example:

```yaml

image: mwendler/cowsay
entry_point:
- echo
- Hello
```

## Commands

When you use the `commands` field, it will override the container original `entrypoint` and will execute the commands in a shell inside the container.
The provided commands are concatenated into a single command using the shell's `;` operator, and are run using the default shell `/bin/sh` as an entry point.
Additional settings that are set only when using commands are `set -e`, and the `cf_export` utility.

### Commands and Entry point

If you want to retain the original entrypoint, do not use the `commands` field.

However, this example:

```yaml
image: mwendler/cowsay
commands:
- "Hello"
```

will cause and error because the engine will attempt to run the command `Hello` in a shell inside the container, and the command `Hello` is not a valid command.
In order to use the `commands` form with an `entrypoint` enabled container, you can add the commands from the entrypoint to the list of commands, like so:

```yaml
image: mwendler/cowsay
commands:
- cowsay "Hello"
```


[8]ページ先頭

©2009-2025 Movatter.jp