Giving Circle CI a Shot

Migrating from Jenkins to CircleCI

The reason being that hosting and maintaining a Jenkings server and its underlying Kubernetes infrastructure was getting a bit time consuming for some of the guys at work. CircleCI seemed a good alternative to employing extra DevOps staff to look after the ever increasing demands.

To get my head around CircleCI I decided to use to it deploy this blog.

So... Here goes

I linked CircleCI to my BitBucket account where I have this blog stored as a private repo. The blog is generated by a static site generator called Pelican.

version: 2
jobs:
    build:
        docker:
            - image: circleci/python:3.6.1
        working_directory: ~/repo
        steps:
            - checkout
            - restore_cache:
                keys:
                    - v1-dependencies-{{ checksum "requirements.txt" }}
                    # fallback to using latest cache if no match is found
                    - v1-dependencies-

            - run:
                name: Install the dependencies
                command: |
                    python3 -m venv venv
                    . venv/bin/activate
                    pip install -r requirements.txt
                    pwd

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

            - run:
                name: Make the html
                command: |
                    pwd
                    make html

            - run:
                name: Run some tests
                command: |
                    echo "Some tests"

            - add_ssh_keys:
                fingerprints:
                    - "07:5c:6d:58:6c:7d:1e:5e:56:78:e1:91:5a:dc:e2:d9"
            - run:
                name: Deploy that website
                command: |
                    sudo apt install -y rsync
                    make rsync_upload


workflows:
    version: 2
    build_and_deploy:
        jobs:
            - build

So far so good

If you're seeing this, then the YAML code written in ./.circleci/config.yml did the trick.