Drone service image version needs to match package version from package.json

Hello,

here is my drone.yml:

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

services:
  myservice:
    image: dockerhub/myservice:{PACKAGE_VERSION}

Drone is testing a node client program that needs to interact with a server called myservice. To interact with myservice, my node client has a npm package installed in its package.json:

{
  "name": "my-client",
  "version": "2.0.0",
  "main": "src/cli.js",
  "scripts": {
    "test": "jest cli",
  },
  "dependencies": {
    "my-service-lib": "1.0.2",
  }
}

One hard requirement, is that drone has to launch a service docker image myservice that has the same version as the my-service-lib in the client package.json (ex: [email protected] AND dockerhub/myservice:1.0.2).

I’d like to avoid doing that manually by editing drone.yml each time my-service-lib has new version.

Am I clear, and if yes, how would you infer the service docker image version from the package.json my-service-lib version?

Thank you very much for your advices!

Hello everyone, please do not hesitate to ask clarification if I’m not clear. Also, if it seems not feasible to you, let me know :slight_smile:

Many Thanks