pkg

package
v0.0.0-...-a03bd7c Latest Latest
Warning

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

Go to latest
Published: May 28, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GeneratePackage

func GeneratePackage(opts GenerateOpts) error

func HasTemplate

func HasTemplate(name TemplateDir) bool

Types

type Config

type Config struct {
	// Provider is required and is the name of the provider without the "pulumi-" prefix.
	Provider string `yaml:"provider"`

	// Repository is the optional repository of the provider.
	Repository string `yaml:"repository"`

	// Template names can be found in the getTemplateDirs function in provider-ci/internal/pkg/generate.go.
	Template string `yaml:"template"`

	// Organization is the name of the Github organization the repository lives
	// in. Defaults to 'pulumi'.
	Organization string `yaml:"organization"`

	// MajorVersion of the current provider used in Makefiles. This should
	// always be set by all providers as this is key to go module paths.
	MajorVersion int `yaml:"major-version"`

	// Plugins to install in the "install_plugins" make target. Should be set
	// for all bridged providers:
	// https://github.com/search?q=org%3Apulumi+path%3A.ci-mgmt.yaml+%22plugins%3A%22&type=code
	Plugins []plugin `yaml:"plugins"`

	// UpstreamProviderOrg is optional and used in the bridge upgrade config.
	// Only set for 4 providers:
	// https://github.com/search?q=org%3Apulumi+path%3A.ci-mgmt.yaml+%22upstreamProviderOrg%3A%22&type=code
	UpstreamProviderOrg string `yaml:"upstreamProviderOrg"`

	// UpstreamProviderRepo is used in the bridge upgrade config. Only set for
	// 5 providers:
	// https://github.com/search?q=org%3Apulumi+path%3A.ci-mgmt.yaml+%22upstream-provider-repo%22&type=code
	UpstreamProviderRepo string `yaml:"upstream-provider-repo"`

	// Lint includes an extra lint job in workflows if enabled (default). Can
	// be explicitly set to false. This is false in around 8 provider repos:
	// https://github.com/search?q=org%3Apulumi+path%3A.ci-mgmt.yaml+%22lint%3A+false%22&type=code
	Lint bool `yaml:"lint,omitempty"`

	// ProviderDefaultBranch is used to customise the default branch when
	// needed. Currently set in around 17 repos:
	// https://github.com/search?q=org%3Apulumi+path%3A.ci-mgmt.yaml+%22providerDefaultBranch%3A%22&type=code
	ProviderDefaultBranch string `yaml:"providerDefaultBranch"`

	// PublishRegistry decides if create_docs_build happens during release This
	// can be overridden to false to not publish updates. This is disabled in 5
	// repos:
	// https://github.com/search?q=org%3Apulumi+path%3A.ci-mgmt.yaml+%22publishRegistry%3A%22&type=code
	PublishRegistry bool `yaml:"publishRegistry"`

	// CheckoutSubmodules is used for all checkouts during CI. Defaults to
	// false. Only 3 providers use submodules:
	// https://github.com/search?q=org%3Apulumi+path%3A.ci-mgmt.yaml+%22checkoutSubmodules%3A%22&type=code
	CheckoutSubmodules bool `yaml:"checkoutSubmodules"`

	// TestMasterAndReleaseWorkflows runs the master and release workflows on
	// every pull request. This option is currently never set to true:
	// https://github.com/search?q=org%3Apulumi+path%3A.ci-mgmt.yaml+%22testMasterAndReleaseWorkflows%3A%22&type=code
	TestMasterAndReleaseWorkflows bool `yaml:"testMasterAndReleaseWorkflows"`

	// FreeDiskSpaceBeforeBuild when true will clear disk space before running
	// prerequisites workflow. This is used for larger providers which
	// sometimes run out of disk space during builds.
	FreeDiskSpaceBeforeBuild bool `yaml:"freeDiskSpaceBeforeBuild"`

	// FreeDiskSpaceBeforeSdkBuild when true will clear disk space before
	// running test jobs.
	FreeDiskSpaceBeforeSdkBuild bool `yaml:"freeDiskSpaceBeforeSdkBuild"`

	// FreeDiskSpaceBeforeTest when true will clear disk space before running
	// sdk build jobs.
	FreeDiskSpaceBeforeTest bool `yaml:"freeDiskSpaceBeforeTest"`

	// Used for centrally managing tool versions. This is not currently
	// overridden by any providers, but ideally the provider's repository
	// should pin its own tooling:
	// https://github.com/search?q=org%3Apulumi+path%3A.ci-mgmt.yaml+%22toolVersions%22&type=code
	ToolVersions toolVersions `yaml:"toolVersions"`

	// Languages controls which language SDKs get built and published.
	Languages []string `yaml:"languages"`

	// Env contains an assortment of properties for different purposes.
	// Additional entries are added by individual providers for different
	// reasons. All jobs currently get the same env for all steps but values
	// might only be used for very specific purposes.
	Env map[string]string `yaml:"env"`

	// Overrides the default env rather than appending to it.
	EnvOverride map[string]string `yaml:"envOverride"`

	// Actions can contain preBuild and preTest additional steps to be spliced
	// into workflows. The use of these hooks vary - quite a few just build
	// upstream and run provider tests. Usage:
	// https://github.com/search?q=org%3Apulumi+path%3A.ci-mgmt.yaml+%22actions%3A%22&type=code
	Actions actions `yaml:"actions"`

	// IntegrationTestProvider will run e2e tests in the provider as well as in
	// the examples directory when set to true. Defaults to false.
	IntegrationTestProvider bool `yaml:"integrationTestProvider"`

	// TestPulumiExamples runs e2e tests using the examples and test suite in
	// the pulumi/examples repo when set to true. Defaults to false. This is
	// unused but potentially useful for azure-native onboarding:
	// https://github.com/search?q=org%3Apulumi+path%3A.ci-mgmt.yaml+%22testPulumiExamples%3A%22&type=code
	TestPulumiExamples bool `yaml:"testPulumiExamples"`

	// Runner defines the runs-on property for various stages of the build
	// These are not overridden by any providers:
	// https://github.com/search?q=org%3Apulumi+path%3A.ci-mgmt.yaml+%22runner%3A%22&type=code
	Runner struct {
		Default       string `yaml:"default"`
		Prerequisites string `yaml:"prerequisites"`
		BuildSDK      string `yaml:"buildSdk"`
		Publish       string `yaml:"publish"`
	} `yaml:"runner"`

	// actionVersions should be used wherever we use external actions to make
	// upgrading easier. These are never overridden by providers:
	// https://github.com/search?q=org%3Apulumi+path%3A.ci-mgmt.yaml+%22actionVersions%3A%22&type=code
	ActionVersions actionVersions `yaml:"actionVersions"`

	// Publish contains multiple properties relating to the publish jobs. Used
	// by 2 providers:
	// https://github.com/search?q=org%3Apulumi+path%3A.ci-mgmt.yaml+%22publish%3A%22&type=code
	Publish publish `yaml:"publish"`

	// RegistryDocs enables automatic registry index doc file generation.
	// Intended for use with Tier 2/3 providers.
	RegistryDocs bool `yaml:"registryDocs"`

	// CheckUpstreamUpgrade determines whether we run the upstream upgrade job
	// for bridged providers. Set to false for providers that cannot be
	// upgraded, e.g. because of archived upstream or a license conflict.
	CheckUpstreamUpgrade bool `yaml:"checkUpstreamUpgrade"`

	// ReleaseVerification optionally enables running example tests during releases.
	ReleaseVerification *releaseVerification `yaml:"releaseVerification,omitempty"`

	// ExtraLDFlags lists extra flags used by build targets. Only used by
	// newrelic:
	// https://github.com/search?q=org%3Apulumi+path%3A.ci-mgmt.yaml+%22extra-ld-flags%22&type=code
	ExtraLDFlags []string `yaml:"extra-ld-flags"`

	// GoBuildParallelism sets PULUMI_PROVIDER_BUILD_PARALLELISM in the
	// Makefile. Used in 5 providers and ideally should be configured by the provider:
	// https://github.com/search?q=org%3Apulumi+path%3A.ci-mgmt.yaml+%22goBuildParallelism%22&type=code
	GoBuildParallelism int `yaml:"goBuildParallelism"`

	// PulumiConvert sets PULUMI_CONVERT to 1 if truthy. PulumiConvert is set
	// to "1" in 74 providers:
	// https://github.com/search?q=org%3Apulumi+path%3A.ci-mgmt.yaml+%22pulumiConvert%22&type=code
	PulumiConvert intOrBool `yaml:"pulumiConvert"`

	// DocsCmd adds a "docs" target in the makefile. Used only in
	// pulumi-docker:
	// https://github.com/search?q=org%3Apulumi+path%3A.ci-mgmt.yaml+%22docsCmd%3A%22&type=code
	DocsCmd string `yaml:"docsCmd"`

	// XrunUpstreamTools adds extra steps for AWS's upstream make target.
	// https://github.com/pulumi/pulumi-aws/issues/2757
	XrunUpstreamTools bool `yaml:"XrunUpstreamTools"`

	// AWS configures AWS credentials before running tests in CI job. Used in 4
	// providers:
	// https://github.com/search?q=org%3Apulumi+path%3A.ci-mgmt.yaml+%22aws%3A%22&type=code
	AWS bool `yaml:"aws"`

	// Docker runs testing/docker-compose.yml up before running tests in CI
	// job. Used in 9 providers:
	// https://github.com/search?q=org%3Apulumi+path%3A.ci-mgmt.yaml+%22docker%3A%22&type=code
	Docker bool `yaml:"docker"`

	// GCP authenticates with GCP before running tests in CI job. Used in gcp
	// and docker:
	// https://github.com/search?q=org%3Apulumi+path%3A.ci-mgmt.yaml+%22gcp%3A%22&type=code
	GCP bool `yaml:"gcp"`

	// GCPRegistry enables logging into the GCP registry before running tests
	// in CI job. Only used for docker:
	// https://github.com/search?q=org%3Apulumi+path%3A.ci-mgmt.yaml+%22gcpRegistry%3A%22&type=code
	GCPRegistry bool `yaml:"gcpRegistry"`

	// SetupScript executes a script before running tests in CI job. Used in 3
	// providers:
	// https://github.com/search?q=org%3Apulumi+path%3A.ci-mgmt.yaml+%22setup-script%3A%22&type=code
	SetupScript string `yaml:"setup-script"`

	// GenerateNightlyTestWorkflow will include the nightly-test workflow. Used
	// in 11  providers:
	// https://github.com/search?q=org%3Apulumi+path%3A.ci-mgmt.yaml+%22generate-nightly-test-workflow%3A%22&type=code
	GenerateNightlyTestWorkflow bool `yaml:"generate-nightly-test-workflow"`

	// License lists package paths to ignore when running the license check
	License struct {
		Ignore []string `yaml:"ignore"`
	} `yaml:"license"`

	// CleanGithubWorkflows deletes existing files within the .github/workflows
	// directory, except where the file begins with the name of the provider
	// (e.g. `aws-*`) which are considered provider-specific workflows.
	// Defaults to true but this will likely change to false in the future once
	// we've made the process of cleaning up removed and renamed workflows more
	// reliable.
	CleanGithubWorkflows bool `yaml:"clean-github-workflows"`

	// ProviderVersion controls the path of the version LD flag. Only set for 3
	// providers:
	// https://github.com/search?q=org%3Apulumi+path%3A.ci-mgmt.yaml+%22providerVersion%3A%22&type=code
	ProviderVersion string `yaml:"providerVersion"`

	// EnableConfigurationCheck prints a warning on PRs if configuration
	// options aren't documented in the README. Only used by civo.
	// https://github.com/search?q=org%3Apulumi+path%3A.ci-mgmt.yaml+%22enableConfigurationCheck%3A%22&type=code
	EnableConfigurationCheck bool `yaml:"enableConfigurationCheck"`

	// SetupKind controls whether to setup a KinD cluster. (only used in kubernetes-coredns)
	SetupKind bool `yaml:"setupKind"`

	// PulumiVersionFile specifies the file to read the Pulumi version from.
	PulumiVersionFile string `yaml:"pulumiVersionFile"`

	// SDKModuleDir specifies the directory to find the SDK go.mod
	SDKModuleDir string `yaml:"sdkModuleDir"`

	// EnableChangelog controls whether the changelog is generated. (only used by aws-native)
	EnableChangelog string `yaml:"enableChangelog"`

	// Parallel has no effect but is set by some providers.
	// https://github.com/search?q=org%3Apulumi+path%3A.ci-mgmt.yaml+%22parallel%3A%22&type=code
	Parallel int `yaml:"parallel"`

	// Shards controls how many jobs integration tests are distributed across.
	Shards int `yaml:"shards"`

	// Hybrid has no effect but is set by the docker provider.
	// https://github.com/search?q=org%3Apulumi+path%3A.ci-mgmt.yaml+%22hybrid%3A%22&type=code
	Hybrid bool `yaml:"hybrid"`

	// Team has no effect but is set by some providers.
	// https://github.com/search?q=org%3Apulumi+path%3A.ci-mgmt.yaml+%22team%3A%22&type=code
	Team string `yaml:"team"`

	// Timeout has no effect but is set by some providers. It can be specified
	// as an int (minutes) or a string duration.
	// https://github.com/search?q=org%3Apulumi+path%3A.ci-mgmt.yaml+%22timeout%3A%22&type=code
	Timeout intOrDuration `yaml:"timeout"`

	// MakeTemplate has no effect but is set by 78 providers.
	// https://github.com/search?q=org%3Apulumi+path%3A.ci-mgmt.yaml+%22makeTemplate%3A%22&type=code
	MakeTemplate string `yaml:"makeTemplate"`

	// Customizes the name of the "gen" program.
	// Defaults to "tfgen" for bridged providers and "gen" for generic providers.
	GenName string `yaml:"genName"`

	// Customizes the Make function build_provider_cmd.
	//
	// This function is responsible for creating a provider binary for the desired platform.
	//
	// "$(1)" refers to the desired OS, in the same format as GOOS in the Go toolchain
	// "$(2)" refers to the desired architecture, in the same format as GOARCH in the Go toolchain
	// "$(3)" refers to the desired destination path for the binary
	//
	// An example value for the command is:
	//
	//     cd provider && GOOS=$(1) GOARCH=$(2) go build -o "$(3)" ...
	//
	// Customizing this value allows providers implemented in Node or other languages.
	BuildProviderCmd string `yaml:"buildProviderCmd"`

	// Customizes a hook to run right before BuildProviderCmd.
	BuildProviderPre string `yaml:"buildProviderPre"`

	// Customizes the Make function test_provider_cmd.
	//
	// This function is called without arguments to run unit tests for the provider binary.
	TestProviderCmd string `yaml:"testProviderCmd"`

	// Customizes the Make function renovate_cmd.
	//
	// This function is called by the make renovate target after the Renovate bot has finished updating
	// project dependencies in a PR. It is responsible for rebuilding any generated files as needed.
	RenovateCmd string `yaml:"renovateCmd"`

	// InstallKubectl determines if we need to install the kubectl CLI. This will use the latest stable version.
	// Used in pulumi-eks currently.
	InstallKubectl string `yaml:"install-kubectl"`

	// TestFolder defines where the test directory for integration tests is located.
	// Defaults to "examples" if not set.
	TestFolder string `yaml:"test-folder"`

	// AutoMergeProviderUpgrades controls whether we automatically merge upstream provider upgrades.
	AutoMergeProviderUpgrades bool `yaml:"autoMergeProviderUpgrades"`

	// AllowMissingDocs controls whether we allow missing docs in the provider.
	// Defaults to false.
	AllowMissingDocs bool `yaml:"allowMissingDocs"`

	// NoSchema is useful for providers such as parameterized providers that do not check in
	// a fixed schema into the repository.
	NoSchema bool `yaml:"noSchema"`

	// ModulePath tells the scripts where to find the go.mod entry point for the provider code.
	// Historically this is defaulting to "provider" but for newer providers may be ".".
	ModulePath string `yaml:"modulePath"`

	// ESC allows the provider to extend our ESC integration, e.g. by using a
	// custom environment or exporting specific variables.
	ESC escConfig `yaml:"esc"`

	// ActuallyCommentOnStaleIssues controls whether we comment on stale issues
	ActuallyCommentOnStaleIssues bool `yaml:"actuallyCommentOnStaleIssues"`

	// GitHubApp contains our GitHub app auth parameters. Enabled by default.
	GitHubApp GitHubApp `yaml:"github-app"`

	// MiseVersion specifies the version of mise to use on GitHub Actions.
	MiseVersion string `yaml:"mise-version"`
}

Config describes the shape of .ci-mgmt.yaml files.

func LoadLocalConfig

func LoadLocalConfig(path string) (Config, error)

LoadLocalConfig loads the provider configuration at the given path with defaults applied.

type GenerateOpts

type GenerateOpts struct {
	RepositoryName string // e.g.: pulumi/pulumi-aws
	OutDir         string
	TemplateName   string // path inside templates, e.g.: bridged-provider
	Config         Config // .yaml file containing template config
	SkipMigrations bool
}

type GitHubApp

type GitHubApp struct {
	Enabled    bool
	ID         string
	PrivateKey string `yaml:"private-key"`
}

type TemplateDir

type TemplateDir string

TemplateDir is a directory in the embedded filesystem that contains files to be rendered into the output directory. Multiple templates are combined together to form the overall template (see `getTemplateDirs`).

func ListTemplates

func ListTemplates() ([]TemplateDir, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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