Documentation
¶
Index ¶
- Constants
- Variables
- func LoadJobSpecs(jobSpecsFilePath string) (map[string][]string, error)deprecated
- func LoadJobs(jobsFilePath string) ([]fdeployment.ProposedJob, error)
- func SaveViewState(filePath string, v json.Marshaler) error
- type ArtifactsDir
- func (a *ArtifactsDir) ArchiveProposalsDirExists() (bool, error)
- func (a *ArtifactsDir) ArchivedProposalsDirPath() string
- func (a *ArtifactsDir) ArtifactsDirPath() string
- func (a *ArtifactsDir) CreateArchivedProposalsDir() error
- func (a *ArtifactsDir) CreateDecodedProposalsDir() error
- func (a *ArtifactsDir) CreateMigrationDir(migKey string) error
- func (a *ArtifactsDir) CreateOperationsReportsDir() error
- func (a *ArtifactsDir) CreateProposalsDir() error
- func (a *ArtifactsDir) DecodedProposalsDirPath() string
- func (a *ArtifactsDir) DomainKey() string
- func (a *ArtifactsDir) EnvKey() string
- func (a *ArtifactsDir) LoadAddressBookByMigrationKey(migKey string) (*fdeployment.AddressBookMap, error)
- func (a *ArtifactsDir) LoadChangesetOutput(migKey string) (fdeployment.ChangesetOutput, error)
- func (a *ArtifactsDir) LoadDataStoreByMigrationKey(migKey string) (fdatastore.DataStore, error)
- func (a *ArtifactsDir) LoadOperationsReports(migKey string) ([]foperations.Report[any, any], error)
- func (a *ArtifactsDir) MigrationDirExists(migKey string) (bool, error)
- func (a *ArtifactsDir) MigrationDirPath(migKey string) string
- func (a *ArtifactsDir) MigrationOperationsReportsFileExists(migKey string) (bool, error)
- func (a *ArtifactsDir) OperationsReportsDirExists() (bool, error)
- func (a *ArtifactsDir) OperationsReportsDirPath() string
- func (a *ArtifactsDir) ProposalsDirExists() (bool, error)
- func (a *ArtifactsDir) ProposalsDirPath() string
- func (a *ArtifactsDir) RemoveMigrationDir(migKey string) error
- func (a *ArtifactsDir) SaveChangesetOutput(migKey string, output fdeployment.ChangesetOutput) error
- func (a *ArtifactsDir) SaveOperationsReports(migKey string, reports []foperations.Report[any, any]) error
- func (a *ArtifactsDir) SetDurablePipelines(timestamp string) error
- type Domain
- func (d Domain) AddressBookByEnv(env string) (fdeployment.AddressBook, error)
- func (d Domain) ArtifactsDirByEnv(env string) *ArtifactsDir
- func (d Domain) CmdDirPath() string
- func (d Domain) ConfigCICommonFilePath() string
- func (d Domain) ConfigCIDirPath() string
- func (d Domain) ConfigCIEnvFilePath(env string) string
- func (d Domain) ConfigDirPath() string
- func (d Domain) ConfigDomainFilePath() string
- func (d Domain) ConfigLocalDirPath() string
- func (d Domain) ConfigLocalFilePath(env string) string
- func (d Domain) ConfigNetworksDirPath() string
- func (d Domain) ConfigNetworksFilePath(filename string) string
- func (d Domain) DataStoreByEnv(env string) (fdatastore.DataStore, error)
- func (d Domain) DirPath() string
- func (d Domain) EnvDir(env string) EnvDir
- func (d Domain) InternalDirPath() string
- func (d Domain) Key() string
- func (d Domain) LibDirPath() string
- func (d Domain) RootPath() string
- func (d Domain) String() string
- type EnvDir
- func (d EnvDir) AddressBook() (fdeployment.AddressBook, error)
- func (d EnvDir) AddressBookFilePath() string
- func (d EnvDir) AddressRefsFilePath() string
- func (d EnvDir) ArtifactsDir() *ArtifactsDir
- func (d EnvDir) ChainMetadataFilePath() string
- func (d EnvDir) ContractMetadataFilePath() string
- func (d EnvDir) CreateDurablePipelinesDir() error
- func (d EnvDir) DataStore() (fdatastore.DataStore, error)
- func (d EnvDir) DataStoreDirPath() string
- func (d EnvDir) DirPath() string
- func (d EnvDir) DomainDirPath() string
- func (d EnvDir) DomainKey() string
- func (d EnvDir) DurablePipelinesDirPath() string
- func (d EnvDir) DurablePipelinesInputsDirPath() string
- func (d EnvDir) EnvMetadataFilePath() string
- func (d EnvDir) InputsDirPath() string
- func (d EnvDir) Key() string
- func (d EnvDir) LoadNodes() (*nodes.Nodes, error)
- func (d EnvDir) LoadState() (JSONSerializer, error)
- func (d EnvDir) MergeMigrationAddressBook(migKey, timestamp string) error
- func (d EnvDir) MergeMigrationDataStore(migkey, timestamp string) error
- func (d EnvDir) MigrateAddressBook() error
- func (d EnvDir) MigrationsArchiveFilePath() string
- func (d EnvDir) MigrationsFilePath() string
- func (d EnvDir) MutableDataStore() (fdatastore.MutableDataStore, error)
- func (d EnvDir) NodesFilePath() string
- func (d EnvDir) PipelinesFilePath() string
- func (d EnvDir) RemoveMigrationAddressBook(migKey, timestamp string) error
- func (d EnvDir) RootPath() string
- func (d EnvDir) SaveNodes(nodeIDs []string) error
- func (d EnvDir) SaveViewState(v json.Marshaler) error
- func (d EnvDir) String() string
- func (d EnvDir) ViewStateFilePath() string
- type JSONSerializer
Constants ¶
const ( // Defines the file extensions for the artifacts TOMLExt = "toml" JSONExt = "json" MDExt = "md" TxtExt = "txt" // Defines the artifact types. These are also used as suffixes for the artifact file names. ArtifactAddress = "addresses" ArtifactDataStore = "datastore" ArtifactJobSpec = "jobspecs" ArtifactJobs = "jobs" ArtifactsDurablePipelineDirName = "durable_pipelines" ArtifactMCMSProposal = "mcms_proposal" ArtifactMCMSProposalDecoded = "mcms_proposal_decoded" ArtifactsMCMSTimelockProposal = "mcms_timelock_proposal" ArtifactsMCMSTimelockProposalDecoded = "mcms_timelock_proposal_decoded" )
const ( // LibDirName is the name of the directory containing the domain's lib directory. LibDirName = "lib" // InternalDirName is the name of the directory containing the domain's internal directory. InternalDirName = "internal" // CmdDirName is the name of the directory containing the domain's cmd directory. CmdDirName = "cmd" // AddressBookFileName is the name of the file containing the address book. AddressBookFileName = "addresses.json" // ArchivedProposalsDirName is the name of the directory containing archived proposals. ArchivedProposalsDirName = "archived_proposals" // ArtifactsDirName is the name of the directory containing migration artifacts. ArtifactsDirName = "artifacts" // DarastoreDirName is the name of the directory containing the datastore files. DatastoreDirName = "datastore" // DataStoreFileName is the name of the file containing the fdatastore. DataStoreFileName = "datastore.json" // AddressRefsFileName is the name of the file containing the address refs. AddressRefsFileName = "address_refs.json" // ChainMetadataFileName is the name of the file containing the chain metadata. ChainMetadataFileName = "chain_metadata.json" // ContractMetadataFileName is the name of the file containing the contract metadata. ContractMetadataFileName = "contract_metadata.json" // DomainConfigDirName is the name of the directory containing the domain's config directory. DomainConfigDirName = ".config" // DomainConfigLocalDirName is the name of the directory containing the local domain config. DomainConfigLocalDirName = "local" // DomainConfigLocalFileName is the name of the file containing the local domain config. DomainConfigLocalFileName = "config.yml" // DomainConfigNetworksDirName is the name of the directory containing the domain networks config. DomainConfigNetworksDirName = "networks" // DomainConfigCIDirName is the name of the directory containing the domain CI config. DomainConfigCIDirName = "ci" // EnvMetadataFileName is the name of the file containing the environment metadata. EnvMetadataFileName = "env_metadata.json" // NodesFileName is the name of the file containing node information in the // environment directory. NodesFileName = "nodes.json" // ProposalsDirName is the name of the directory containing proposals. ProposalsDirName = "proposals" // DecodedProposalsDirName is the name of the directory containing decoded proposals. DecodedProposalsDirName = "decoded_proposals" // PipelinesFileName is the name of the file containing the pipelines initialization for // the environment. PipelinesFileName = "pipelines.go" // OperationsReportsDirName is the name of the directory containing operations reports.[ OperationsReportsDirName = "operations_reports" // ViewStateFileName is the name of the file containing the view state of the // environment. ViewStateFileName = "state.json" // MigrationsFileName is the name of the file containing the migrations for the // environment. MigrationsFileName = "migrations.go" // MigrationsArchiveFileName is the name of the file containing the archived // migrations for the environment. MigrationsArchiveFileName = "migrations_archive.go" // DurablePipelineDirName is the name of the directory containing durable pipelines. DurablePipelineDirName = "durable_pipelines" // DurablePipelineInputsDirName is the name of the directory containing the inputs // for the durable pipelines. DurablePipelineInputsDirName = "inputs" )
Variables ¶
var ( ProjectRoot = getProjectRoot() DomainsRoot = filepath.Join(ProjectRoot, "domains") )
Defines root paths for the project and domains.
var ( // ErrArtifactNotFound is returned when an artifact is not in the filesystem. ErrArtifactNotFound = errors.New("artifact not found") )
Functions ¶
func LoadJobSpecs
deprecated
Deprecated: The map used to represent the job specs that was provided by `chainlink/deployments` is no longer used, and has been replaced by a slice of `fdeployment.ProposedJob` structs. This has been kept around for backwards compatibility with existing migrations, but should not be used in new code. Prefer using `LoadJobs` instead.
func LoadJobs ¶
func LoadJobs(jobsFilePath string) ([]fdeployment.ProposedJob, error)
LoadJobs unmarshals a slice of `fdeployment.ProposedJob` structs from a file.
Types ¶
type ArtifactsDir ¶
type ArtifactsDir struct {
// contains filtered or unexported fields
}
ArtifactsDir represents a directory containing all migration artifacts grouped by the migration key. It provides methods to interact with the artifacts in the directory.
func NewArtifactsDir ¶
func NewArtifactsDir(rootPath, domainKey, envKey string) *ArtifactsDir
NewArtifactsDir creates a new Artifacts.
func (*ArtifactsDir) ArchiveProposalsDirExists ¶
func (a *ArtifactsDir) ArchiveProposalsDirExists() (bool, error)
ArchiveProposalsDirExists checks if the proposals directory exists
func (*ArtifactsDir) ArchivedProposalsDirPath ¶
func (a *ArtifactsDir) ArchivedProposalsDirPath() string
ArchivedProposalsDirPath returns the path to the directory containing archived proposals.
func (*ArtifactsDir) ArtifactsDirPath ¶
func (a *ArtifactsDir) ArtifactsDirPath() string
ArtifactsDirPath returns the path to the directory containing the artifacts but not proposals.
func (*ArtifactsDir) CreateArchivedProposalsDir ¶
func (a *ArtifactsDir) CreateArchivedProposalsDir() error
CreateArchivedProposalsDir creates the proposals directory within the artifacts directory if it does not exist. It also creates a .gitkeep file within the proposals directory to ensure the directory is tracked by git.
func (*ArtifactsDir) CreateDecodedProposalsDir ¶
func (a *ArtifactsDir) CreateDecodedProposalsDir() error
CreateDecodedProposalsDir creates the decoded_proposals directory within the artifacts directory if it does not exist. It also creates a .gitkeep file within the proposals directory to ensure the directory is tracked by git.
func (*ArtifactsDir) CreateMigrationDir ¶
func (a *ArtifactsDir) CreateMigrationDir(migKey string) error
CreateMigrationDir creates a new directory within the artifacts directory with the specified migration key. If the directory already exists, it will return nil.
func (*ArtifactsDir) CreateOperationsReportsDir ¶
func (a *ArtifactsDir) CreateOperationsReportsDir() error
CreateOperationsReportsDir creates the operations reports directory if it does not exist. It also creates a .gitkeep file within the operations reports directory to ensure the directory is tracked by git.
func (*ArtifactsDir) CreateProposalsDir ¶
func (a *ArtifactsDir) CreateProposalsDir() error
CreateProposalsDir creates the proposals directory within the artifacts directory if it does not exist. It also creates a .gitkeep file within the proposals directory to ensure the directory is tracked by git.
func (*ArtifactsDir) DecodedProposalsDirPath ¶
func (a *ArtifactsDir) DecodedProposalsDirPath() string
DecodedProposalsDirPath returns the path to the directory containing the decoded proposals.
func (*ArtifactsDir) DomainKey ¶
func (a *ArtifactsDir) DomainKey() string
DomainKey returns the domain key that the artifacts belong to.
func (*ArtifactsDir) EnvKey ¶
func (a *ArtifactsDir) EnvKey() string
EnvKey returns the environment key that the artifacts belong to.
func (*ArtifactsDir) LoadAddressBookByMigrationKey ¶
func (a *ArtifactsDir) LoadAddressBookByMigrationKey(migKey string) (*fdeployment.AddressBookMap, error)
LoadAddressBookByMigrationKey searches for an address book file in the migration directory and returns the address book as an AddressBookMap.
The search will look for a address book file with a matching name as the domain, env and migration key, returning the first matching file. An error is returned if no matches are found or if an error occurs during the search.
Pattern format: "*-<domain>-<env>-<migKey>_addresses.json".
func (*ArtifactsDir) LoadChangesetOutput ¶
func (a *ArtifactsDir) LoadChangesetOutput(migKey string) (fdeployment.ChangesetOutput, error)
LoadChangesetOutput reads the artifacts from the specified migration directory and returns the ChangesetOutput.
func (*ArtifactsDir) LoadDataStoreByMigrationKey ¶
func (a *ArtifactsDir) LoadDataStoreByMigrationKey(migKey string) (fdatastore.DataStore, error)
LoadDataStoreByMigrationKey searches for a datastore file in the migration directory and returns the datastore as read-only.
The search will look for a datastore file with a matching name as the domain, env and migration key, returning the first matching file. An error is returned if no matches are found or if an error occurs during the search.
Pattern format: "*-<domain>-<env>-<migKey>_datastore.json".
func (*ArtifactsDir) LoadOperationsReports ¶
func (a *ArtifactsDir) LoadOperationsReports(migKey string) ([]foperations.Report[any, any], error)
LoadOperationsReports reads the reports from the operations reports directory for the specified migration key.
func (*ArtifactsDir) MigrationDirExists ¶
func (a *ArtifactsDir) MigrationDirExists(migKey string) (bool, error)
MigrationDirExists checks if the migration directory containing the artifacts for the specified migration key exists.
func (*ArtifactsDir) MigrationDirPath ¶
func (a *ArtifactsDir) MigrationDirPath(migKey string) string
MigrationDirPath returns the path to the directory containing the artifacts for the specified migration key.
func (*ArtifactsDir) MigrationOperationsReportsFileExists ¶
func (a *ArtifactsDir) MigrationOperationsReportsFileExists(migKey string) (bool, error)
MigrationOperationsReportsFileExists checks if the operations reports file exists for the specified migration key.
func (*ArtifactsDir) OperationsReportsDirExists ¶
func (a *ArtifactsDir) OperationsReportsDirExists() (bool, error)
OperationsReportsDirExists checks if the operations_reports directory exists.
func (*ArtifactsDir) OperationsReportsDirPath ¶
func (a *ArtifactsDir) OperationsReportsDirPath() string
OperationsReportsDirPath returns the path to the directory containing the operations reports.
func (*ArtifactsDir) ProposalsDirExists ¶
func (a *ArtifactsDir) ProposalsDirExists() (bool, error)
ProposalsDirExists checks if the proposals directory exists
func (*ArtifactsDir) ProposalsDirPath ¶
func (a *ArtifactsDir) ProposalsDirPath() string
ProposalsDirPath returns the path to the directory containing the proposals.
func (*ArtifactsDir) RemoveMigrationDir ¶
func (a *ArtifactsDir) RemoveMigrationDir(migKey string) error
RemoveMigrationDir removes the directory containing the artifacts for the specified migration key.
func (*ArtifactsDir) SaveChangesetOutput ¶
func (a *ArtifactsDir) SaveChangesetOutput(migKey string, output fdeployment.ChangesetOutput) error
SaveChangesetOutput writes the ChangesetOutput as artifacts to the specified migration directory.
func (*ArtifactsDir) SaveOperationsReports ¶
func (a *ArtifactsDir) SaveOperationsReports(migKey string, reports []foperations.Report[any, any]) error
SaveOperationsReports writes an operations report as JSON to the operations reports directory for the specified migration key. if the directory does not exist, it will be created. if the file already exists, it will be overwritten.
func (*ArtifactsDir) SetDurablePipelines ¶
func (a *ArtifactsDir) SetDurablePipelines(timestamp string) error
SetDurablePipelines sets the directory containing the durable pipeline artifacts and the timestamp for the durable pipelines.
type Domain ¶
type Domain struct {
// contains filtered or unexported fields
}
Domain represents a specific domain that is operated by a team. Each domain corresponds to a team's ownership of a set of migrations that span multiple environments.
func GetDomain ¶
GetDomain returns a Domain for the specified key based on the available dirs in the domains root. If the key is not recognized, it will return an error
func MustGetDomain ¶
MustGetDomain returns a Domain for the specified key. If the key is not recognized, it will panic.
func (Domain) AddressBookByEnv ¶
func (d Domain) AddressBookByEnv(env string) (fdeployment.AddressBook, error)
AddressBookByEnv returns the address book for the specified environment.
func (Domain) ArtifactsDirByEnv ¶
func (d Domain) ArtifactsDirByEnv(env string) *ArtifactsDir
ArtifactsDirByEnv returns the artifacts directory for the specified environment.
func (Domain) CmdDirPath ¶
CmdDirPath returns the path to the cmd directory within the domain. This is where the domain's command line tools should be placed.
func (Domain) ConfigCICommonFilePath ¶ added in v0.34.0
ConfigCICommonFilePath returns the path to the domain's CI common .env file.
func (Domain) ConfigCIDirPath ¶ added in v0.33.0
ConfigCIDirPath returns the path where the domain's CI .env files are stored.
func (Domain) ConfigCIEnvFilePath ¶ added in v0.34.0
ConfigCIEnvFilePath returns the path to the domain's CI .env file for the specified environment.
func (Domain) ConfigDirPath ¶ added in v0.33.0
ConfigDirPath returns the path to the domain config directory within the domain.
func (Domain) ConfigDomainFilePath ¶ added in v0.37.1
ConfigDomainFilePath returns the path to the domain's domain config file.
func (Domain) ConfigLocalDirPath ¶ added in v0.33.0
ConfigLocalDirPath returns the path where local execution config files are stored.
func (Domain) ConfigLocalFilePath ¶ added in v0.33.0
ConfigLocalFilePath returns the path to a domain environment's local execution config file.
func (Domain) ConfigNetworksDirPath ¶ added in v0.33.0
ConfigNetworksDirPath returns the path where the domain's networks config files are stored.
func (Domain) ConfigNetworksFilePath ¶ added in v0.38.0
ConfigNetworksFilePath returns the path to a domain environment's networks config file.
func (Domain) DataStoreByEnv ¶
func (d Domain) DataStoreByEnv(env string) (fdatastore.DataStore, error)
DataStoreByEnv returns the datastore for the specified environment.
func (Domain) InternalDirPath ¶
InternalDirPath returns the path to the internal directory within the domain. This is where internal packages should be placed.
func (Domain) LibDirPath ¶
LibDirPath returns the path to the lib directory within the domain. This is where shared libraries and packages should be placed.
type EnvDir ¶
type EnvDir struct {
// contains filtered or unexported fields
}
EnvDir represents a specific environment directory within a domain.
func (EnvDir) AddressBook ¶
func (d EnvDir) AddressBook() (fdeployment.AddressBook, error)
AddressBook returns the address book for the domain's environment directory.
func (EnvDir) AddressBookFilePath ¶
AddressBookFilePath returns the path to the address book file for the domain's environment directory.
func (EnvDir) AddressRefsFilePath ¶
AddressRefsFilePath returns the path to the address refs store file for the domain's environment directory.
func (EnvDir) ArtifactsDir ¶
func (d EnvDir) ArtifactsDir() *ArtifactsDir
ArtifactsDir returns the artifacts for the domain's environment directory.
func (EnvDir) ChainMetadataFilePath ¶
ChainMetadataFilePath returns the path to the chain metadata store file for the domain's environment directory.
func (EnvDir) ContractMetadataFilePath ¶
ContractMetadataFilePath returns the path to the contract metadata store file for the domain's environment directory.
func (EnvDir) CreateDurablePipelinesDir ¶
CreateDurablePipelinesDir creates the durable_pipelines directory and inputs subdirectory within the domain's environment directory if they don't exist. It also creates .gitkeep files within both directories to ensure they are tracked by git.
func (EnvDir) DataStore ¶
func (d EnvDir) DataStore() (fdatastore.DataStore, error)
DataStore returns the datastore for the domain's environment directory as read-only.
func (EnvDir) DataStoreDirPath ¶
DatastoreDirPath returns the path to the datastore directory within the domain's environment.
func (EnvDir) DomainDirPath ¶
DomainDirPath returns the path to the domain directory within the environment.
func (EnvDir) DurablePipelinesDirPath ¶
DurablePipelinesDirPath returns the path to the durable_pipelines directory within the domain's environment.
func (EnvDir) DurablePipelinesInputsDirPath ¶
DurablePipelinesInputsDirPath returns the path to the inputs directory within the durable_pipelines directory.
func (EnvDir) EnvMetadataFilePath ¶
EnvMetadataFilePath returns the path to the environment metadata file for the domain's environment directory.
func (EnvDir) InputsDirPath ¶
InputsDirPath returns the path to the inputs directory for the domain's environment directory.
func (EnvDir) LoadNodes ¶
LoadNodes loads the nodes in the domain's environment directory from a nodes.json file.
func (EnvDir) LoadState ¶
func (d EnvDir) LoadState() (JSONSerializer, error)
LoadViewState loads the view domain state as a json.Marshaler if the state file does not exist, it will return an empty json.Marshaler by default.
func (EnvDir) MergeMigrationAddressBook ¶
MergeMigrationAddressBook merges a migration's address book into an existing address book for the given domain environment. It reads the existing address book and the migration's address book, merges the latter into the former, and then writes the updated address book back to the domain environment address book.
func (EnvDir) MergeMigrationDataStore ¶
func (EnvDir) MigrateAddressBook ¶
MigrateAddressBook migrates the address book for the domain's environment directory to the new datastore format. It reads the existing address book and converts its records. When converting address book entries to datastore addressRefs, some assumptions are made to guarantee the conversion is successful.
func (EnvDir) MigrationsArchiveFilePath ¶
MigrationsArchiveFilePath returns the path to the migrations archive file for the domain's environment directory.
func (EnvDir) MigrationsFilePath ¶
MigrationsFilePath returns the path to the migrations file for the domain's environment directory.
func (EnvDir) MutableDataStore ¶
func (d EnvDir) MutableDataStore() (fdatastore.MutableDataStore, error)
MutableDataStore returns the datastore for the domain's environment directory as mutable.
func (EnvDir) NodesFilePath ¶
NodesFilePath returns the path to the file containing node information for the domain's environment directory.
func (EnvDir) PipelinesFilePath ¶ added in v0.41.0
PipelinesFilePath returns the path to the Pipeline file for the domain's environment directory.
func (EnvDir) RemoveMigrationAddressBook ¶
RemoveAddressBooks removes a migration's address book from an existing address book for a given domain environment. It reads the existing address book and the migration's address book, removes the latter from the former, and then writes the updated address book back to the domain environment address book.
This can rollback MergeAddressBooks changes.
func (EnvDir) RootPath ¶ added in v0.27.0
RootPath returns the root path of the environment directory.
func (EnvDir) SaveNodes ¶
SaveNodes saves the node IDs to the domain's environment directory into a nodes.json file.
If the file already exists, the new nodes will be merged with the existing nodes. If a node with the same id already exists, it will be overwritten.
func (EnvDir) SaveViewState ¶ added in v0.26.0
SaveViewState saves the view state of the domain's environment with the default filename.
func (EnvDir) ViewStateFilePath ¶
ViewStateFilePath returns the path to the file containing view state for the domain's environment directory.
type JSONSerializer ¶
type JSONSerializer interface {
json.Marshaler
json.Unmarshaler
}
JSONSerializer combines both marshaling and unmarshaling capabilities