version: 2
jobs:
  build:
    docker:
      - image: python:3.7-stretch
      
    working_directory: ~/repo

    # Only run this post merge
    branches:
      only:
        - staging
        - prod

    steps:
      - checkout

      # Download and cache dependencies
      - restore_cache:
          keys:
          - v1-dependencies-{{ checksum "requirements.txt" }}
          # fallback to using the latest cache if no exact match is found
          - v1-dependencies-

      - run:
          name: install dependencies
          command: |
            python3 -m venv venv
            source venv/bin/activate
            pip install --upgrade -r requirements.txt

      - setup_remote_docker
        
      - save_cache:
          paths:
            - ./venv
          key: v1-dependencies-{{ checksum "requirements.txt" }}

      - run:
          name: Build image if needed
          command: |
            source venv/bin/activate
            hubploy-image-builder \
              --push \
              --registry-url https://gcr.io \
              --registry-username _json_key \
              --registry-password "${GCR_READWRITE_KEY}" \
              deployments/datahub/image/ gcr.io/ucb-datahub-2018/primary-user-image

      - run:
          name: Install git-crypt
          command: |
            apt-get install --yes git-crypt

      - run:
          name: Unlock our secrets
          command: |
            echo "${GIT_CRYPT_KEY}" | base64 -d > ~/repo/key
            git crypt unlock ~/repo/key
            rm ~/repo/key

version: 2
jobs:
  build:
    docker:
      - image: buildpack-deps:bionic-scm
      
    working_directory: ~/repo

    # Only run this post merge
    branches:
      only:
        - staging
        - prod

    steps:
      - run:
          name: Install base apt packages
          command: |
            apt-get update --yes
            apt-get install --yes python3 python3-venv git-crypt

      - checkout

      # Download and cache dependencies
      - restore_cache:
          keys:
          - v1-dependencies-{{ checksum "requirements.txt" }}
          # fallback to using the latest cache if no exact match is found
          - v1-dependencies-

      - run:
          name: install dependencies
          command: |
            python3 -m venv venv
            source venv/bin/activate
            pip install --upgrade -r requirements.txt

      - setup_remote_docker
        
      - save_cache:
          paths:
            - ./venv
          key: v1-dependencies-{{ checksum "requirements.txt" }}

      - run:
          name: Build image if needed
          command: |
            source venv/bin/activate
            hubploy-image-builder \
              --push \
              --registry-url https://gcr.io \
              --registry-username _json_key \
              --registry-password "${GCR_READWRITE_KEY}" \
              deployments/datahub/image/ gcr.io/ucb-datahub-2018/primary-user-image

      - run:
          name: Install git-crypt
          command: |
            apt-get install --yes git-crypt

      - run:
          name: Unlock our secrets
          command: |
            echo "${GIT_CRYPT_KEY}" | base64 -d > ~/repo/key
            git crypt unlock ~/repo/key
            rm ~/repo/key

Switch to using Ubuntu base image
Switch to using Ubuntu base image

Stretch has a really old version of git-crypt
