How drone pull and deploy my other dependent services(from my bitbucket) first before running the integration test

Like title: how drone pull and deploy my other dependent services(from my bitbucket) first before running the integration test.

I have bitbucket repos A, B, C, lets say: https://xxx/A.git, https://xxx/B.git, and https://xxx/C.git, in each repo i already have the run.sh and Dockerfile, basically the run.sh will call the Dockerfile, build the docker image and run the service.

So now i want when i commit to repo A, then drone can help me to deploy B, C first, then A, then run the tests in A, what the .drone.yml will be look like?

How I understand your workflow the downstream plugin is the plugin you want to use. With that you can trigger builds on other repos and wait until it’s finished.

You can find the documentation for this plugin at http://plugins.drone.io/drone-plugins/drone-downstream/

@tboerger seems cannot get it work, i have something like this:

pipeline:
  trigger:
    image: plugins/downstream
    server: http://x.x.x.x:8000
    token: **[What the token here should be]**
    fork: true
    repositories:
      - lnshi/microservice-auth-jwt@tron_master 

But keep getting: Error: unable to get latest build for lnshi/microservice-auth-jwt@tron_master.

If go to check the drone server logs, not much useful information can be found there:

meddler.Targets: column [user_synced] not found in struct
meddler.WriteTargets: column [user_synced] not found in struct
meddler.Targets: column [repo_active] not found in struct
meddler.WriteTargets: column [repo_active] not found in struct
meddler.Targets: column [user_synced] not found in struct
meddler.WriteTargets: column [user_synced] not found in struct
meddler.Targets: column [repo_active] not found in struct
meddler.WriteTargets: column [repo_active] not found in struct
meddler.Targets: column [user_synced] not found in struct
meddler.WriteTargets: column [user_synced] not found in struct
meddler.Targets: column [repo_active] not found in struct
meddler.WriteTargets: column [repo_active] not found in struct
meddler.Targets: column [user_synced] not found in struct
meddler.WriteTargets: column [user_synced] not found in struct
meddler.Targets: column [repo_active] not found in struct
meddler.WriteTargets: column [repo_active] not found in struct
meddler.Targets: column [repo_active] not found in struct
meddler.WriteTargets: column [repo_active] not found in struct
time="2017-09-18T02:27:19Z" level=error msg="pull queue item: 25: successfully removed from backup"
meddler.Targets: column [user_synced] not found in struct
meddler.WriteTargets: column [user_synced] not found in struct
meddler.Targets: column [repo_active] not found in struct
meddler.WriteTargets: column [repo_active] not found in struct
meddler.Targets: column [user_synced] not found in struct
meddler.WriteTargets: column [user_synced] not found in struct
meddler.Targets: column [repo_active] not found in struct
meddler.WriteTargets: column [repo_active] not found in struct
meddler.Targets: column [user_synced] not found in struct
meddler.WriteTargets: column [user_synced] not found in struct
meddler.Targets: column [repo_active] not found in struct
meddler.WriteTargets: column [repo_active] not found in struct
meddler.Targets: column [user_synced] not found in struct
meddler.WriteTargets: column [user_synced] not found in struct
meddler.Targets: column [repo_active] not found in struct
meddler.WriteTargets: column [repo_active] not found in struct
meddler.Targets: column [user_synced] not found in struct
meddler.WriteTargets: column [user_synced] not found in struct
meddler.Targets: column [repo_active] not found in struct
meddler.WriteTargets: column [repo_active] not found in struct
time="2017-09-18T02:27:35Z" level=error msg="Error #01: sql: no rows in result set\n" ip=202.14.11.106 latency=1.028257ms method=GET path="/api/repos/lnshi/microservice-api-gateway/logs/17/1/trigger" status=404 time="2017-09-18T02:27:35Z" user-agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36"

my drone version: drone/drone:0.7.3

based on the piece of code i gave out, can u help to modify it to make it work?

These errors indicate the database has columns the codebase does not recognize

