This article introduces how you can use Pmbot to update your Gitlab projects with with Drone, a free, self hosted CI platform.

In this article, we will assume that:

  • you already have a Pmbot installation up and running. We wrote a blog post on how to install Pmbot that you can find here.
  • you have already connected your Gitlab instance via a git Provider. We wrote another blog post to get you started with Gitlab here.
  • you already have a Drone instance up and running. A good place to start is the official documentation.

Connect Drone to Pmbot

In the setup wizard, we'll create a new CI provider. Let's select Drone as a CI provider.

Name your CI provider, toggle on "Self hosted", and fill in the URL of your Drone instance.

The personal token can be obtained in your user settings:

If you fill in your token at this stage, it will be global. If you leave it blank here, you will be required to add a token at the project level.

Now, click the "Add CI provider" button. You're now viewing your Pmbot dashboard.

Configure a project to run updates on Drone

We'll now click "Add first project", then search for our Git repository.

We'll select the first match for our search. This moves us to the next step where we'll configure the CI instance on which to run our updates.

We'll select our Drone instance. That will bring up the configuration form for this CI provider. The project path should be filled for you already, and the token can be left blank unless you haven't set a global token when creating the CI provider (see above). So here, we'll just click "next step".

Next, we'll setup the an update schedule. You can pick the branch, a period and a timezone.

Click Save to add the schedule. You'll now be able to click Enable project. You are now presented with the project home page.

This page shows you a basic .pmbot.yml file that we'll add to our Git repository:

version: "1"
  - packageManager:
      name: npm
      - name: auto-merge
          - success
          - partial

We'll also update our .drone.yml as follows:

kind: pipeline
type: docker
name: default

  PMBOT_PROJECT_ID: 5f2053468a7f7d4ecda640e6
  # !!!!! place this in a project secret variable !!!!!
  PMBOT_TOKEN: 8786c9eb06ec35e65fddb48c58d13509

  - name: update
    image: pmbot/bot
        from_secret: PMBOT_SSH_PRIVATE_KEY
      # skip this job for standard pipelines
      - if [ -z $PMBOT ]; then exit 0; fi
      # make node_modules available to pmbot CLI
      - npm ci
      # run the pmbot CLI
      - pmbot update --disable-host-key-verification

  # your existing build/test jobs
  - name: test
    image: node:12
      # skip this job when an update is triggered
      - if [ ! -z $PMBOT ]; then exit 0; fi
      - npm ci
      - npm test

  # notify pmbot of build status (must be the last step)
  - name: notify
    image: pmbot/bot
        - success
        - failure
        from_secret: PMBOT_SSH_PRIVATE_KEY
      - pmbot notify --debug

Finally, you'll want to generate an SSH keypair:

ssh-keygen -b 2048 -t rsa -f /tmp/sshkey -q -N ""

and add the public key as a deploy key to your Git repository and the private key as a secret environment variable name PMBOT_SSH_PRIVATE_KEY in your Drone project settings.

You can click I'm ready and run your first update.

We'll pick master:

Your update is now started.

Within a minute or so, you'l start seeing your dependencies being updated one after the other.

At the end of the update, you should see a summary of packages updated and actions executed.

Read further: