mirror of
https://github.com/goreleaser/goreleaser.git
synced 2024-12-31 01:53:50 +02:00
feat: add --skip-docker (#3176)
Allow to skip the entire docker images and manifests builds. Might be useful for faster local builds et al. closes #3144 Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
parent
f1c611b21b
commit
ae399220ef
@ -35,6 +35,7 @@ type releaseOpts struct {
|
||||
skipValidate bool
|
||||
skipAnnounce bool
|
||||
skipSBOMCataloging bool
|
||||
skipDocker bool
|
||||
rmDist bool
|
||||
deprecated bool
|
||||
parallelism int
|
||||
@ -74,6 +75,7 @@ func newReleaseCmd() *releaseCmd {
|
||||
cmd.Flags().BoolVar(&root.opts.skipAnnounce, "skip-announce", false, "Skips announcing releases (implies --skip-validate)")
|
||||
cmd.Flags().BoolVar(&root.opts.skipSign, "skip-sign", false, "Skips signing artifacts")
|
||||
cmd.Flags().BoolVar(&root.opts.skipSBOMCataloging, "skip-sbom", false, "Skips cataloging artifacts")
|
||||
cmd.Flags().BoolVar(&root.opts.skipDocker, "skip-docker", false, "Skips Docker Images/Manifests builds")
|
||||
cmd.Flags().BoolVar(&root.opts.skipValidate, "skip-validate", false, "Skips git checks")
|
||||
cmd.Flags().BoolVar(&root.opts.rmDist, "rm-dist", false, "Removes the dist folder")
|
||||
cmd.Flags().IntVarP(&root.opts.parallelism, "parallelism", "p", 0, "Amount tasks to run concurrently (default: number of CPUs)")
|
||||
@ -131,6 +133,7 @@ func setupReleaseContext(ctx *context.Context, options releaseOpts) *context.Con
|
||||
ctx.SkipValidate = ctx.Snapshot || options.skipValidate
|
||||
ctx.SkipSign = options.skipSign
|
||||
ctx.SkipSBOMCataloging = options.skipSBOMCataloging
|
||||
ctx.SkipDocker = options.skipDocker
|
||||
ctx.RmDist = options.rmDist
|
||||
|
||||
// test only
|
||||
|
@ -31,7 +31,7 @@ const (
|
||||
type Pipe struct{}
|
||||
|
||||
func (Pipe) String() string { return "docker images" }
|
||||
func (Pipe) Skip(ctx *context.Context) bool { return len(ctx.Config.Dockers) == 0 }
|
||||
func (Pipe) Skip(ctx *context.Context) bool { return len(ctx.Config.Dockers) == 0 || ctx.SkipDocker }
|
||||
|
||||
// Default sets the pipe defaults.
|
||||
func (Pipe) Default(ctx *context.Context) error {
|
||||
|
@ -1372,6 +1372,12 @@ func TestSkip(t *testing.T) {
|
||||
require.True(t, Pipe{}.Skip(context.New(config.Project{})))
|
||||
})
|
||||
|
||||
t.Run("skip docker", func(t *testing.T) {
|
||||
ctx := context.New(config.Project{})
|
||||
ctx.SkipDocker = true
|
||||
require.True(t, Pipe{}.Skip(ctx))
|
||||
})
|
||||
|
||||
t.Run("dont skip", func(t *testing.T) {
|
||||
ctx := context.New(config.Project{
|
||||
Dockers: []config.Docker{{}},
|
||||
@ -1385,6 +1391,12 @@ func TestSkip(t *testing.T) {
|
||||
require.True(t, ManifestPipe{}.Skip(context.New(config.Project{})))
|
||||
})
|
||||
|
||||
t.Run("skip docker", func(t *testing.T) {
|
||||
ctx := context.New(config.Project{})
|
||||
ctx.SkipDocker = true
|
||||
require.True(t, ManifestPipe{}.Skip(ctx))
|
||||
})
|
||||
|
||||
t.Run("dont skip", func(t *testing.T) {
|
||||
ctx := context.New(config.Project{
|
||||
DockerManifests: []config.DockerManifest{{}},
|
||||
|
@ -19,8 +19,10 @@ import (
|
||||
// allowing to publish multi-arch docker images.
|
||||
type ManifestPipe struct{}
|
||||
|
||||
func (ManifestPipe) String() string { return "docker manifests" }
|
||||
func (ManifestPipe) Skip(ctx *context.Context) bool { return len(ctx.Config.DockerManifests) == 0 }
|
||||
func (ManifestPipe) String() string { return "docker manifests" }
|
||||
func (ManifestPipe) Skip(ctx *context.Context) bool {
|
||||
return len(ctx.Config.DockerManifests) == 0 || ctx.SkipDocker
|
||||
}
|
||||
|
||||
// Default sets the pipe defaults.
|
||||
func (ManifestPipe) Default(ctx *context.Context) error {
|
||||
|
@ -95,6 +95,7 @@ type Context struct {
|
||||
SkipSign bool
|
||||
SkipValidate bool
|
||||
SkipSBOMCataloging bool
|
||||
SkipDocker bool
|
||||
RmDist bool
|
||||
PreRelease bool
|
||||
Deprecated bool
|
||||
|
Loading…
Reference in New Issue
Block a user