repocmd

package
v0.0.32 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2021 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RepoCmd = &cobra.Command{
	Use:   "repo",
	Short: "Create, find and manage repositories",
	Long:  ``,
	Run: func(cmd *cobra.Command, args []string) {
		_ = cmd.Help()
	},
}

RepoCmd represents the repo command

Functions

func AskPassCmd

func AskPassCmd(repo types.LocalRepo, args []string, stdout io.Writer) error

AskPassCmd handles git core.askPass calls.

We use this command to fetch push tokens that may have been created and signed by the pre-push hook during git push but cannot be used by git since git does not allow the connection to be altered in the pre-push hook phase. By returning the push token as a username via askPass utility, we can inject the token into the push request.

The command tries to find tokens that have been created and signed for remotes where one or more of its urls have matching hostname as the url git is requesting password for.

func ConfigCmd

func ConfigCmd(_ *config.AppConfig, repo types.LocalRepo, args *ConfigArgs) error

ConfigCmd configures a repository

func CreateCmd

func CreateCmd(cfg *config.AppConfig, args *CreateArgs) error

CreateCmd creates a transaction to create a repository

func HookCmd

func HookCmd(cfg *config.AppConfig, repo types.LocalRepo, args *HookArgs) error

HookCmd handles pre-push calls by git

func VoteCmd

func VoteCmd(cfg *config.AppConfig, args *VoteArgs) error

VoteCmd creates a transaction to vote for/against a repository's proposal

Types

type ConfigArgs

type ConfigArgs struct {

	// Value is the transaction value
	Value *float64

	// Fee is the transaction fee to be paid by the signing key
	Fee *float64

	// Nonce is the next nonce of the signing account
	Nonce *uint64

	// SigningKey is the key that will be used to sign the transaction.
	SigningKey *string

	// SigningKeyPass is the passphrase for unlocking the signing key.
	SigningKeyPass *string

	// PushKey is the key that will be used sign push request
	PushKey *string

	// NoHook indicates that hooks should not be added
	NoHook bool

	// Remotes contain a list of git remotes to append to the repo.
	Remotes []Remote

	// RpcClient is the RPC client
	RPCClient rpctypes.Client

	// KeyUnlocker is a function for getting and unlocking a push key from keystore.
	KeyUnlocker common.UnlockKeyFunc

	// GetNextNonce is a function for getting the next nonce of an account
	GetNextNonce api.NextNonceGetter

	// CommandCreator creates a wrapped exec.Cmd object
	CommandCreator util.CommandCreator

	// PassAgentPort determines the port where the passphrase agent will bind to
	PassAgentPort *string

	// PassCacheTTL is the number of seconds a cached passphrase will live for.
	PassCacheTTL string

	// PassAgentSet is a function for sending set request to the agent service
	PassAgentSet agent.SetFunc

	// PassAgentUp is a function that checks if the agent server is running
	PassAgentUp agent.IsUpFunc

	Stderr io.Writer
	Stdout io.Writer
}

ConfigArgs contains arguments for ConfigCmd.

type CreateArgs

type CreateArgs struct {

	// Name is the unique name of the repository
	Name string

	// Description is a short description of the repository
	Description string

	// configPath is the path to the repo config file or a JSON string
	// to be decoded as the config.
	Config string

	// Nonce is the next nonce of the signing key's account
	Nonce uint64

	// Value the the amount of coins to transfer from the signer's account to the repo account.
	Value float64

	// Fee is the transaction fee to be paid by the signing key
	Fee float64

	// SigningKey is the account whose key will be used to sign the transaction.
	SigningKey string

	// SigningKeyPass is the passphrase for unlocking the signing key.
	SigningKeyPass string

	// RpcClient is the RPC client
	RPCClient types.Client

	// KeyUnlocker is a function for getting and unlocking a push key from keystore.
	KeyUnlocker common.UnlockKeyFunc

	// GetNextNonce is a function for getting the next nonce of an account
	GetNextNonce api.NextNonceGetter

	// CreateRepo is a function for generating a transaction for creating a repository
	CreateRepo api.RepoCreator

	// ShowTxStatusTracker is a function tracking and displaying tx status
	ShowTxStatusTracker common.TxStatusTrackerFunc

	Stdout io.Writer
}

CreateArgs contains arguments for CreateCmd.

type HookArgs

type HookArgs struct {
	*types3.SignCommitArgs

	// Args is the command arguments
	Args []string

	// PostCommit when true indicates that the hook was called in a post-commit hook
	PostCommit bool

	// RpcClient is the RPC client
	RPCClient types2.Client

	// KeyUnlocker is a function for getting and unlocking a push key from keystore
	KeyUnlocker common.UnlockKeyFunc

	// GetNextNonce is a function for getting the next nonce of the owner account of a pusher key
	GetNextNonce api.NextNonceGetter

	// SetRemotePushToken is a function for creating, signing and applying a push token to a give remote
	SetRemotePushToken server.MakeAndApplyPushTokenToRemoteFunc

	CommitSigner types3.SignCommitFunc
	TagSigner    types3.SignTagFunc
	NoteSigner   types3.SignNoteFunc

	Stdout io.Writer
	Stderr io.Writer
	Stdin  io.Reader
}

type Remote

type Remote struct {
	Name string
	URL  string
}

type VoteArgs

type VoteArgs struct {

	// Name is the name of the repository
	RepoName string

	// ProposalID is the unique ID of the proposal
	ProposalID string

	// Vote is the vote choice
	Vote int

	// Nonce is the next nonce of the signing key's account
	Nonce uint64

	// Fee is the transaction fee to be paid by the signing key
	Fee float64

	// SigningKey is the account whose key will be used to sign the transaction.
	SigningKey string

	// SigningKeyPass is the passphrase for unlocking the signing key.
	SigningKeyPass string

	// RpcClient is the RPC client
	RPCClient types.Client

	// KeyUnlocker is a function for getting and unlocking a push key from keystore.
	KeyUnlocker common.UnlockKeyFunc

	// GetNextNonce is a function for getting the next nonce of an account
	GetNextNonce api.NextNonceGetter

	// CreateRepo is a function for generating a transaction for creating a repository
	VoteCreator api.RepoProposalVoter

	// ShowTxStatusTracker is a function tracking and displaying tx status
	ShowTxStatusTracker common.TxStatusTrackerFunc

	Stdout io.Writer
}

VoteArgs contains arguments for VoteCmd.

Jump to

Keyboard shortcuts

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