OneDev: Part 3 - Advanced settings and features

Published: Nov 28, 2024 by Isaac Johnson

Today we will wrap the series on OneDev by looking at a few more advanced features including Email Templates, Invites, and Labels. We’ll look at GIT Branch protections and Forks and how to contribute back including digging into PRs. We’ll cover child projects and impersonations as well as automated backups.

Lastly, I’ll show some features that still are proving challenging for me, namely time management (a feature of EE) and limitations on the hosted OneDev container registry.

Let’s dig in!

Email Templates

Just about every missive the system can send is configurable.

Perhaps you want to let your users know they are special and loved whenever they have to reset a password.

We could add that to the Password Reset template

/content/images/2024/11/onedev3-01.png

Then if they reset their password

/content/images/2024/11/onedev3-02.png

We can see they get a lovely added note to the message in their inbox

/content/images/2024/11/onedev3-03.png

Service Desk settings

Since my mail service is outgoing only, this really isn’t a feature I can test. However, as you see, you can set up OneDev to check the inbox and create issues based on incoming messages

/content/images/2024/11/onedev3-04.png

Invites and Gravatar

We can use Gravatar for icons

/content/images/2024/11/onedev3-05.png

Now this is not enabled by default.

For instance, if I send an invite to my gmail address

/content/images/2024/11/onedev3-06.png

Once I set my details, I can verify it pulled from my (very old) Gravatar

/content/images/2024/11/onedev3-07.png

Labels

In JIRA we can create labels ad-hoc, which makes it nice for dynamic lists - but I’ve also seen the downfall of that with every spelling variation of team names used.

In OneDev, we also have labels, but one needs to create them upfront.

For instance, perhaps I want to organize things around the related project

/content/images/2024/11/onedev3-08.png

I can now use Labels on builds, PRs and Project settings. For instance, I can set the primary “Public Project” to “Blog”

/content/images/2024/11/onedev3-09.png

I can now see that shown when listing Projects

/content/images/2024/11/onedev3-10.png

GIT Branch Protection

That reminds me, what if we want to ensure all code gets reviewed in our project?

We can use Branch Protection to add a Rule

/content/images/2024/11/onedev3-11.png

For instance, I could set branch protections on main

/content/images/2024/11/onedev3-12.png

I noticed it didn’t block me from pushing files right to main, whether I was an admin user or not.

/content/images/2024/11/onedev3-13.png

But if I add some required reviewers which can be a logical query language statement of user and groups

/content/images/2024/11/onedev3-14.png

We can see PRs are enforced

/content/images/2024/11/onedev3-15.png

Contributing from a fork

Let’s say that we’ve made some changes in our fork and we want to push it back to the parent.

We can create a Pull Request

/content/images/2024/11/onedev3-26.png

At the bottom we can see differences

/content/images/2024/11/onedev3-27.png

We now have a named PR (PUB-1) for review

/content/images/2024/11/onedev3-28.png

Now, as a normal user, I can comment on a PR, but not on individual lines

/content/images/2024/11/onedev3-29.png

Child Projects

Try as I might, I cannot find a “fork” option anywhere. I’m hoping “Child Projects” might provide that.

I can go to “Child Projects” under a main project and click the “+”

/content/images/2024/11/onedev3-16.png

I’ll give it a name, optional description and project key

/content/images/2024/11/onedev3-17.png

We can now see the project

/content/images/2024/11/onedev3-18.png

On our Projects page we can now see the child project listed

/content/images/2024/11/onedev3-19.png

It was in exploring projects I found the fork option by the three-dot menu on the left-hand project navigation

/content/images/2024/11/onedev3-20.png

I saw the documentation showing we should be able to fork this way but in testing , we see the icon I would call “sharing” actually does the fork

If I go to commits, I can see the history along with any related builds

/content/images/2024/11/onedev3-22.png

If I click on a commit, I can see a decent git diff

/content/images/2024/11/onedev3-23.png

As expected, I can do split or inline diffs s well as ignoring whitespace

/content/images/2024/11/onedev3-24.png

If one wants, they can kick this particular SHA into any existing manual build (here you can see this SHA is running on FirstPipeline)

