version: "1.0"
stages:
  - "clone"
  - "build"
  - "integration"
  - "push"
steps:
  main_clone:
    type: "git-clone"
    description: "Cloning main repository..."
    repo: "lodash/lodash"
    revision: "${{CF_BRANCH}}"
    stage: "clone"
  build:
    title: "Building Docker Image"
    type: "build"
    image_name: "lodash/lodash"
    tag: "${{CF_BRANCH_TAG_NORMALIZED}}"
    dockerfile:
      content: "FROM node:10.13.0-alpine\n          WORKDIR /root/onboarding\n          COPY . /\n          CMD npm start"
    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: "lodash/lodash"
        registry: "cfcr"
        candidate: "${{build}}"
        tags:
          - "${{CF_BRANCH_TAG_NORMALIZED}}"
          - "${{CF_REVISION}}"
    stage: "push"
  parallel_scripts:
    type: "parallel"
    steps:
      Pretest:
        title: "Pretest"
        image: "node:latest"
        commands:
          - "yarn install"
          - "yarn run pretest"
      Test:
        title: "Test"
        image: "node:latest"
        commands:
          - "yarn install"
          - "yarn run test"
      Test:doc:
        title: "Test:doc"
        image: "node:latest"
        commands:
          - "yarn install"
          - "yarn run test:doc"
      Test:fp:
        title: "Test:fp"
        image: "node:latest"
        commands:
          - "yarn install"
          - "yarn run test:fp"
      Test:wip:
        title: "Test:wip"
        image: "node:latest"
        commands:
          - "yarn install"
          - "yarn run test:wip"
      Test:main:
        title: "Test:main"
        image: "node:latest"
        commands:
          - "yarn install"
          - "yarn run test:main"
  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"
