version: "1.0"
stages:
  - "clone"
  - "build"
  - "integration"
  - "push"
steps:
  main_clone:
    type: "git-clone"
    description: "Cloning main repository..."
    repo: "ornicar/lila"
    revision: "${{CF_BRANCH}}"
    stage: "clone"
  build:
    title: "Building Docker Image"
    type: "build"
    image_name: "ornicar/lila"
    tag: "${{CF_BRANCH_TAG_NORMALIZED}}"
    dockerfile:
      content: "FROM 1science/sbt:0.13.8-oracle-jre-8\n          WORKDIR /root/onboarding\n          COPY . /"
    stage: "build"
  parallel_push:
    type: "parallel"
    steps:
      annotate_build:
        title: "Annotating Build"
        image: "${{build}}"
        working_directory: "IMAGE_WORK_DIR"
        commands:
          - "echo Annotating Build..."
        on_success:
          metadata:
            set:
              - ${{build.imageId}}:
                  - CF_QUALITY: true
        on_error:
          metadata:
            set:
              - ${{build.imageId}}:
                  - CF_QUALITY: false
      push:
        title: "Pushing image to cfcr"
        type: "push"
        image_name: "ornicar/lila"
        registry: "cfcr"
        candidate: "${{build}}"
        tags:
          - "${{CF_BRANCH_TAG_NORMALIZED}}"
          - "${{CF_REVISION}}"
    stage: "push"
  SendToSlack:
    title: "Sending message to slack"
    image: "codefreshplugins/slacknotifier"
    environment:
      - "SLACK_HOOK_URL=${{SLACK_WEBHOOK_URL}}"
      - "SLACK_TEXT=${{SLACK_TEXT}}"
      - "SLACK_ATTACHMENTS=${{SLACK_ATTACHMENTS}}"
    stage: "notification"
