Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run build in local machine with drone.io

Tags:

drone.io

Does the build have to run on the drone.io server? Can I run the build locally? Since developers need to pass the build first before pushing code to github, I am looking for a way to run the build on developer local machine. Below is my .drone.yml file:

pipeline:
  build:
    image: node:latest
    commands:
      - npm install
      - npm test
      - npm run eslint
  integration:
    image: mongo-test
    commands:
      - mvn test

It includes two docker containers. How to run the build against this file in drone? I looked at the drone cli but it doesn't work in my expected way.

like image 931
Joey Yi Zhao Avatar asked Jan 05 '17 00:01

Joey Yi Zhao


People also ask

Is drone CI or CD?

Drone is a modern CI/CD product built for the cloud era.

Is drone IO free?

“It's free for the open-source community. So it's an open source only offering. There's no paid plan, and it's only available to public GitHub repositories,” Rydzewski explained. Rydzewski says the service was born out of a need for his own project.


1 Answers

@BradRydzewski comment is the right answer.

To run builds locally you use drone exec. You can check the docs.

Extending on his answer, you must execute the command in the root of your local repo, exactly where your .drone.yml file is. If your build relies on secrets, you need to feed these secrets through the command line using the --secret or --secrets-file option.

When running a local build, there is no cloning step. Drone will use your local git workspace and mount it in the step containers. So, if you checkout some other commit/branch/whatever during the execution of the local build, you will mess things up because Drone will see those changes. So don't update you local repo while the build is running.

like image 108
Daniel Cerecedo Avatar answered Oct 11 '22 08:10

Daniel Cerecedo