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

**URL:** https://drone.discourse.group/t/how-drone-pull-and-deploy-my-other-dependent-services-from-my-bitbucket-first-before-running-the-integration-test/9328
**Category:** Drone Support
**Created:** [September 15, 2017, 5:46am UTC](https://drone.discourse.group/t/how-drone-pull-and-deploy-my-other-dependent-services-from-my-bitbucket-first-before-running-the-integration-test/9328 "2017-09-15T05:46:29Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![lnshi](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/lnshi/32/3807_2.png) [@lnshi](https://drone.discourse.group/u/lnshi)
#### Post date: [September 15, 2017, 5:46am UTC](https://drone.discourse.group/t/how-drone-pull-and-deploy-my-other-dependent-services-from-my-bitbucket-first-before-running-the-integration-test/9328/1 "2017-09-15T05:46:29Z")

</div>

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](http://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?

---

<div class="post-metadata">

### Author: ![tboerger](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/tboerger/32/4036_2.png) [@tboerger](https://drone.discourse.group/u/tboerger)
#### Post date: [September 15, 2017, 11:48am UTC](https://drone.discourse.group/t/how-drone-pull-and-deploy-my-other-dependent-services-from-my-bitbucket-first-before-running-the-integration-test/9328/2 "2017-09-15T11:48:17Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![tboerger](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/tboerger/32/4036_2.png) [@tboerger](https://drone.discourse.group/u/tboerger)
#### Post date: [September 15, 2017, 11:49am UTC](https://drone.discourse.group/t/how-drone-pull-and-deploy-my-other-dependent-services-from-my-bitbucket-first-before-running-the-integration-test/9328/3 "2017-09-15T11:49:19Z")

</div>

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

---

<div class="post-metadata">

### Author: ![lnshi](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/lnshi/32/3807_2.png) [@lnshi](https://drone.discourse.group/u/lnshi)
#### Post date: [September 18, 2017, 2:35am UTC](https://drone.discourse.group/t/how-drone-pull-and-deploy-my-other-dependent-services-from-my-bitbucket-first-before-running-the-integration-test/9328/4 "2017-09-18T02:35:38Z")

</div>

@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:

```auto
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?

---

<div class="post-metadata">

### Author: ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)
#### Post date: [September 18, 2017, 4:20am UTC](https://drone.discourse.group/t/how-drone-pull-and-deploy-my-other-dependent-services-from-my-bitbucket-first-before-running-the-integration-test/9328/5 "2017-09-18T04:20:39Z")

</div>

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

> [@\[Kubernetes Deployment\] Readiness Probes - How to tell Harness that your Container is Ready](https://drone.discourse.group/t/kubernetes-deployment-readiness-probes-how-to-tell-harness-that-your-container-is-ready/699/4):
>
> 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

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.

---

<div class="post-metadata">

### Author: ![lnshi](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/lnshi/32/3807_2.png) [@lnshi](https://drone.discourse.group/u/lnshi)
#### Post date: [September 18, 2017, 4:38am UTC](https://drone.discourse.group/t/how-drone-pull-and-deploy-my-other-dependent-services-from-my-bitbucket-first-before-running-the-integration-test/9328/6 "2017-09-18T04:38:39Z")

</div>

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

trigger

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

```

in the log:

```auto
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.

---

<div class="post-metadata">

### Author: ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)
#### Post date: [September 18, 2017, 5:41am UTC](https://drone.discourse.group/t/how-drone-pull-and-deploy-my-other-dependent-services-from-my-bitbucket-first-before-running-the-integration-test/9328/7 "2017-09-18T05:41:43Z")

</div>

> [@\[Kubernetes Deployment\] Readiness Probes - How to tell Harness that your Container is Ready](https://drone.discourse.group/t/kubernetes-deployment-readiness-probes-how-to-tell-harness-that-your-container-is-ready/699/6):
>
> unable to get latest build for lnshi/microservice-auth-jwt@tron\_master

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.

---

<div class="post-metadata">

### Author: ![lnshi](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/lnshi/32/3807_2.png) [@lnshi](https://drone.discourse.group/u/lnshi)
#### Post date: [September 18, 2017, 5:45am UTC](https://drone.discourse.group/t/how-drone-pull-and-deploy-my-other-dependent-services-from-my-bitbucket-first-before-running-the-integration-test/9328/8 "2017-09-18T05:45:20Z")

</div>

@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.

---

<div class="post-metadata">

### Author: ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)
#### Post date: [September 18, 2017, 5:52am UTC](https://drone.discourse.group/t/how-drone-pull-and-deploy-my-other-dependent-services-from-my-bitbucket-first-before-running-the-integration-test/9328/9 "2017-09-18T05:52:45Z")

</div>

> [@\[Kubernetes Deployment\] Readiness Probes - How to tell Harness that your Container is Ready](https://drone.discourse.group/t/kubernetes-deployment-readiness-probes-how-to-tell-harness-that-your-container-is-ready/699/8):
>
> Then for my requirements, what is the proper approach? can u give out some examples?

Sorry I am not sure I fully understand the requirements.

---

<div class="post-metadata">

### Author: ![lnshi](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/lnshi/32/3807_2.png) [@lnshi](https://drone.discourse.group/u/lnshi)
#### Post date: [September 18, 2017, 6:36am UTC](https://drone.discourse.group/t/how-drone-pull-and-deploy-my-other-dependent-services-from-my-bitbucket-first-before-running-the-integration-test/9328/10 "2017-09-18T06:36:56Z")

</div>

@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.

---

<div class="post-metadata">

### Author: ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)
#### Post date: [September 18, 2017, 7:03am UTC](https://drone.discourse.group/t/how-drone-pull-and-deploy-my-other-dependent-services-from-my-bitbucket-first-before-running-the-integration-test/9328/11 "2017-09-18T07:03:26Z")

</div>

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

```nohighlight
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.

---

<div class="post-metadata">

### Author: ![lnshi](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/lnshi/32/3807_2.png) [@lnshi](https://drone.discourse.group/u/lnshi)
#### Post date: [September 18, 2017, 8:37am UTC](https://drone.discourse.group/t/how-drone-pull-and-deploy-my-other-dependent-services-from-my-bitbucket-first-before-running-the-integration-test/9328/12 "2017-09-18T08:37:35Z")

</div>

@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?

---

<div class="post-metadata">

### Author: ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)
#### Post date: [September 18, 2017, 2:55pm UTC](https://drone.discourse.group/t/how-drone-pull-and-deploy-my-other-dependent-services-from-my-bitbucket-first-before-running-the-integration-test/9328/13 "2017-09-18T14:55:53Z")

</div>

> [@\[Kubernetes Deployment\] Readiness Probes - How to tell Harness that your Container is Ready](https://drone.discourse.group/t/kubernetes-deployment-readiness-probes-how-to-tell-harness-that-your-container-is-ready/699/12):
>
> since i already had the Dockerfile in each repo

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. [https://docs.drone.io/pipeline/overview/](http://docs.drone.io/getting-started/)

---

<div class="post-metadata">

### Author: ![lnshi](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/lnshi/32/3807_2.png) [@lnshi](https://drone.discourse.group/u/lnshi)
#### Post date: [September 20, 2017, 3:51am UTC](https://drone.discourse.group/t/how-drone-pull-and-deploy-my-other-dependent-services-from-my-bitbucket-first-before-running-the-integration-test/9328/14 "2017-09-20T03:51:25Z")

</div>

@bradrydzewski[https://github.com/drone/drone/issues/1](https://github.com/drone/drone/issues/1)

I thought it was supported!!!

---

<div class="post-metadata">

### Author: ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)
#### Post date: [September 20, 2017, 6:18am UTC](https://drone.discourse.group/t/how-drone-pull-and-deploy-my-other-dependent-services-from-my-bitbucket-first-before-running-the-integration-test/9328/15 "2017-09-20T06:18:07Z")

</div>

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:

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

```

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

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

```

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

```nohighlight
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/](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:

```nohighlight
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](https://github.com/drone/drone/issues/1609#issuecomment-304986851)