/content/images/2024/11/onedev3-25.png

It failed and we can now see the feedback in the commits page

/content/images/2024/11/onedev3-26.png

Docker images

While I had some difficulty getting pipelines to push to the internal registry, I did try doing it locally

First, we login

$ docker login 1dev.tpk.pw
Username: builder
Password:
Login Succeeded

I tried to push a small 35Mb image

$ docker tag ghcr.io/go-shiori/shiori:latest 1dev.tpk.pw/publicproject/shiori:latest

$ docker push 1dev.tpk.pw/publicproject/shiori:latest
The push refers to repository [1dev.tpk.pw/publicproject/shiori]
9c540c97ed3b: Pushed
c08bb409637f: Pushed
7f6380c20185: Pushing [==================================================>]  33.72MB/33.72MB
108b90d7eca8: Pushed
e497232d4ff4: Pushed
unknown: <html>
<head><title>413 Request Entity Too Large</title></head>
<body>
<center><h1>413 Request Entity Too Large</h1></center>
<hr><center>nginx/1.25.4</center>
</body>
</html>

Under “Performance Settings” I noted that there was a 20Mb file limit I thought could affect uploads

/content/images/2024/11/onedev3-71.png

So I upped that to 2gb and saved

/content/images/2024/11/onedev3-72.png

But then a test of pushing a small 42Mb container still failed

builder@DESKTOP-QADGF36:~$ docker tag k8s.gcr.io/coredns/coredns:v1.8.6 1dev.tpk.pw/publicproject/coredns:v1.8.6
builder@DESKTOP-QADGF36:~$ docker push 1dev.tpk.pw/publicproject/coredns:v1.8.6
The push refers to repository [1dev.tpk.pw/publicproject/coredns]
80e4a2390030: Pushing [==================================================>]  46.62MB/46.62MB
256bc5c338a6: Pushed
unknown: <html>
<head><title>413 Request Entity Too Large</title></head>
<body>
<center><h1>413 Request Entity Too Large</h1></center>
<hr><center>nginx/1.25.4</center>
</body>
</html>

Notifications

Let’s say we want to add some Discord notifications.

First, we go to a channel and Integrations to add a webhook

/content/images/2024/11/onedev3-30.png

I’ll give it a name and default channel

/content/images/2024/11/onedev3-31.png

Now in “Settings/Notifications/Discord Notifications”, we can add our Webhook URL and which events for which we want to send notifications.

/content/images/2024/11/onedev3-32.png

I made comment on a PR and then a new issue and indeed saw updates on Discord

/content/images/2024/11/onedev3-33.png

Issue Description Templates

Under Administration Issue Settings, we can go to Description Templates to click “+” to create a new one

/content/images/2024/11/onedev3-34.png

I’ll put together a new issue template

/content/images/2024/11/onedev3-35.png

I can now see it listed, albeit without much for details

/content/images/2024/11/onedev3-36.png

I can now see them there when I create a new issue

/content/images/2024/11/onedev3-37.png

Since it is markdown, we can use the preview to help build some content like a table

/content/images/2024/11/onedev3-38.png

Issue custom fields

We can add custom fields using “Issue Settings/Custom Fields” such as secrets

/content/images/2024/11/onedev3-39.png

I can then give it a name

/content/images/2024/11/onedev3-40.png

I was curious how a password field my work. So I added it to a new issue

/content/images/2024/11/onedev3-41.png

I can change the field, but I cannot seem to view it in any way

/content/images/2024/11/onedev3-42.png

Interestingly enough, I can change the type from Secret to Text

/content/images/2024/11/onedev3-43.png

But it does not affect the existing instantiations when viewing

/content/images/2024/11/onedev3-44.png

But interestingly enough, it does when i edit.

Impersonation

One feature that makes it a bit easier to on-board users (and check permissions) is the “Impersonation” feature.

Under “Administration/User Management/Users” we can see the Impersonate feature

/content/images/2024/11/onedev3-46.png

And I can now see what Tristan sees

/content/images/2024/11/onedev3-47.png

We can exit impersonation to go back to our Admin account using “Exit Impersonation”

/content/images/2024/11/onedev3-48.png

Automated Backups

