cfmint

package
v0.36.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package cfmint implements an install.Driver that deploys a temporary Cloudflare Worker preview mint for behaviour tests. The preview mint is self-contained: all configuration (PEMs, allowlists, provenance) is passed at deploy time. Teardown abandons the preview alias.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeployArgs

func DeployArgs(alias, workerName string, cfg Config) []string

DeployArgs builds the CLI arguments for `fullsend mint deploy --platform=cloudflare`. Exported so unit tests can verify arg construction without shelling out.

--allowed-orgs and --workflow-host-repos are always passed (even when empty) so the CLI sees them as explicitly changed. The CLI uses "flag changed" semantics: omitted flags preserve existing Worker bindings, while explicitly-empty values clear them. For per-repo mode the caller should set AllowedOrgs to "" to avoid dual-enrollment.

func GeneratePreviewAlias

func GeneratePreviewAlias() (string, error)

GeneratePreviewAlias creates a unique preview alias for a BT run. Format: bt-<8-hex-chars> (e.g., bt-a1b2c3d4). The alias satisfies the CF preview alias validation: 2-63 lowercase alphanumeric or hyphens.

func NewDriver

func NewDriver(
	client forge.Client,
	token, binary, gcpProjectID string,
	logf func(string, ...any),
	cfg Config,
) (install.Driver, error)

NewDriver creates a CF mint install driver. Returns an error if the configuration is invalid (missing PEMs, empty suite name).

func ParseMintURLFromOutput

func ParseMintURLFromOutput(output string) string

ParseMintURLFromOutput extracts the mint URL printed by `fullsend mint deploy`. The CLI prints a line like:

✓ Worker deployed at https://<alias>-<worker>.<subdomain>.workers.dev

This is the canonical way to obtain the preview URL from a deploy invocation; callers should not re-derive it because the correct workers.dev subdomain is only known at deploy time.

func TeardownArgs

func TeardownArgs(previewAlias, workerName string) []string

TeardownArgs builds the CLI arguments for `fullsend mint delete --platform=cloudflare`. Exported so unit tests can verify arg construction without shelling out.

func WorkerName

func WorkerName(suiteName string) string

WorkerName derives the CF Worker script name from a suite name. The name clearly indicates it is the e2e/BT worker for that suite.

Types

type Config

type Config struct {
	// PEMDir is the directory containing {role}.pem files materialized
	// from TEST_*_PEM env vars. Required; the driver fails early if
	// empty or if the directory contains no .pem files.
	PEMDir string

	// SuiteName is used to derive the worker name. For example,
	// suite "bt" produces worker "bt-mint". Different suites get
	// different workers to avoid collisions.
	SuiteName string

	// AllowedOrgs is a comma-separated list of allowed GitHub orgs.
	// Passed to --allowed-orgs on deploy.
	AllowedOrgs string

	// PerRepoWIFRepos is a comma-separated list of repos for per-repo
	// WIF. Passed to --per-repo-wif-repos on deploy.
	PerRepoWIFRepos string

	// WorkflowHostRepos is a comma-separated list of repos whose
	// vendored workflows are allowed to mint tokens. Passed to
	// --workflow-host-repos on deploy. The caller builds the list
	// from pool naming conventions; the driver does not hardcode
	// org/repo assumptions.
	WorkflowHostRepos string

	// AppSet is the app set name for PEM bootstrap. Passed to --app-set
	// on deploy so the CLI verifies PEMs against the correct GitHub Apps.
	// For example, test PEMs use "fullsend-test" while production uses
	// "fullsend-ai". When empty, the CLI uses its own default.
	AppSet string
}

Config holds parameters for the CF mint driver. The caller provides these from test-infra data; the driver does not hardcode org/repo/pool assumptions.

Jump to

Keyboard shortcuts

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