Circle ci 1.0 to 2.0 configuration

circle.yml
configuration

#1

Here is my circleci 1.0 configuration:

deployment:
    production:
    branch: master
    commands:
      - ./deploy.sh:
          timeout: 1800

My attempt at circleci 2.0 configuration :

version: 2
jobs:
  build:
    machine: true
    working_directory: ~/repo
    environment:
      TERM: "linux"
      TERMINFO: "/etc/terminfo"
    steps:
      - checkout
      - run: sudo pip install -r requirements.txt
      - run:
          name: Running tests
          command: pytest
  deploy:
    machine: true
    working_directory: ~/repo
    environment:
      TERM: "linux"
      TERMINFO: "/etc/terminfo"
    steps:
      - checkout
      - run:
          name: Deploy if tests pass and branch is Master
          command: ./deploy.sh

workflows:
  version: 2
  build-deploy:
    jobs:
      - build
      - deploy:
          requires:
            - build
          filters:
            branches:
              only: master

This doesnt work giving error “no module named req”
Can anyone please help with this migration?


#2

Probably I think there is a mistake in your grammar of yaml.
Please write your yaml with indent included.


#3

I have updated the indentation


#5

Thank you @halfer I have updated my question formatting.


#6

Try cutting down your YAML file to the bare essentials, for example you could remove the workflows section entirely. By a process of trial and error, you can work out what part is upsetting it.


#7

Can you please suggest bare minimum config based on my 1.0 config ?


#8

Well, I meant the bare minimum to just get it to pass. Try this:

version: 2
jobs:
  build:
    machine: true
    working_directory: ~/repo
    steps:
      - checkout

Then, add a couple of new lines to it repeatedly until you find the error :smiley_cat:


#9

Ok fine. My idea is to test on each branch push. But deploy only if branch is master .


#10

Remove filters section in workflows.
That section specify trigger branches.


#11

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.