You've already forked goreleaser
							
							
				mirror of
				https://github.com/goreleaser/goreleaser.git
				synced 2025-10-30 23:58:09 +02:00 
			
		
		
		
	refactor: better package organization
This commit is contained in:
		
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -1,5 +1,5 @@ | ||||
| dist/ | ||||
| !internal/pipeline/dist | ||||
| !internal/pipe/dist | ||||
| bin/ | ||||
| vendor | ||||
| coverage.txt | ||||
|   | ||||
							
								
								
									
										2
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								Makefile
									
									
									
									
									
								
							| @@ -76,7 +76,7 @@ serve: | ||||
|  | ||||
| depgraph: | ||||
| 	go get github.com/kisielk/godepgraph | ||||
| 	godepgraph -horizontal -s -o github.com/goreleaser github.com/goreleaser/goreleaser | dot -Tsvg -o www/static/deps.svg | ||||
| 	godepgraph -horizontal -s -o github.com/goreleaser/goreleaser . | dot -Tsvg -o www/static/deps.svg | ||||
| .PHONY: depgraph | ||||
|  | ||||
| # Show to-do items per file. | ||||
|   | ||||
| @@ -15,7 +15,7 @@ import ( | ||||
| 	"github.com/pkg/errors" | ||||
|  | ||||
| 	"github.com/goreleaser/goreleaser/internal/artifact" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe" | ||||
| 	"github.com/goreleaser/goreleaser/internal/semerrgroup" | ||||
| 	"github.com/goreleaser/goreleaser/pkg/config" | ||||
| 	"github.com/goreleaser/goreleaser/pkg/context" | ||||
| @@ -102,7 +102,7 @@ func CheckConfig(ctx *context.Context, put *config.Put, kind string) error { | ||||
| } | ||||
|  | ||||
| func misconfigured(kind string, upload *config.Put, reason string) error { | ||||
| 	return pipeline.Skip(fmt.Sprintf("%s section '%s' is not configured properly (%s)", kind, upload.Name, reason)) | ||||
| 	return pipe.Skip(fmt.Sprintf("%s section '%s' is not configured properly (%s)", kind, upload.Name, reason)) | ||||
| } | ||||
|  | ||||
| // ResponseChecker is a function capable of validating an http server response. | ||||
| @@ -112,7 +112,7 @@ type ResponseChecker func(*h.Response) error | ||||
| // Upload does the actual uploading work | ||||
| func Upload(ctx *context.Context, puts []config.Put, kind string, check ResponseChecker) error { | ||||
| 	if ctx.SkipPublish { | ||||
| 		return pipeline.ErrSkipPublishEnabled | ||||
| 		return pipe.ErrSkipPublishEnabled | ||||
| 	} | ||||
|  | ||||
| 	// Handle every configured put | ||||
|   | ||||
| @@ -8,7 +8,7 @@ import ( | ||||
| 	h "net/http" | ||||
| 
 | ||||
| 	"github.com/goreleaser/goreleaser/internal/http" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe" | ||||
| 	"github.com/goreleaser/goreleaser/pkg/context" | ||||
| ) | ||||
| 
 | ||||
| @@ -53,14 +53,14 @@ func (Pipe) Default(ctx *context.Context) error { | ||||
| // Docs: https://www.jfrog.com/confluence/display/RTF/Artifactory+REST+API#ArtifactoryRESTAPI-Example-DeployinganArtifact | ||||
| func (Pipe) Run(ctx *context.Context) error { | ||||
| 	if len(ctx.Config.Artifactories) == 0 { | ||||
| 		return pipeline.Skip("artifactory section is not configured") | ||||
| 		return pipe.Skip("artifactory section is not configured") | ||||
| 	} | ||||
| 
 | ||||
| 	// Check requirements for every instance we have configured. | ||||
| 	// If not fulfilled, we can skip this pipeline | ||||
| 	for _, instance := range ctx.Config.Artifactories { | ||||
| 		if skip := http.CheckConfig(ctx, &instance, "artifactory"); skip != nil { | ||||
| 			return pipeline.Skip(skip.Error()) | ||||
| 			return pipe.Skip(skip.Error()) | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| @@ -11,7 +11,7 @@ import ( | ||||
| 	"testing" | ||||
| 
 | ||||
| 	"github.com/goreleaser/goreleaser/internal/artifact" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe" | ||||
| 	"github.com/goreleaser/goreleaser/pkg/config" | ||||
| 	"github.com/goreleaser/goreleaser/pkg/context" | ||||
| 	"github.com/stretchr/testify/assert" | ||||
| @@ -620,8 +620,8 @@ func TestRunPipe_SkipWhenPublishFalse(t *testing.T) { | ||||
| 	ctx.SkipPublish = true | ||||
| 
 | ||||
| 	err := Pipe{}.Run(ctx) | ||||
| 	assert.True(t, pipeline.IsSkip(err)) | ||||
| 	assert.EqualError(t, err, pipeline.ErrSkipPublishEnabled.Error()) | ||||
| 	assert.True(t, pipe.IsSkip(err)) | ||||
| 	assert.EqualError(t, err, pipe.ErrSkipPublishEnabled.Error()) | ||||
| } | ||||
| 
 | ||||
| func TestRunPipe_DirUpload(t *testing.T) { | ||||
| @@ -663,7 +663,7 @@ func TestDescription(t *testing.T) { | ||||
| } | ||||
| 
 | ||||
| func TestNoArtifactories(t *testing.T) { | ||||
| 	assert.True(t, pipeline.IsSkip(Pipe{}.Run(context.New(config.Project{})))) | ||||
| 	assert.True(t, pipe.IsSkip(Pipe{}.Run(context.New(config.Project{})))) | ||||
| } | ||||
| 
 | ||||
| func TestArtifactoriesWithoutTarget(t *testing.T) { | ||||
| @@ -681,7 +681,7 @@ func TestArtifactoriesWithoutTarget(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	assert.True(t, pipeline.IsSkip(Pipe{}.Run(ctx))) | ||||
| 	assert.True(t, pipe.IsSkip(Pipe{}.Run(ctx))) | ||||
| } | ||||
| 
 | ||||
| func TestArtifactoriesWithoutUsername(t *testing.T) { | ||||
| @@ -699,11 +699,11 @@ func TestArtifactoriesWithoutUsername(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	assert.True(t, pipeline.IsSkip(Pipe{}.Run(ctx))) | ||||
| 	assert.True(t, pipe.IsSkip(Pipe{}.Run(ctx))) | ||||
| } | ||||
| 
 | ||||
| func TestArtifactoriesWithoutName(t *testing.T) { | ||||
| 	assert.True(t, pipeline.IsSkip(Pipe{}.Run(context.New(config.Project{ | ||||
| 	assert.True(t, pipe.IsSkip(Pipe{}.Run(context.New(config.Project{ | ||||
| 		Artifactories: []config.Put{ | ||||
| 			{ | ||||
| 				Username: "deployuser", | ||||
| @@ -714,7 +714,7 @@ func TestArtifactoriesWithoutName(t *testing.T) { | ||||
| } | ||||
| 
 | ||||
| func TestArtifactoriesWithoutSecret(t *testing.T) { | ||||
| 	assert.True(t, pipeline.IsSkip(Pipe{}.Run(context.New(config.Project{ | ||||
| 	assert.True(t, pipe.IsSkip(Pipe{}.Run(context.New(config.Project{ | ||||
| 		Artifactories: []config.Put{ | ||||
| 			{ | ||||
| 				Name:     "production", | ||||
| @@ -13,7 +13,7 @@ import ( | ||||
| 
 | ||||
| 	"github.com/goreleaser/goreleaser/internal/artifact" | ||||
| 	"github.com/goreleaser/goreleaser/internal/client" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe" | ||||
| 	"github.com/goreleaser/goreleaser/internal/tmpl" | ||||
| 	"github.com/goreleaser/goreleaser/pkg/config" | ||||
| 	"github.com/goreleaser/goreleaser/pkg/context" | ||||
| @@ -89,10 +89,10 @@ func contains(ss []string, s string) bool { | ||||
| 
 | ||||
| func doRun(ctx *context.Context, client client.Client) error { | ||||
| 	if ctx.Config.Brew.GitHub.Name == "" { | ||||
| 		return pipeline.Skip("brew section is not configured") | ||||
| 		return pipe.Skip("brew section is not configured") | ||||
| 	} | ||||
| 	if getFormat(ctx) == "binary" { | ||||
| 		return pipeline.Skip("archive format is binary") | ||||
| 		return pipe.Skip("archive format is binary") | ||||
| 	} | ||||
| 
 | ||||
| 	var archives = ctx.Artifacts.Filter( | ||||
| @@ -123,13 +123,13 @@ func doRun(ctx *context.Context, client client.Client) error { | ||||
| 	} | ||||
| 
 | ||||
| 	if ctx.Config.Brew.SkipUpload { | ||||
| 		return pipeline.Skip("brew.skip_upload is set") | ||||
| 		return pipe.Skip("brew.skip_upload is set") | ||||
| 	} | ||||
| 	if ctx.SkipPublish { | ||||
| 		return pipeline.ErrSkipPublishEnabled | ||||
| 		return pipe.ErrSkipPublishEnabled | ||||
| 	} | ||||
| 	if ctx.Config.Release.Draft { | ||||
| 		return pipeline.Skip("release is marked as draft") | ||||
| 		return pipe.Skip("release is marked as draft") | ||||
| 	} | ||||
| 
 | ||||
| 	path = filepath.Join(ctx.Config.Brew.Folder, filename) | ||||
| @@ -13,7 +13,7 @@ import ( | ||||
| 	"github.com/apex/log" | ||||
| 
 | ||||
| 	"github.com/goreleaser/goreleaser/internal/git" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe" | ||||
| 	"github.com/goreleaser/goreleaser/pkg/context" | ||||
| ) | ||||
| 
 | ||||
| @@ -30,10 +30,10 @@ func (Pipe) String() string { | ||||
| // Run the pipe | ||||
| func (Pipe) Run(ctx *context.Context) error { | ||||
| 	if ctx.ReleaseNotes != "" { | ||||
| 		return pipeline.Skip("release notes already provided via --release-notes") | ||||
| 		return pipe.Skip("release notes already provided via --release-notes") | ||||
| 	} | ||||
| 	if ctx.Snapshot { | ||||
| 		return pipeline.Skip("not available for snapshots") | ||||
| 		return pipe.Skip("not available for snapshots") | ||||
| 	} | ||||
| 	if err := checkSortDirection(ctx.Config.Changelog.Sort); err != nil { | ||||
| 		return err | ||||
| @@ -6,21 +6,21 @@ import ( | ||||
| 	"fmt" | ||||
| 
 | ||||
| 	"github.com/apex/log" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline/archive" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline/artifactory" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline/brew" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline/build" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline/checksums" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline/docker" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline/env" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline/nfpm" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline/project" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline/release" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline/s3" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline/scoop" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline/sign" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline/snapcraft" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline/snapshot" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe/archive" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe/artifactory" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe/brew" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe/build" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe/checksums" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe/docker" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe/env" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe/nfpm" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe/project" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe/release" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe/s3" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe/scoop" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe/sign" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe/snapcraft" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe/snapshot" | ||||
| 	"github.com/goreleaser/goreleaser/pkg/context" | ||||
| ) | ||||
| 
 | ||||
| @@ -13,7 +13,7 @@ import ( | ||||
| 	"github.com/pkg/errors" | ||||
| 
 | ||||
| 	"github.com/goreleaser/goreleaser/internal/artifact" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe" | ||||
| 	"github.com/goreleaser/goreleaser/internal/semerrgroup" | ||||
| 	"github.com/goreleaser/goreleaser/internal/tmpl" | ||||
| 	"github.com/goreleaser/goreleaser/pkg/config" | ||||
| @@ -60,7 +60,7 @@ func (Pipe) Default(ctx *context.Context) error { | ||||
| // Run the pipe | ||||
| func (Pipe) Run(ctx *context.Context) error { | ||||
| 	if len(ctx.Config.Dockers) == 0 || ctx.Config.Dockers[0].Image == "" { | ||||
| 		return pipeline.Skip("docker section is not configured") | ||||
| 		return pipe.Skip("docker section is not configured") | ||||
| 	} | ||||
| 	_, err := exec.LookPath("docker") | ||||
| 	if err != nil { | ||||
| @@ -165,12 +165,12 @@ func link(src, dest string) error { | ||||
| func publish(ctx *context.Context, docker config.Docker, images []string) error { | ||||
| 	if ctx.SkipPublish { | ||||
| 		// TODO: this should be better handled | ||||
| 		log.Warn(pipeline.ErrSkipPublishEnabled.Error()) | ||||
| 		log.Warn(pipe.ErrSkipPublishEnabled.Error()) | ||||
| 		return nil | ||||
| 	} | ||||
| 	if docker.SkipPush { | ||||
| 		// TODO: this should also be better handled | ||||
| 		log.Warn(pipeline.Skip("skip_push is set").Error()) | ||||
| 		log.Warn(pipe.Skip("skip_push is set").Error()) | ||||
| 		return nil | ||||
| 	} | ||||
| 	for _, image := range images { | ||||
| @@ -10,7 +10,7 @@ import ( | ||||
| 	"testing" | ||||
| 
 | ||||
| 	"github.com/goreleaser/goreleaser/internal/artifact" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe" | ||||
| 	"github.com/goreleaser/goreleaser/pkg/config" | ||||
| 	"github.com/goreleaser/goreleaser/pkg/context" | ||||
| 	"github.com/stretchr/testify/assert" | ||||
| @@ -420,11 +420,11 @@ func TestDescription(t *testing.T) { | ||||
| } | ||||
| 
 | ||||
| func TestNoDockers(t *testing.T) { | ||||
| 	assert.True(t, pipeline.IsSkip(Pipe{}.Run(context.New(config.Project{})))) | ||||
| 	assert.True(t, pipe.IsSkip(Pipe{}.Run(context.New(config.Project{})))) | ||||
| } | ||||
| 
 | ||||
| func TestNoDockerWithoutImageName(t *testing.T) { | ||||
| 	assert.True(t, pipeline.IsSkip(Pipe{}.Run(context.New(config.Project{ | ||||
| 	assert.True(t, pipe.IsSkip(Pipe{}.Run(context.New(config.Project{ | ||||
| 		Dockers: []config.Docker{ | ||||
| 			{ | ||||
| 				Goos: "linux", | ||||
| @@ -6,7 +6,7 @@ import ( | ||||
| 	"bufio" | ||||
| 	"os" | ||||
| 
 | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe" | ||||
| 	"github.com/goreleaser/goreleaser/pkg/context" | ||||
| 	homedir "github.com/mitchellh/go-homedir" | ||||
| 	"github.com/pkg/errors" | ||||
| @@ -36,10 +36,10 @@ func (Pipe) Run(ctx *context.Context) error { | ||||
| 	token, err := loadEnv("GITHUB_TOKEN", ctx.Config.EnvFiles.GitHubToken) | ||||
| 	ctx.Token = token | ||||
| 	if ctx.SkipPublish { | ||||
| 		return pipeline.ErrSkipPublishEnabled | ||||
| 		return pipe.ErrSkipPublishEnabled | ||||
| 	} | ||||
| 	if ctx.Config.Release.Disable { | ||||
| 		return pipeline.Skip("release pipe is disabled") | ||||
| 		return pipe.Skip("release pipe is disabled") | ||||
| 	} | ||||
| 	if ctx.Token == "" && err == nil { | ||||
| 		return ErrMissingToken | ||||
| @@ -8,7 +8,7 @@ import ( | ||||
| 
 | ||||
| 	"github.com/apex/log" | ||||
| 	"github.com/goreleaser/goreleaser/internal/git" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe" | ||||
| 	"github.com/goreleaser/goreleaser/internal/tmpl" | ||||
| 	"github.com/goreleaser/goreleaser/pkg/context" | ||||
| 	"github.com/pkg/errors" | ||||
| @@ -96,10 +96,10 @@ func setVersion(ctx *context.Context) error { | ||||
| 
 | ||||
| func validate(ctx *context.Context) error { | ||||
| 	if ctx.Snapshot { | ||||
| 		return pipeline.ErrSnapshotEnabled | ||||
| 		return pipe.ErrSnapshotEnabled | ||||
| 	} | ||||
| 	if ctx.SkipValidate { | ||||
| 		return pipeline.ErrSkipValidateEnabled | ||||
| 		return pipe.ErrSkipValidateEnabled | ||||
| 	} | ||||
| 	out, err := git.Run("status", "--porcelain") | ||||
| 	if strings.TrimSpace(out) != "" || err != nil { | ||||
| @@ -17,7 +17,7 @@ import ( | ||||
| 
 | ||||
| 	"github.com/goreleaser/goreleaser/internal/artifact" | ||||
| 	"github.com/goreleaser/goreleaser/internal/linux" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe" | ||||
| 	"github.com/goreleaser/goreleaser/internal/semerrgroup" | ||||
| 	"github.com/goreleaser/goreleaser/internal/tmpl" | ||||
| 	"github.com/goreleaser/goreleaser/pkg/config" | ||||
| @@ -51,7 +51,7 @@ func (Pipe) Default(ctx *context.Context) error { | ||||
| // Run the pipe | ||||
| func (Pipe) Run(ctx *context.Context) error { | ||||
| 	if len(ctx.Config.NFPM.Formats) == 0 { | ||||
| 		return pipeline.Skip("no output formats configured") | ||||
| 		return pipe.Skip("no output formats configured") | ||||
| 	} | ||||
| 	return doRun(ctx) | ||||
| } | ||||
							
								
								
									
										39
									
								
								internal/pipe/pipe.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								internal/pipe/pipe.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,39 @@ | ||||
| // Package pipe provides generic erros for pipes to use. | ||||
| package pipe | ||||
|  | ||||
| // ErrSnapshotEnabled happens when goreleaser is running in snapshot mode. | ||||
| // It usually means that publishing and maybe some validations were skipped. | ||||
| var ErrSnapshotEnabled = Skip("disabled during snapshot mode") | ||||
|  | ||||
| // ErrSkipPublishEnabled happens if --skip-publish is set. | ||||
| // It means that the part of a Piper that publishes its artifacts was not run. | ||||
| var ErrSkipPublishEnabled = Skip("publishing is disabled") | ||||
|  | ||||
| // ErrSkipSignEnabled happens if --skip-sign is set. | ||||
| // It means that the part of a Piper that signs some things was not run. | ||||
| var ErrSkipSignEnabled = Skip("artifact signing is disabled") | ||||
|  | ||||
| // ErrSkipValidateEnabled happens if --skip-validate is set. | ||||
| // It means that the part of a Piper that validates some things was not run. | ||||
| var ErrSkipValidateEnabled = Skip("validation is disabled") | ||||
|  | ||||
| // IsSkip returns true if the error is an ErrSkip | ||||
| func IsSkip(err error) bool { | ||||
| 	_, ok := err.(ErrSkip) | ||||
| 	return ok | ||||
| } | ||||
|  | ||||
| // ErrSkip occurs when a pipe is skipped for some reason | ||||
| type ErrSkip struct { | ||||
| 	reason string | ||||
| } | ||||
|  | ||||
| // Error implements the error interface. returns the reason the pipe was skipped | ||||
| func (e ErrSkip) Error() string { | ||||
| 	return e.reason | ||||
| } | ||||
|  | ||||
| // Skip skips this pipe with the given reason | ||||
| func Skip(reason string) ErrSkip { | ||||
| 	return ErrSkip{reason: reason} | ||||
| } | ||||
| @@ -1,4 +1,4 @@ | ||||
| package pipeline | ||||
| package pipe | ||||
| 
 | ||||
| import ( | ||||
| 	"errors" | ||||
| @@ -5,7 +5,7 @@ import ( | ||||
| 	h "net/http" | ||||
| 
 | ||||
| 	"github.com/goreleaser/goreleaser/internal/http" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe" | ||||
| 	"github.com/goreleaser/goreleaser/pkg/context" | ||||
| 	"github.com/pkg/errors" | ||||
| ) | ||||
| @@ -27,14 +27,14 @@ func (Pipe) Default(ctx *context.Context) error { | ||||
| func (Pipe) Run(ctx *context.Context) error { | ||||
| 
 | ||||
| 	if len(ctx.Config.Puts) == 0 { | ||||
| 		return pipeline.Skip("put section is not configured") | ||||
| 		return pipe.Skip("put section is not configured") | ||||
| 	} | ||||
| 
 | ||||
| 	// Check requirements for every instance we have configured. | ||||
| 	// If not fulfilled, we can skip this pipeline | ||||
| 	for _, instance := range ctx.Config.Puts { | ||||
| 		if skip := http.CheckConfig(ctx, &instance, "put"); skip != nil { | ||||
| 			return pipeline.Skip(skip.Error()) | ||||
| 			return pipe.Skip(skip.Error()) | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| @@ -11,7 +11,7 @@ import ( | ||||
| 	"testing" | ||||
| 
 | ||||
| 	"github.com/goreleaser/goreleaser/internal/artifact" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe" | ||||
| 	"github.com/goreleaser/goreleaser/pkg/config" | ||||
| 	"github.com/goreleaser/goreleaser/pkg/context" | ||||
| 	"github.com/stretchr/testify/assert" | ||||
| @@ -404,8 +404,8 @@ func TestRunPipe_SkipWhenPublishFalse(t *testing.T) { | ||||
| 	ctx.SkipPublish = true | ||||
| 
 | ||||
| 	err := Pipe{}.Run(ctx) | ||||
| 	assert.True(t, pipeline.IsSkip(err)) | ||||
| 	assert.EqualError(t, err, pipeline.ErrSkipPublishEnabled.Error()) | ||||
| 	assert.True(t, pipe.IsSkip(err)) | ||||
| 	assert.EqualError(t, err, pipe.ErrSkipPublishEnabled.Error()) | ||||
| } | ||||
| 
 | ||||
| func TestRunPipe_DirUpload(t *testing.T) { | ||||
| @@ -447,7 +447,7 @@ func TestDescription(t *testing.T) { | ||||
| } | ||||
| 
 | ||||
| func TestNoPuts(t *testing.T) { | ||||
| 	assert.True(t, pipeline.IsSkip(Pipe{}.Run(context.New(config.Project{})))) | ||||
| 	assert.True(t, pipe.IsSkip(Pipe{}.Run(context.New(config.Project{})))) | ||||
| } | ||||
| 
 | ||||
| func TestPutsWithoutTarget(t *testing.T) { | ||||
| @@ -465,7 +465,7 @@ func TestPutsWithoutTarget(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	assert.True(t, pipeline.IsSkip(Pipe{}.Run(ctx))) | ||||
| 	assert.True(t, pipe.IsSkip(Pipe{}.Run(ctx))) | ||||
| } | ||||
| 
 | ||||
| func TestPutsWithoutUsername(t *testing.T) { | ||||
| @@ -483,11 +483,11 @@ func TestPutsWithoutUsername(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	assert.True(t, pipeline.IsSkip(Pipe{}.Run(ctx))) | ||||
| 	assert.True(t, pipe.IsSkip(Pipe{}.Run(ctx))) | ||||
| } | ||||
| 
 | ||||
| func TestPutsWithoutName(t *testing.T) { | ||||
| 	assert.True(t, pipeline.IsSkip(Pipe{}.Run(context.New(config.Project{ | ||||
| 	assert.True(t, pipe.IsSkip(Pipe{}.Run(context.New(config.Project{ | ||||
| 		Puts: []config.Put{ | ||||
| 			{ | ||||
| 				Username: "deployuser", | ||||
| @@ -498,7 +498,7 @@ func TestPutsWithoutName(t *testing.T) { | ||||
| } | ||||
| 
 | ||||
| func TestPutsWithoutSecret(t *testing.T) { | ||||
| 	assert.True(t, pipeline.IsSkip(Pipe{}.Run(context.New(config.Project{ | ||||
| 	assert.True(t, pipe.IsSkip(Pipe{}.Run(context.New(config.Project{ | ||||
| 		Puts: []config.Put{ | ||||
| 			{ | ||||
| 				Name:     "production", | ||||
| @@ -7,7 +7,7 @@ import ( | ||||
| 
 | ||||
| 	"github.com/goreleaser/goreleaser/internal/artifact" | ||||
| 	"github.com/goreleaser/goreleaser/internal/client" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe" | ||||
| 	"github.com/goreleaser/goreleaser/internal/semerrgroup" | ||||
| 	"github.com/goreleaser/goreleaser/pkg/context" | ||||
| ) | ||||
| @@ -49,10 +49,10 @@ func (Pipe) Run(ctx *context.Context) error { | ||||
| 
 | ||||
| func doRun(ctx *context.Context, c client.Client) error { | ||||
| 	if ctx.Config.Release.Disable { | ||||
| 		return pipeline.Skip("release pipe is disabled") | ||||
| 		return pipe.Skip("release pipe is disabled") | ||||
| 	} | ||||
| 	if ctx.SkipPublish { | ||||
| 		return pipeline.ErrSkipPublishEnabled | ||||
| 		return pipe.ErrSkipPublishEnabled | ||||
| 	} | ||||
| 	log.WithField("tag", ctx.Git.CurrentTag). | ||||
| 		WithField("repo", ctx.Config.Release.GitHub.String()). | ||||
| @@ -9,7 +9,7 @@ import ( | ||||
| 	"github.com/aws/aws-sdk-go/aws" | ||||
| 	"github.com/aws/aws-sdk-go/service/s3" | ||||
| 	"github.com/goreleaser/goreleaser/internal/artifact" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe" | ||||
| 	"github.com/goreleaser/goreleaser/internal/semerrgroup" | ||||
| 	"github.com/goreleaser/goreleaser/internal/tmpl" | ||||
| 	"github.com/goreleaser/goreleaser/pkg/config" | ||||
| @@ -47,10 +47,10 @@ func (Pipe) Default(ctx *context.Context) error { | ||||
| // Run the pipe | ||||
| func (Pipe) Run(ctx *context.Context) error { | ||||
| 	if ctx.SkipPublish { | ||||
| 		return pipeline.ErrSkipPublishEnabled | ||||
| 		return pipe.ErrSkipPublishEnabled | ||||
| 	} | ||||
| 	if len(ctx.Config.S3) == 0 { | ||||
| 		return pipeline.Skip("s3 section is not configured") | ||||
| 		return pipe.Skip("s3 section is not configured") | ||||
| 	} | ||||
| 	var g = semerrgroup.New(ctx.Parallelism) | ||||
| 	for _, conf := range ctx.Config.S3 { | ||||
| @@ -11,7 +11,7 @@ import ( | ||||
| 
 | ||||
| 	"github.com/apex/log" | ||||
| 	"github.com/goreleaser/goreleaser/internal/artifact" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe" | ||||
| 	"github.com/goreleaser/goreleaser/internal/testlib" | ||||
| 	"github.com/goreleaser/goreleaser/pkg/config" | ||||
| 	"github.com/goreleaser/goreleaser/pkg/context" | ||||
| @@ -80,8 +80,8 @@ func TestSkipPublish(t *testing.T) { | ||||
| 	ctx.SkipPublish = true | ||||
| 	require.NoError(t, Pipe{}.Default(ctx)) | ||||
| 	err = Pipe{}.Run(ctx) | ||||
| 	assert.True(t, pipeline.IsSkip(err)) | ||||
| 	assert.EqualError(t, err, pipeline.ErrSkipPublishEnabled.Error()) | ||||
| 	assert.True(t, pipe.IsSkip(err)) | ||||
| 	assert.EqualError(t, err, pipe.ErrSkipPublishEnabled.Error()) | ||||
| } | ||||
| 
 | ||||
| func TestUpload(t *testing.T) { | ||||
| @@ -9,7 +9,7 @@ import ( | ||||
| 
 | ||||
| 	"github.com/goreleaser/goreleaser/internal/artifact" | ||||
| 	"github.com/goreleaser/goreleaser/internal/client" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe" | ||||
| 	"github.com/goreleaser/goreleaser/internal/tmpl" | ||||
| 	"github.com/goreleaser/goreleaser/pkg/context" | ||||
| ) | ||||
| @@ -54,10 +54,10 @@ func (Pipe) Default(ctx *context.Context) error { | ||||
| 
 | ||||
| func doRun(ctx *context.Context, client client.Client) error { | ||||
| 	if ctx.Config.Scoop.Bucket.Name == "" { | ||||
| 		return pipeline.Skip("scoop section is not configured") | ||||
| 		return pipe.Skip("scoop section is not configured") | ||||
| 	} | ||||
| 	if ctx.Config.Archive.Format == "binary" { | ||||
| 		return pipeline.Skip("archive format is binary") | ||||
| 		return pipe.Skip("archive format is binary") | ||||
| 	} | ||||
| 
 | ||||
| 	var archives = ctx.Artifacts.Filter( | ||||
| @@ -78,10 +78,10 @@ func doRun(ctx *context.Context, client client.Client) error { | ||||
| 	} | ||||
| 
 | ||||
| 	if ctx.SkipPublish { | ||||
| 		return pipeline.ErrSkipPublishEnabled | ||||
| 		return pipe.ErrSkipPublishEnabled | ||||
| 	} | ||||
| 	if ctx.Config.Release.Draft { | ||||
| 		return pipeline.Skip("release is marked as draft") | ||||
| 		return pipe.Skip("release is marked as draft") | ||||
| 	} | ||||
| 	return client.CreateFile( | ||||
| 		ctx, | ||||
| @@ -11,7 +11,7 @@ import ( | ||||
| 
 | ||||
| 	"github.com/goreleaser/goreleaser/internal/artifact" | ||||
| 	"github.com/goreleaser/goreleaser/internal/client" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe" | ||||
| 	"github.com/goreleaser/goreleaser/internal/testlib" | ||||
| 	"github.com/goreleaser/goreleaser/pkg/config" | ||||
| 	"github.com/goreleaser/goreleaser/pkg/context" | ||||
| @@ -286,7 +286,7 @@ func Test_doRun(t *testing.T) { | ||||
| 				{Name: "foo_1.0.1_windows_amd64.tar.gz", Goos: "windows", Goarch: "amd64", Path: file}, | ||||
| 				{Name: "foo_1.0.1_windows_386.tar.gz", Goos: "windows", Goarch: "386", Path: file}, | ||||
| 			}, | ||||
| 			shouldErr(pipeline.ErrSkipPublishEnabled.Error()), | ||||
| 			shouldErr(pipe.ErrSkipPublishEnabled.Error()), | ||||
| 		}, | ||||
| 		{ | ||||
| 			"is draft", | ||||
| @@ -7,7 +7,7 @@ import ( | ||||
| 	"path/filepath" | ||||
| 
 | ||||
| 	"github.com/goreleaser/goreleaser/internal/artifact" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe" | ||||
| 	"github.com/goreleaser/goreleaser/pkg/context" | ||||
| ) | ||||
| 
 | ||||
| @@ -39,7 +39,7 @@ func (Pipe) Default(ctx *context.Context) error { | ||||
| // Run executes the Pipe. | ||||
| func (Pipe) Run(ctx *context.Context) error { | ||||
| 	if ctx.SkipSign { | ||||
| 		return pipeline.ErrSkipSignEnabled | ||||
| 		return pipe.ErrSkipSignEnabled | ||||
| 	} | ||||
| 
 | ||||
| 	switch ctx.Config.Sign.Artifacts { | ||||
| @@ -54,7 +54,7 @@ func (Pipe) Run(ctx *context.Context) error { | ||||
| 				artifact.ByType(artifact.LinuxPackage), | ||||
| 			)).List()) | ||||
| 	case "none": | ||||
| 		return pipeline.ErrSkipSignEnabled | ||||
| 		return pipe.ErrSkipSignEnabled | ||||
| 	default: | ||||
| 		return fmt.Errorf("invalid list of artifacts to sign: %s", ctx.Config.Sign.Artifacts) | ||||
| 	} | ||||
| @@ -15,7 +15,7 @@ import ( | ||||
| 
 | ||||
| 	"github.com/goreleaser/goreleaser/internal/artifact" | ||||
| 	"github.com/goreleaser/goreleaser/internal/linux" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe" | ||||
| 	"github.com/goreleaser/goreleaser/internal/semerrgroup" | ||||
| 	"github.com/goreleaser/goreleaser/internal/tmpl" | ||||
| 	"github.com/goreleaser/goreleaser/pkg/context" | ||||
| @@ -70,7 +70,7 @@ func (Pipe) Default(ctx *context.Context) error { | ||||
| // Run the pipe | ||||
| func (Pipe) Run(ctx *context.Context) error { | ||||
| 	if ctx.Config.Snapcraft.Summary == "" && ctx.Config.Snapcraft.Description == "" { | ||||
| 		return pipeline.Skip("no summary nor description were provided") | ||||
| 		return pipe.Skip("no summary nor description were provided") | ||||
| 	} | ||||
| 	if ctx.Config.Snapcraft.Summary == "" { | ||||
| 		return ErrNoSummary | ||||
| @@ -8,7 +8,7 @@ import ( | ||||
| 	"testing" | ||||
| 
 | ||||
| 	"github.com/goreleaser/goreleaser/internal/artifact" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe" | ||||
| 	"github.com/goreleaser/goreleaser/pkg/config" | ||||
| 	"github.com/goreleaser/goreleaser/pkg/context" | ||||
| 	"github.com/stretchr/testify/assert" | ||||
| @@ -27,7 +27,7 @@ func TestRunPipeMissingInfo(t *testing.T) { | ||||
| 		ErrNoDescription: { | ||||
| 			Summary: "dummy summary", | ||||
| 		}, | ||||
| 		pipeline.Skip("no summary nor description were provided"): {}, | ||||
| 		pipe.Skip("no summary nor description were provided"): {}, | ||||
| 	} { | ||||
| 		t.Run(fmt.Sprintf("testing if %v happens", eerr), func(t *testing.T) { | ||||
| 			var ctx = &context.Context{ | ||||
| @@ -1,39 +1,60 @@ | ||||
| // Package pipeline provides generic erros for pipes to use. | ||||
| package pipeline | ||||
|  | ||||
| // ErrSnapshotEnabled happens when goreleaser is running in snapshot mode. | ||||
| // It usually means that publishing and maybe some validations were skipped. | ||||
| var ErrSnapshotEnabled = Skip("disabled during snapshot mode") | ||||
| import ( | ||||
| 	"fmt" | ||||
|  | ||||
| // ErrSkipPublishEnabled happens if --skip-publish is set. | ||||
| // It means that the part of a Piper that publishes its artifacts was not run. | ||||
| var ErrSkipPublishEnabled = Skip("publishing is disabled") | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe/archive" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe/artifactory" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe/before" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe/brew" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe/build" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe/changelog" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe/checksums" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe/defaults" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe/dist" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe/docker" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe/effectiveconfig" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe/env" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe/git" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe/nfpm" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe/put" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe/release" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe/s3" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe/scoop" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe/sign" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe/snapcraft" | ||||
| 	"github.com/goreleaser/goreleaser/pkg/context" | ||||
| ) | ||||
|  | ||||
| // ErrSkipSignEnabled happens if --skip-sign is set. | ||||
| // It means that the part of a Piper that signs some things was not run. | ||||
| var ErrSkipSignEnabled = Skip("artifact signing is disabled") | ||||
| // Piper defines a pipe, which can be part of a pipeline (a serie of pipes). | ||||
| type Piper interface { | ||||
| 	fmt.Stringer | ||||
|  | ||||
| // ErrSkipValidateEnabled happens if --skip-validate is set. | ||||
| // It means that the part of a Piper that validates some things was not run. | ||||
| var ErrSkipValidateEnabled = Skip("validation is disabled") | ||||
|  | ||||
| // IsSkip returns true if the error is an ErrSkip | ||||
| func IsSkip(err error) bool { | ||||
| 	_, ok := err.(ErrSkip) | ||||
| 	return ok | ||||
| 	// Run the pipe | ||||
| 	Run(ctx *context.Context) error | ||||
| } | ||||
|  | ||||
| // ErrSkip occurs when a pipe is skipped for some reason | ||||
| type ErrSkip struct { | ||||
| 	reason string | ||||
| } | ||||
|  | ||||
| // Error implements the error interface. returns the reason the pipe was skipped | ||||
| func (e ErrSkip) Error() string { | ||||
| 	return e.reason | ||||
| } | ||||
|  | ||||
| // Skip skips this pipe with the given reason | ||||
| func Skip(reason string) ErrSkip { | ||||
| 	return ErrSkip{reason: reason} | ||||
| // Pipeline contains all pipe implementations in order | ||||
| var Pipeline = []Piper{ | ||||
| 	defaults.Pipe{},        // load default configs | ||||
| 	before.Pipe{},          // run global hooks before build | ||||
| 	dist.Pipe{},            // ensure ./dist is clean | ||||
| 	git.Pipe{},             // get and validate git repo state | ||||
| 	effectiveconfig.Pipe{}, // writes the actual config (with defaults et al set) to dist | ||||
| 	changelog.Pipe{},       // builds the release changelog | ||||
| 	env.Pipe{},             // load and validate environment variables | ||||
| 	build.Pipe{},           // build | ||||
| 	archive.Pipe{},         // archive in tar.gz, zip or binary (which does no archiving at all) | ||||
| 	nfpm.Pipe{},            // archive via fpm (deb, rpm) using "native" go impl | ||||
| 	snapcraft.Pipe{},       // archive via snapcraft (snap) | ||||
| 	checksums.Pipe{},       // checksums of the files | ||||
| 	sign.Pipe{},            // sign artifacts | ||||
| 	docker.Pipe{},          // create and push docker images | ||||
| 	artifactory.Pipe{},     // push to artifactory | ||||
| 	put.Pipe{},             // upload to http server | ||||
| 	s3.Pipe{},              // push to s3/minio | ||||
| 	release.Pipe{},         // release to github | ||||
| 	brew.Pipe{},            // push to brew tap | ||||
| 	scoop.Pipe{},           // push to scoop bucket | ||||
| } | ||||
|   | ||||
| @@ -3,12 +3,12 @@ package testlib | ||||
| import ( | ||||
| 	"testing" | ||||
|  | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe" | ||||
| 	"github.com/stretchr/testify/assert" | ||||
| ) | ||||
|  | ||||
| // AssertSkipped asserts that a pipe was skipped | ||||
| func AssertSkipped(t *testing.T, err error) { | ||||
| 	_, ok := err.(pipeline.ErrSkip) | ||||
| 	assert.True(t, ok, "expected a pipeline.ErrSkip but got %v", err) | ||||
| 	_, ok := err.(pipe.ErrSkip) | ||||
| 	assert.True(t, ok, "expected a pipe.ErrSkip but got %v", err) | ||||
| } | ||||
|   | ||||
| @@ -3,9 +3,9 @@ package testlib | ||||
| import ( | ||||
| 	"testing" | ||||
|  | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe" | ||||
| ) | ||||
|  | ||||
| func TestAssertSkipped(t *testing.T) { | ||||
| 	AssertSkipped(t, pipeline.Skip("skip")) | ||||
| 	AssertSkipped(t, pipe.Skip("skip")) | ||||
| } | ||||
|   | ||||
							
								
								
									
										56
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										56
									
								
								main.go
									
									
									
									
									
								
							| @@ -13,27 +13,8 @@ import ( | ||||
| 	"github.com/caarlos0/ctrlc" | ||||
| 	"github.com/fatih/color" | ||||
|  | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipe" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline/archive" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline/artifactory" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline/before" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline/brew" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline/build" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline/changelog" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline/checksums" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline/defaults" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline/dist" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline/docker" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline/effectiveconfig" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline/env" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline/git" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline/nfpm" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline/put" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline/release" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline/s3" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline/scoop" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline/sign" | ||||
| 	"github.com/goreleaser/goreleaser/internal/pipeline/snapcraft" | ||||
| 	"github.com/goreleaser/goreleaser/pkg/config" | ||||
| 	"github.com/goreleaser/goreleaser/pkg/context" | ||||
| ) | ||||
| @@ -44,37 +25,6 @@ var ( | ||||
| 	date    = "unknown" | ||||
| ) | ||||
|  | ||||
| var pipes = []Piper{ | ||||
| 	defaults.Pipe{},        // load default configs | ||||
| 	before.Pipe{},          // run global hooks before build | ||||
| 	dist.Pipe{},            // ensure ./dist is clean | ||||
| 	git.Pipe{},             // get and validate git repo state | ||||
| 	effectiveconfig.Pipe{}, // writes the actual config (with defaults et al set) to dist | ||||
| 	changelog.Pipe{},       // builds the release changelog | ||||
| 	env.Pipe{},             // load and validate environment variables | ||||
| 	build.Pipe{},           // build | ||||
| 	archive.Pipe{},         // archive in tar.gz, zip or binary (which does no archiving at all) | ||||
| 	nfpm.Pipe{},            // archive via fpm (deb, rpm) using "native" go impl | ||||
| 	snapcraft.Pipe{},       // archive via snapcraft (snap) | ||||
| 	checksums.Pipe{},       // checksums of the files | ||||
| 	sign.Pipe{},            // sign artifacts | ||||
| 	docker.Pipe{},          // create and push docker images | ||||
| 	artifactory.Pipe{},     // push to artifactory | ||||
| 	put.Pipe{},             // upload to http server | ||||
| 	s3.Pipe{},              // push to s3/minio | ||||
| 	release.Pipe{},         // release to github | ||||
| 	brew.Pipe{},            // push to brew tap | ||||
| 	scoop.Pipe{},           // push to scoop bucket | ||||
| } | ||||
|  | ||||
| // Piper defines a pipe, which can be part of a pipeline (a serie of pipes). | ||||
| type Piper interface { | ||||
| 	fmt.Stringer | ||||
|  | ||||
| 	// Run the pipe | ||||
| 	Run(ctx *context.Context) error | ||||
| } | ||||
|  | ||||
| type releaseOptions struct { | ||||
| 	Config       string | ||||
| 	ReleaseNotes string | ||||
| @@ -184,7 +134,7 @@ func releaseProject(options releaseOptions) error { | ||||
| func doRelease(ctx *context.Context) error { | ||||
| 	defer func() { cli.Default.Padding = 3 }() | ||||
| 	var release = func() error { | ||||
| 		for _, pipe := range pipes { | ||||
| 		for _, pipe := range pipeline.Pipeline { | ||||
| 			cli.Default.Padding = 3 | ||||
| 			log.Infof(color.New(color.Bold).Sprint(strings.ToUpper(pipe.String()))) | ||||
| 			cli.Default.Padding = 6 | ||||
| @@ -201,7 +151,7 @@ func handle(err error) error { | ||||
| 	if err == nil { | ||||
| 		return nil | ||||
| 	} | ||||
| 	if pipeline.IsSkip(err) { | ||||
| 	if pipe.IsSkip(err) { | ||||
| 		log.WithField("reason", err.Error()).Warn("skipped") | ||||
| 		return nil | ||||
| 	} | ||||
|   | ||||
							
								
								
									
										1830
									
								
								www/static/deps.svg
									
									
									
									
									
								
							
							
						
						
									
										1830
									
								
								www/static/deps.svg
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 74 KiB | 
		Reference in New Issue
	
	Block a user