project Utilities / Gitlab Recurring Issue avatar

utilities/gitlab_recurring_issue#1: System Design



Issue Information

Issue Type: issue
Status: closed
Reported By: btasker
Assigned To: btasker

Milestone: v0.1
Created: 08-Sep-24 10:27



Description

The basic aim of this project is to create a job which raises a Gitlab issue at some pre-defined interval.

For example, I might want to configure it to

  • Create an issue in project HOME once a month to say "check softener salt"
  • Create an issue in project Vehicles once every 3 months to say "check fluid levels"

etc.

The configuration mechanism needs to be as simple as possible - which probably means YAML (or maybe json?):

- name: "Check Softener Salt"
  project: "home/HOME"
  day: 1
  month: "*"
  description: "Check the softener salt"
  assignee: ben

For the first incarnation, at least, the minimum supported interval should be daily. That should mean that the system can be scheduled by simply creating a cronjob.



Toggle State Changes

Activity


assigned to @btasker

changed the description

When creating a personal access token it looks like it needs to be the api scope that's granted - there isn't one which can be used to simply allow issue creation.

The user associated with the access token needs to be invited into relevant projects with privileges of at least Developer.

Otherwise, it can create issues via the API but cannot add labels or assign the issue.

verified

mentioned in commit 68e83738946acec0c5e3ef3fc1aa60ba1e312efa

Commit: 68e83738946acec0c5e3ef3fc1aa60ba1e312efa 
Author: B Tasker                            
                            
Date: 2024-09-08T13:30:47.000+01:00 

Message

feat: implement basic workflow (#1)

+57 -0 (57 lines changed)

To send email notifications, the Gitlab instance will need smtp settings to be provided in config.

I connect to a Mythic Beasts hosted email server and so needed to use the following settings in gitlab.rb

gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp-auth.mythic-beasts.com"
gitlab_rails['smtp_port'] = 587
gitlab_rails['smtp_user_name'] = "<my username>"
gitlab_rails['smtp_password'] = "<my password>"
gitlab_rails['smtp_domain'] = "<my mail domain>"
gitlab_rails['smtp_authentication'] = "plain"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = false
gitlab_rails['smtp_pool'] = false
gitlab_rails['smtp_openssl_verify_mode'] = 'peer'

# Gitlab is hosted under a different domain to that used by
# the email, so the mail server (correctly) won't let me send
# mail from the email gitlab uses by default
gitlab_rails['gitlab_email_from'] = '<my notifications mail>'
gitlab_rails['gitlab_email_display_name'] = 'Gitlab'
gitlab_rails['gitlab_email_reply_to'] = '<my notifications mail>'

Have set up a public facing repo and container image for this: