Minikube and CircleCI 2.1

I’m trying to run minikube in CircleCI via a job with a machine executor and I’ve run into a few problems that I’m hoping someone on here can clear up.

This seems to be completely possible with CircleCI 2.0, and there’s a repo on GitHub that demonstrates this. I forked the repo and tested it myself and can confirm that it works, however I tried to replicate it in CircleCI 2.1 and I’ve run into two issues.

The first one might not affect my end result at all, but it is curious. I can’t seem to specify a machine image in 2.1. While the YAML is perfectly valid I get the following error at the start of the job:

Error pulling image circleci/classic:201808-01

Using just machine: true in the job definition does get past the error, but I encounter the major issue later on in the job.

It seems that I can’t access systemctl which minikube needs in order to start properly in whatever machine image the job is using. I discovered this when I debugged the job via SSH, I could not access systemctl even as root. This causes minikube start ... and ultimately the job to fail.

I should note that I’m running a test job via circleci local execute -c <file> --job <job>. Where <file> is the result of performing circleci config process <original>.

I suppose a possible workaround would be to look into running minikube in docker and use that as a service to test against when performing kubernetes integration tests.

Could it be that circleci local execute doesn’t handle a machine executor image properly? Running in locally on my machine results in the same issue.

Any ideas?

Hi,

We’d need to see as much as your config as you can share in order to help determine the issue.

You’ve mentioned using circleci local execute and running locally, what happens when you do an actual CircleCI build?

I guess I should start with a little more background on what I’m trying to accomplish. My goal was to construct a CircleCI workflow where I could run some basic unit tests on an orb I was developing.

My approach was to validate, pack, and publish a dev version of the orb, then in the next job process a testing CircleCI config that uses the dev version of the orb from 2.1 to 2.0, and use CircleCI local execute to run a few jobs from it.

I believe this would’ve worked if the jobs didn’t require the use of a machine executor, as local execute seems to roll out a container.

Here’s my CircleCI config:

version: 2.1

orbs:
  circleci: circleci/circleci-cli@0.1.2
  orb-tools: circleci/orb-tools@7.0.0

workflows:
  version: 2
  main:
    jobs:
      - orb-tools/lint:
          lint-dir: src
      - orb-tools/pack:
          requires:
            - orb-tools/lint
          source-dir: src
      - orb-tools/publish-dev:
          requires:
            - orb-tools/pack
          context: orb-publishing
          orb-name: ccpgames/minikube
          publish-token-variable: CIRCLECI_API_TOKEN
      - orb-tools/dev-promote-prod:
          filters:
            branches:
              only:
                - master
          requires:
            - orb-tools/publish-dev
          context: orb-publishing
          orb-name: ccpgames/minikube
          publish-token-variable: CIRCLECI_API_TOKEN
      - orb-tools/test-in-builds:
          requires:
            - orb-tools/publish-dev
          attach-workspace: true
          orb-name: minikube
          orb-location: workspace/orb.yml
          test-steps:
            - run: circleci config process test/unit.yml | tee test/unit-processed.yml
            - run: circleci local execute -c test/unit-processed.yml --job test-minikube

…and here’s my basic testing CircleCI config that I wanted to execute my test job from:

version: 2.1

orbs:
  minikube: ccpgames/minikube@dev:alpha

jobs:
  test-minikube:
    machine: true
    environment:
      CHANGE_MINIKUBE_NONE_USER: true
      KUBECONFIG: /home/circleci/.kube/config
      MINIKUBE_WANTUPDATENOTIFICATION: false
      MINIKUBE_WANTREPORTERRORPROMPT: false
      MINIKUBE_HOME: /home/circleci
    steps:
    - minikube/kubectl-setup
    - minikube/setup
    - minikube/start

workflows:
  test:
    jobs:
    - test-minikube

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