Today we are announcing support for Gitea. You will now be able to connect Pmbot, our automated dependency bot, to your Gitea projects.

Most of the self hosted world resolves around two major platforms for hosting Git repositories: Gitlab and Gitea. Both are open source Git servers which offer a wide range of features, including issues, merge requests, deploy keys, and more.

We promised that we would be adding more Git providers within the coming weeks, and we're starting off with this one, so if you're using Gitea, go ahead and install Pmbot to start updating your dependencies !

We'll skip the installation process as we've already written a detailed guide on how to install Pmbot using Docker compose. Our docs is also here to help.

We'll also assume that you already have a Gitea instance available. We'll be using Drone CI to perform updates, so make sure to checkout the blog post we wrote on how to use DroneCI with Pmbot.

Connect Gitea to Pmbot

First, let's connect Gitea to Pmbot. Go to the Git provider list:

Click Add and select Gitea as the type of Git provider:

Fill in the general information:

Now, go to the Application tab of your Gitea settings.

Scroll down to Create new OAuth2 application and fill in the form with the redirect URI given to you in the Pmbot UI:

Instruction in Pmbot for adding a Gitea OAuth2 in Gitea
Add a Gitea OAuth2 application

Click Create and copy the Client ID and Client Secret:

With the Client ID and Client Secret, you'll now be able to fill in the OAuth configuration of your Git provider:

Now, click Run test. You will be asked to authorize Pmbot to access your Gitea account

Now, click Add Git provider

Add a project from Gitea

We'll now configure a project from our Gitea server to be updated on our local Drone instance. In the project list, click Add first project

Select a project to update (if you don't see any projects in this list, make sure to synchronize your projects by clicking the Sync button):

Then, we'll pick our Local Drone CI provider, as we want updates to be run on our local Drone CI instance, and fill in the settings:

Tip: if you set a global personal token for your Drone CI provider, you don't need to fill it for every project.

Next, we'll save the first schedule with the default parameters (branch master, daily updates, UTC timezone):

Once the schedule is saved, click Enable project.

Configure the pmbot CLI

Let's add a basic .pmbot.yml to our Gitea project:

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

Then, we'll add a basic .drone.yml (the PMBOT_URL, PMBOT_PROJECT_ID and PMBOT_TOKEN are specific to your project, so make sure to see in your Pmbot UI what yours are) :

kind: pipeline
type: docker
name: default

environment:
  PMBOT_URL: http://192.168.1.54:3001
  PMBOT_PROJECT_ID: 5f27f3bb95a87753167cb613
  # !!!!!! just here for the demo, place in a secret in prod !!!!!!
  PMBOT_TOKEN: 05d384713182549c05a7519a2aa1d811

steps:
  - name: update
    image: registry.dev.pmbot/bot:npm-geoffroy
    environment:
      PMBOT_SSH_PRIVATE_KEY:
        from_secret: PMBOT_SSH_PRIVATE_KEY
    commands:
      - if [ -z $PMBOT ]; then exit 0; fi
      - npm ci
      - pmbot update --disable-host-key-verification --debug

  - name: test
    image: node:12
    commands:
      - if [ ! -z $PMBOT ]; then exit 0; fi
      - npm test

  - name: notify
    image: pmbot/bot
    pull: always
    commands:
      - pmbot notify --debug

image_pull_secrets:
  - dockerconfigjson

Finally, we'll setup an SSH deploy key so that the pmbot CLI can commit and push to your Gitea project.

Generate a random SSH keypair (or click Generate for me):

In your Gitea project, add the public key as a deploy key with write access:

Now, in Drone, add the private key in a secret variable named PMBOT_SSH_PRIVATE_KEY:

Now click I'm ready to get to the update screen:

Let's go ! Click Run first update, select branch master. Within a few seconds, you should see the update start and make progress.

This is a manual update, but since we've configured a daily update using schedules, Pmbot will automatically launch an update every day at midnight.

You'll start seeing new jobs in Drone:

And after a while, all your dependencies are updated and the update branch is merged into master:

Enjoy !

Read further: