Codefresh Steps: Reusable Code for Common Operations
This page provides code you can use to perform common operations in the Codefresh CI/CD platform.
246M

Run a shell script freestyle

Run any shell command on top of a Docker image

arguments

  • cmd - docker CMD arguments to use along with the container entrypoint. can be string or array of strings.
  • commands - One or more commands to execute in a shell in the container, as array of strings.
  • entry_point - Override the default container entrypoint. can be string or array of strings.
  • environment - A set of environment variables for the container.
  • 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.
  • registry_context - The registry logical name of one of the inserted registries from the integration view. The default value will be your primary registry by image domain.
  • shell - Explicitly set the executing shell to bash or sh. If not set the default will be sh.
  • volumes - One or more volumes for the container. All volumes must be mounted from the existing shared volume (see details below).
  • 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.
    Freestyle:
  title: Running docker image
  type: freestyle
  working_directory: '${{CLONE_STEP_NAME}}'
  arguments:
    image: 'quay.io/codefreshplugins/alpine:3.8'
    commands:
      - echo "Hello world"
      - echo "asdasd"

  
    Freestyle:
  title: Running docker image
  type: freestyle
  working_directory: /
  arguments:
    image: 'quay.io/codefreshplugins/alpine:3.8'
    commands:
      - echo "Hello world"
      - echo "asdasd"

  
github.com
Codefresh INC
May 16, 2021