func (p *Plugin) Validate() error {
	p.settings.Build.Name = "00000000"
	if p.pipeline.Commit.SHA != "" {
		p.settings.Build.Name = p.pipeline.Commit.SHA
	}

	p.settings.Build.Branch = p.pipeline.Repo.Branch
	p.settings.Build.Ref = p.pipeline.Commit.Ref
	p.settings.Daemon.Registry = p.settings.Login.Registry

	if p.settings.Build.TagsAuto {
		// return true if tag event or default branch
		if UseDefaultTag(
			p.settings.Build.Ref,
			p.settings.Build.Branch,
		) {
			tag, err := DefaultTagSuffix(
				p.settings.Build.Ref,
				p.settings.Build.TagsSuffix,
			)
			if err != nil {
				logrus.Printf("cannot build docker image for %s, invalid semantic version", p.settings.Build.Ref)
				return err
			}
			p.settings.Build.Tags = *cli.NewStringSlice(tag...)
		} else {
			logrus.Printf("skipping automated docker build for %s", p.settings.Build.Ref)
			return nil
		}
	}

	return nil
}
// Validate handles the settings validation of the plugin.
Validate handles the settings validation of the plugin.
// Validate handles the settings validation of the plugin .
func (p *Plugin) Validate() error {
	p.settings.Build.Name = "00000000"
	if p.pipeline.Commit.SHA != "" {
		p.settings.Build.Name = p.pipeline.Commit.SHA
	}
	p.settings.Build.Branch = p.pipeline.Repo.Branch
	p.settings.Build.Ref = p.pipeline.Commit.Ref
	p.settings.Daemon.Registry = p.settings.Login.Registry
	if p.settings.Build.TagsAuto {
		if UseDefaultTag(
			p.settings.Build.Ref,
			p.settings.Build.Branch,
		) {
			tag, err := DefaultTagSuffix(
				p.settings.Build.Ref,
				p.settings.Build.TagsSuffix,
			)
			if err != nil {
				logrus.Printf("cannot build docker image for %s, invalid semantic version", p.settings.Build.Ref)
				return err
			}
			p.settings.Build.Tags = *cli.NewStringSlice(tag...)
		} else {
			logrus.Printf("skipping automated docker build for %s", p.settings.Build.Ref)
			return nil
		}
	}
	return nil
}
func ( p * Plugin ) Validate ( ) error { p . settings . Build . Name = " " if p . pipeline . Commit . SHA != " " { p . settings . Build . Name = p . pipeline . Commit . SHA } p . settings . Build . Branch = p . pipeline . Repo . Branch p . settings . Build . Ref = p . pipeline . Commit . Ref p . settings . Daemon . Registry = p . settings . Login . Registry if p . settings . Build . TagsAuto { if UseDefaultTag ( p . settings . Build . Ref , p . settings . Build . Branch , ) { tag , err := DefaultTagSuffix ( p . settings . Build . Ref , p . settings . Build . TagsSuffix , ) if err != nil { logrus . Printf ( " " , p . settings . Build . Ref ) return err } p . settings . Build . Tags = * cli . NewStringSlice ( tag ... ) } else { logrus . Printf ( " " , p . settings . Build . Ref ) return nil } } return nil }
Validate handles the settings validation of the plugin.
Validate handles the settings validation of the plugin .
// return true if tag event or default branch