While I could not seem to get external Databases to work, I can set the internal Database to automatically backup on a schedule in “Administration/System Maintenance/Database Backup”

Perhaps I want to backup at 36 past the hour each day

/content/images/2024/11/onedev3-49.png

I can now see the backup(s) in the db-backup folder

builder@DESKTOP-QADGF36:~$ kubectl exec -it onedev-0 -n onedev -- /bin/bash
root@onedev-0:/# ls -ltrah /opt/onedev/site/db-backup
total 36K
drwxr-xr-x 7 root root 4.0K Nov 24 12:35 ..
drwxr-xr-x 2 root root 4.0K Nov 24 12:36 .
-rw-r--r-- 1 root root  28K Nov 24 12:36 2024-11-24_12-36-01.zip

We could then manually backup to local a file if desired

builder@DESKTOP-QADGF36:~$ kubectl cp -n onedev onedev-0:/opt/onedev/site/db-backup/2024-11-24_12-36-01.zip ./2024-11-24_12-36-01.zip
tar: Removing leading `/' from member names
builder@DESKTOP-QADGF36:~$ ls -ltra | tail -n2
-rw-r--r--   1 builder builder     27814 Nov 24 06:47 2024-11-24_12-36-01.zip
drwxr-xr-x  73 builder builder     12288 Nov 24 06:47 .

We can also see evidence of the backup in the logs

/content/images/2024/11/onedev3-50.png

Subscription

The default behaviour is to run as a Community Edition and we can see that under “Administration/Subscription Management”

/content/images/2024/11/onedev3-51.png

It is here we can switch or get a Trial key for an enterprise account

If I “request that trial”, I can get a 30-day key instantly

/content/images/2024/11/onedev3-52.png

Which I can then install the key

/content/images/2024/11/onedev3-53.png

I now see I have the Enterprise Edition but only valid until Christmas (in my case)

/content/images/2024/11/onedev3-54.png

Time Management

Now that we have EE (at least temporarily), let’s create a project with Time Management enabled

/content/images/2024/11/onedev3-55.png

We can now create an Issue in the project and this time we can add an “estimated time” to complete

/content/images/2024/11/onedev3-56.png

I now may wish to see all outstanding work with the estimated times. We can go to Timesheets to create a new sheet

/content/images/2024/11/onedev3-57.png

My First thought was a report on non-closed work

/content/images/2024/11/onedev3-58.png

But that didn’t really show me anything

/content/images/2024/11/onedev3-59.png

Let’s add it to an iteration (sprint). Since I have none, I’ll need to go to Iterations to create an iteration

/content/images/2024/11/onedev3-60.png

I set a name, start and end dates

/content/images/2024/11/onedev3-61.png

Now I’ll add that issue to the sprint

/content/images/2024/11/onedev3-62.png

I’ll now close the issue. I had hoped to see something to indicate time. WHen our states are just Open and Closed, there isn’t much I can do to show time

/content/images/2024/11/onedev3-63.png

I can see the state transitions in the log

/content/images/2024/11/onedev3-64.png

But even the “All” sheet that should show my all issues shows no time

/content/images/2024/11/onedev3-65.png

We can see, at the least, some stats on Issues opened and closed by week in the Statistics area

/content/images/2024/11/onedev3-66.png

And I can get a burndown chart showing effectively 10m of work completed

/content/images/2024/11/onedev3-67.png

But I’m not really sure what it takes to get the Timesheet part to show results.

Upgrades

There has been a point release since my installed version (11.5.2). I can check anytime by using the “?” icon on the lower left

/content/images/2024/11/onedev3-68.png

Here we see that there is an 11.5.3

/content/images/2024/11/onedev3-69.png

If I now go to Kubernetes and list our charts in the namespace, again, we see it’s at 11.5.2

$ helm list -n onedev
NAME    NAMESPACE       REVISION        UPDATED                                 STATUS          CHART           APP VERSION
onedev  onedev          1               2024-11-16 17:05:44.696522523 -0600 CST deployed        onedev-11.5.2   11.5.2

To upgrade, I’ll ensure I have the Helm repo and it’s updated

builder@DESKTOP-QADGF36:~$ helm repo add onedev https://dl.cloudsmith.io/public/onedev/onedev/helm/charts
elm repo update onedev"onedev" already exists with the same configuration, skipping
builder@DESKTOP-QADGF36:~$ helm repo update onedev
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "onedev" chart repository
Update Complete. ⎈Happy Helming!⎈

IF I had some override values, here is where I could set them asside before a helm upgrade

builder@DESKTOP-QADGF36:~$ helm get values onedev -n onedev -o yaml
null
builder@DESKTOP-QADGF36:~$ helm get values onedev -n onedev
USER-SUPPLIED VALUES:
null

As I don’t, I’ll just upgrade directly

$ helm upgrade onedev -n onedev onedev/onedev --reuse-values
Release "onedev" has been upgraded. Happy Helming!
NAME: onedev
LAST DEPLOYED: Sun Nov 24 07:23:38 2024
NAMESPACE: onedev
STATUS: deployed
REVISION: 2
TEST SUITE: None
NOTES:
CHART NAME: onedev
CHART VERSION: 11.5.3
APP VERSION: 11.5.3
###################################################################
#
# CAUTION: If you are upgrading from version <= 9.0.0, please make
# sure to follow https://docs.onedev.io/upgrade-guide/deploy-to-k8s
# to migrate your data
#
###################################################################

** Please be patient while the chart is being deployed **

Get the OneDev URL by running:

  kubectl port-forward --namespace onedev svc/onedev 6610:80 &

  URL: http://127.0.0.1:6610

I immediately saw the statefulset pod disappear

builder@DESKTOP-QADGF36:~$ kubectl get pods -n onedev
No resources found in onedev namespace.

Then come back as creating

builder@DESKTOP-QADGF36:~$ kubectl get pods -n onedev
NAME       READY   STATUS              RESTARTS   AGE
onedev-0   0/1     ContainerCreating   0          3s
builder@DESKTOP-QADGF36:~$ kubectl get pods -n onedev
NAME       READY   STATUS              RESTARTS   AGE
onedev-0   0/1     ContainerCreating   0          7s

In just a few moments it was live again

builder@DESKTOP-QADGF36:~$ kubectl get pods -n onedev
NAME       READY   STATUS    RESTARTS   AGE
onedev-0   1/1     Running   0          25s

I was able to log back in and immediately see my projects were still there and that the version was now 11.5.3

/content/images/2024/11/onedev3-70.png

Summary

Today, we covered some advanced configuration around Issues such as field configurations (e.g. secrets) and Issue configuration templates. We also showed configuring our Email Templates and tested with password resets. I showed Discord integration with Notifications as well as User Impersonation. We covered a bit of maintenance operations showing cron-based db backups and helm upgrades.

I looked at upgrading the license and tried to get Time Management to work, but did not succeed. I also could not get large files to upload. I really did try a lot of things to try and make that work in the containerized instance but it’s got some rather fixed size limitations I keep bumping up against - such as when trying to push a container image. We also showed contributing whether it be using a project fork or the Pull Request flow with diffs.

Overall, OneDev is a pretty good tool and has a very feature rich Community tier. I might be tempted to build out a OneDev instance for a smaller project or if I was in a situation where a SaaS offering like Github or Azure DevOps wasn’t allowed. There is quite a lot to like - from project management to issue configuration and branch protections.

I could get deeper on Issue template flows and pipelines, but I think for a broad overview and feature tour we have covered enough. I generally do not devote three posts to a product unless I’m all in.

Also, I’m not hung up on the lack of artifact management, to be honest. In a real-world situation I would be using a mix of Harbor and Cloud container registries like GAR and ACR to host charts, binaries and files. I don’t think there is enough here to get me to switch from my current tooling, but it’s far more robust that I thought it might be.

OpenSource Kubernetes Docker DevOps OneDev

Have something to add? Feedback? You can use the feedback form

Isaac Johnson

Isaac Johnson

Cloud Solutions Architect

Isaac is a CSA and DevOps engineer who focuses on cloud migrations and devops processes. He also is a dad to three wonderful daughters (hence the references to Princess King sprinkled throughout the blog).

Theme built by C.S. Rhymes