The root cause for this is installing a newer version of drone (ie latest or 0.8) and then attempting to downgrade to a lower version, which is not possible, because the newer database will still be in place.

@bradrydzewski totally removed the sqlite volume, and freshly redeployed the drone server, then commit, still got the below error:

trigger

Error: unable to get latest build for lnshi/microservice-auth-jwt@tron_master.

in the log:

time="2017-09-18T04:34:09Z" level=error msg="pull queue item: 1: successfully removed from backup"
time="2017-09-18T04:34:24Z" level=error msg="Error #01: sql: no rows in result set\n" ip=202.14.11.106 latency=706.386µs method=GET path="/api/repos/v-cube/microservice-api-gateway/logs/1/1/trigger" status=404 time="2017-09-18T04:34:24Z" user-agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36"

still totally no idea how to fix this, pls help.

this would tell me that that there is no existing build in the drone database for repository lnshi/microservice-auth-jwt and branch tron_master. The downstream plugin takes an existing build and restarts it. If no existing build exists, there is nothing to restart, and a 404 is returned.

@bradrydzewski yes, there is NOT one, so u mean this plugin is NOT what I am looking for? coz @tboerger recommended this.

Then for my requirements, what is the proper approach? can u give out some examples? thank u.

Sorry I am not sure I fully understand the requirements.

@bradrydzewski hmm, so weird, why did u post and then delete ur explanations…

my requirements are common and simple, before build and run the tests in this repo, pull, build and run its dependent repo first.

can u help on this? thank u.

Below is an example pipeline that clones and tests repositories. Is that what you are looking for?

pipeline:
  test_dependency_a:
    image: golang
    commands:
      - git clone https://xxx/a.git
      - cd a/
      - ./build.sh
      - ./test.sh
  test_dependency_b:
    image: golang
    commands:
      - git clone https://xxx/b.git
      - cd b/
      - ./build.sh
      - ./test.sh
  test_dependency_c:
    image: golang
    commands:
      - git clone https://xxx/c.git
      - cd c/
      - ./build.sh
      - ./test.sh
  build_this_repo:
    ...
  deploy_this_repo:
    ...

Remember that drone is just running shell commands. So I would ask you this question – how would solve this problem from your terminal with shell commands? Take those same shell commands, and put them into your drone configuration.

@bradrydzewski ok, then the most confused one is the image field, since i already had the Dockerfile in each repo, there i already specified the base image, then what is the image here is used for?

I think you are making incorrect assumptions about how drone works. It does not use dockerfiles. If you look at the official documentation, all examples specify a docker image in which your commands are executed. http://docs.drone.io/getting-started/

@bradrydzewski https://github.com/drone/drone/issues/1

I thought it was supported!!!

Let me try to clarify how drone works –

drone will use any docker image form the registry as your build environment. For example, if I am a go programmer I can use the official Go image as my build environment:

pipeline:
  build:
    image: golang
    commands:
      - go build
      - go test

or I can use a node image as my build environment:

pipeline:
  build:
    image: node
    commands:
      - npm install
      - npm test

or I can use the docker image as my build environment:

pipeline:
  build:
    image: docker
    commands:
      - docker build -t foo .
      - docker run --rm foo
      - docker rmi foo
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

You can use any image from any docker registry as your build environment. This is described in our documentation at http://docs.drone.io/pipelines/

You can also use some of our many plugins. The docker plugin can be used to build and publish images to a registry. For example the first step will compile and test our code, and the second step will build and publish the image:

pipeline:
  build:
    image: golang
    commands:
      - go build
      - go test
  publish:
    image: plugins/docker
    repo: foo/bar
    tags: latest
    file: Dockerfile

Note that in all of the above examples we specify an image attribute for each step in the pipeline. The image specifies a Docker image to be used as the execution environment for running your commands.

Drone can use any image from any registry as your execution environment. Drone cannot create an image at runtime using a Dockerfile. I believe this is what you want right? If yes, we have an open issue for this, which you can subscribe to here: https://github.com/drone/drone/issues/1609#issuecomment-304986851