Get Short SHA ID and Use it in a CI Process

Get the short SHA ID

Put the following variable in your script

${{CF_SHORT_REVISION}} 

Use the SHA ID in a tag

tag: ${{CF_SHORT_REVISION}} 

YAML example

step-name:
  type: build
  description: Free text description
  working-directory: ${{clone-step-name}}
  dockerfile: path/to/Dockerfile
  image-name: owner/new-image-name
  tag: ${{CF_SHORT_REVISION}}
  build-arguments:
    - key=value
  fail-fast: false 

Result in hub.docker

2016-10-18_17-42-38.png

Result in Codefresh

2016-10-18_17-49-22.png