version: 2
jobs:
  lint-scripts:
    docker:
      - image: koalaman/shellcheck-alpine
    steps:
      - checkout
      - run:
          name: lint
          command: |
            shellcheck -x test/build.sh
            shellcheck -x test/e2e.sh
            shellcheck -x test/helm-test-e2e.sh
            shellcheck -x test/repo-sync.sh
  lint-charts:
    docker:
      - image: gcr.io/kubernetes-charts-ci/test-image:v3.2.0
    steps:
      - checkout
      - run:
          name: lint
          command: |
            git remote add k8s https://github.com/helm/charts
            git fetch k8s master
            ct lint --config test/ct.yaml
  sync:
    docker:
      - image: google/cloud-sdk
    steps:
      - checkout
      - run:
          name: sync
          command: test/repo-sync.sh
workflows:
  version: 2
  lint:
    jobs:
      - lint-scripts
      - lint-charts
  sync:
    triggers:
      - schedule:
          cron: "23,53 * * * *"
          filters:
            branches:
              only:
                - master
    jobs:
      - sync
