forgejoconn

package
v1.19.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2026 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package forgejoconn connects a CircleCI organization to a self-hosted Forgejo instance from the terminal, for onboarding.

There is no browser install: the user creates a bot user and two integrations in Forgejo, gives CircleCI their audiences, and once the connection is stored creates the webhook it answers with. Each value comes from a flag, else a prompt, else an error naming the flag, so the flow also runs unattended.

Index

Constants

View Source
const MaxRequestHeaders = 10

MaxRequestHeaders is the most request headers a connection may carry.

View Source
const ProviderName = "forgejo"

ProviderName is Forgejo's name in the provider registry.

Variables

This section is empty.

Functions

func Connect

func Connect(
	ctx context.Context,
	client *apiclient.Client,
	orgID string,
	remote gitremote.RemoteRef,
	opts Options,
) (*apiclient.ForgejoConnection, error)

Connect connects the organization orgID to the Forgejo instance the checkout's remote is on, prints the webhook the user has to create, and, when interactive, waits for them to create it.

A value the API rejects is asked for again when interactive; otherwise the error names the flag that supplies it.

func FindConnection

FindConnection returns the organization's Forgejo connection, if it has one.

func ParseHeaders

func ParseHeaders(raw []string) (map[string]string, error)

ParseHeaders parses -H/--header values, each "Name: Value". Names and values are trimmed, a header needs both, and a name is given once.

func ServesHost

func ServesHost(providerURL, host string) bool

ServesHost reports whether a connection to the instance at providerURL is the one a git remote on host belongs to. Ports are ignored: an ssh remote's port says nothing about the port the instance serves HTTP on.

Types

type Options

type Options struct {
	// URL is the instance URL. Defaults to https://<the remote's host>.
	URL string
	// Owner is the Forgejo organization or user. Defaults to the remote's owner.
	Owner              string
	ConnectionAudience string
	CheckoutAudience   string
	// Headers are "Name: Value" request headers. Optional, and asked about only
	// when interactive and none were passed.
	Headers []string
}

Options are the values passed by flag. Any left empty is prompted for when the session is interactive.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL