gitea_cc_plugin

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CheckSumMd5     = "md5"
	CheckSumSha1    = "sha1"
	CheckSumSha256  = "sha256"
	CheckSumSha512  = "sha512"
	CheckSumAdler32 = "adler32"
	CheckSumCrc32   = "crc32"
	CheckSumBlake2b = "blake2b"
	CheckSumBlake2s = "blake2s"
)
View Source
const (
	CliNameGiteaApiKey = "settings.gitea-api-key"
	EnvGiteaApiKey     = "PLUGIN_GITEA_API_KEY"

	CliNameGiteaBaseUrl = "settings.gitea-base-url"
	EnvGiteaBaseUrl     = "PLUGIN_GITEA_BASE_URL"

	CliNameGiteaInsecure = "settings.gitea-insecure"
	EnvGiteaInsecure     = "PLUGIN_GITEA_INSECURE"

	CliNameGiteaDryRun = "settings.gitea-dry-run"
	EnvGiteaDryRun     = "PLUGIN_GITEA_DRY_RUN"

	CliNameGiteaDraft = "settings.gitea-draft"
	EnvGiteaDraft     = "PLUGIN_GITEA_DRAFT"

	CliNameGiteaPrerelease = "settings.gitea-prerelease"
	EnvGiteaPrerelease     = "PLUGIN_GITEA_PRERELEASE"

	CliNameGiteaReleaseFileRootPath = "settings.gitea-release-file-root-path"
	EnvGiteaReleaseFileRootPath     = "PLUGIN_GITEA_RELEASE_FILE_ROOT_PATH"

	CliNameGiteaReleaseFilesGlobs = "settings.gitea-release-files-globs"
	EnvGiteaReleaseFilesGlobs     = "PLUGIN_GITEA_RELEASE_FILES_GLOBS"

	CliNameGiteaReleaseFileExistsDo = "settings.gitea-release-file-exists-do"
	EnvGiteaReleaseFileExistsDo     = "PLUGIN_GITEA_RELEASE_FILE_EXISTS_DO"

	CliNameGiteaFilesChecksum = "settings.gitea-files-checksum"
	EnvGiteaFilesChecksum     = "PLUGIN_GITEA_FILES_CHECKSUM"

	CliNameGiteaReleaseTitle = "settings.gitea-release-title"
	EnvGiteaReleaseTitle     = "PLUGIN_GITEA_RELEASE_TITLE"

	CliNameGiteaReleaseNote = "settings.gitea-release-note"
	EnvGiteaReleaseNote     = "PLUGIN_GITEA_RELEASE_NOTE"

	CliNameGiteaReleaseNoteByConventionChange = "settings.gitea-release-note-by-convention-change"
	EnvGiteaReleaseNoteByConventionChange     = "PLUGIN_GITEA_RELEASE_NOTE_BY_CONVENTION_CHANGE"

	CliNameGiteaReleaseReadChangeLogFile = "settings.gitea-release-read-change-log-file"
	EnvGiteaReleaseReadChangeLogFile     = "PLUGIN_GITEA_RELEASE_READ_CHANGE_LOG_FILE"

	CliNameGiteaTimeoutSecond = "settings.gitea-timeout-second"
	EnvGiteaTimeoutSecond     = "PLUGIN_GITEA_TIMEOUT_SECOND"
)
View Source
const (
	FileExistsDoFail      = "fail"
	FileExistsDoOverwrite = "overwrite"
	FileExistsDoSkip      = "skip"
)

Variables

View Source
var ErrGlobsEmpty = fmt.Errorf("globs is empty")
View Source
var (
	ErrMissingTag = fmt.Errorf("NewReleaseClientByWoodpecker missing tag, please check now in tag build")
)

Functions

func Checksum

func Checksum(r io.Reader, method string) (string, error)

func FindFileByGlobs

func FindFileByGlobs(globs []string, root string) ([]string, error)

func GlobalFlag

func GlobalFlag() []cli.Flag

GlobalFlag Other modules also have flags

func HideGlobalFlag

func HideGlobalFlag() []cli.Flag

func WalkAllByGlob

func WalkAllByGlob(path string, glob string, ignoreFolder bool) ([]string, error)

WalkAllByGlob can walk all path then return as list, by glob with filepath.Glob

func WriteChecksumsByFiles

func WriteChecksumsByFiles(files, methods []string, root string) ([]string, error)

Types

type FuncGiteaCCRelease

type FuncGiteaCCRelease interface {
	ShortInfo() wd_short_info.WoodpeckerInfoShort

	SetWoodpeckerInfo(info wd_info.WoodpeckerInfo)
	GetWoodPeckerInfo() wd_info.WoodpeckerInfo

	OnlyArgsCheck()

	Exec() error
	// contains filtered or unexported methods
}

type GiteaCCRelease

type GiteaCCRelease struct {
	Name    string
	Version string

	Settings Settings

	FuncPlugin FuncGiteaCCRelease `json:"-"`
	// contains filtered or unexported fields
}

GiteaCCRelease gitea_cc_plugin all config

func BindCliFlags

func BindCliFlags(c *cli.Context,
	debug bool,
	cliName, cliVersion string,
	wdInfo *wd_info.WoodpeckerInfo,
	rootPath,
	stepsTransferPath string, stepsOutDisable bool,
) (*GiteaCCRelease, error)

func (*GiteaCCRelease) Exec

func (p *GiteaCCRelease) Exec() error

func (*GiteaCCRelease) GetWoodPeckerInfo

func (p *GiteaCCRelease) GetWoodPeckerInfo() wd_info.WoodpeckerInfo

func (*GiteaCCRelease) OnlyArgsCheck

func (p *GiteaCCRelease) OnlyArgsCheck()

func (*GiteaCCRelease) SetWoodpeckerInfo

func (p *GiteaCCRelease) SetWoodpeckerInfo(info wd_info.WoodpeckerInfo)

SetWoodpeckerInfo also change ShortInfo() return

func (*GiteaCCRelease) ShortInfo

type GiteaPackageInfo

type GiteaPackageInfo struct {
	Id      uint64 `json:"id"`
	Type    string `json:"type"`
	Name    string `json:"name"`
	Version string `json:"version"`
}

type PluginGiteaReleaseClient

type PluginGiteaReleaseClient interface {
	GetUploadDesc() string

	Title() string

	SetTitle(title string)

	Tag() string

	SetNote(noteContent string)

	BuildRelease() (*gitea.Release, error)

	UploadFiles(releaseID int64) error
}

func NewReleaseClientByWoodpeckerShort

func NewReleaseClientByWoodpeckerShort(info wd_short_info.WoodpeckerInfoShort, config Settings) (PluginGiteaReleaseClient, error)

NewReleaseClientByWoodpeckerShort creates a new release client from the woodpecker info. will try to upload files if the globs are set. and will create a release with the tag as the title. check sums can be generated for the files [ sum.txt ] from flag CliNameGiteaReleaseFileRootPath

type Settings

type Settings struct {
	Debug             bool
	TimeoutSecond     uint
	StepsTransferPath string
	StepsOutDisable   bool
	RootPath          string

	GiteaBaseUrl       string
	GiteaInsecure      bool
	GiteaApiKey        string
	GiteaTimeoutSecond uint

	DryRun          bool
	GiteaDraft      bool
	GiteaPrerelease bool

	GiteaReleaseFilesGlobs       []string
	GiteaReleaseFileGlobRootPath string
	GiteaReleaseFileExistsDo     string
	GiteaFilesChecksum           []string

	GiteaReleaseTitle                  string
	GiteaReleaseNote                   string
	GiteaReleaseNoteByConventionChange bool
	GiteaReleaseConventionReadPath     string
}

Settings gitea_cc_plugin private config

Jump to

Keyboard shortcuts

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