version: "2017-09-20"
pipeline:
  - id: build
    overlay: ci/python
    type: script
    commands:
      - desc: "setup the environment"
        cmd: |
          apt-get update
          apt-get install -qy python3-dev python-pip python3-pip
          update-alternatives --install /usr/bin/python python /usr/bin/python3 10
          pip install -r python/requirements.txt
      - desc: "run tests"
        cmd: |
          nosetests -w python
      - desc: "build and push docker images"
        cmd: |
          BASE_IMAGE="pierone.stups.zalan.do/machinery/ghe-backup"
          if [[ "${CDP_TARGET_BRANCH}" == "master" && -z "${CDP_PULL_REQUEST_NUMBER}" ]]; then
              IMAGE="${BASE_IMAGE}:cdp-${CDP_BUILD_VERSION}"
          else
              IMAGE="${BASE_IMAGE}-test:cdp-${CDP_BUILD_VERSION}"
          fi

          docker build --cache-from "${BASE_IMAGE}:latest" -t "${IMAGE}" -f Dockerfile .

          docker push "${IMAGE}"
          echo "${IMAGE} pushed"

version: "2017-09-20"

dependencies:
  - id: python
    type: docker
    ref: registry.opensource.zalan.do/library/python-3.8

pipeline:
  - id: build
    overlay: ci/python
    type: script
    commands:
      - desc: "setup the environment"
        cmd: |
          apt-get update
          apt-get install -qy python3-dev python-pip python3-pip
          update-alternatives --install /usr/bin/python python /usr/bin/python3 10
          pip install -r python/requirements.txt
      - desc: "run tests"
        cmd: |
          nosetests -w python
      - desc: "build and push docker images"
        cmd: |
          BASE_IMAGE="pierone.stups.zalan.do/machinery/ghe-backup"
          if [[ "${CDP_TARGET_BRANCH}" == "master" && -z "${CDP_PULL_REQUEST_NUMBER}" ]]; then
              IMAGE="${BASE_IMAGE}:cdp-${CDP_BUILD_VERSION}"
          else
              IMAGE="${BASE_IMAGE}-test:cdp-${CDP_BUILD_VERSION}"
          fi

          docker build --cache-from "${BASE_IMAGE}:latest" -t "${IMAGE}" -f Dockerfile .

          docker push "${IMAGE}"
          echo "${IMAGE} pushed"

Add docker base images as CDP dependencies
Add docker base images as CDP dependencies
