// Tag and push final Docker image for the service defined by `app`
// after the e2e tests pass.
//
// It requires Config as an argument because published images require a lot of metadata.
Tag and push final Docker image for the service defined by `app`
after the e2e tests pass.

It requires Config as an argument because published images require a lot of metadata.
// Tag and push final Docker image for the service defined by ` app ` // after the e2e tests pass . // // It requires Config as an argument because published images require a lot of metadata .
func publishFinalDockerImage(c Config, app string, insiders bool) Operation {
	return func(pipeline *bk.Pipeline) {
		image := strings.ReplaceAll(app, "/", "-")
		devImage := fmt.Sprintf("%s/%s", images.SourcegraphDockerDevRegistry, image)
		publishImage := fmt.Sprintf("%s/%s", images.SourcegraphDockerPublishRegistry, image)
		var images []string
		for _, image := range []string{publishImage, devImage} {
			if app != "server" || c.RunType.Is(TaggedRelease, ImagePatch, ImagePatchNoTest) {
				images = append(images, fmt.Sprintf("%s:%s", image, c.Version))
			}
			if app == "server" && c.RunType.Is(ReleaseBranch) {
				images = append(images, fmt.Sprintf("%s:%s-insiders", image, c.Branch))
			}
			if insiders {
				images = append(images, fmt.Sprintf("%s:insiders", image))
			}
		}
		for _, tag := range []string{
			c.Version,
			c.Commit,
			c.shortCommit(),
			fmt.Sprintf("%s_%s_%d", c.shortCommit(), c.Time.Format("2006-01-02"), c.BuildNumber),
			fmt.Sprintf("%s_%d", c.shortCommit(), c.BuildNumber),
			fmt.Sprintf("%s_%d", c.Commit, c.BuildNumber),
			strconv.Itoa(c.BuildNumber),
		} {
			internalImage := fmt.Sprintf("%s:%s", devImage, tag)
			images = append(images, internalImage)
		}
		candidateImage := fmt.Sprintf("%s:%s", devImage, c.candidateImageTag())
		cmd := fmt.Sprintf("./dev/ci/docker-publish.sh %s %s", candidateImage, strings.Join(images, " "))
		pipeline.AddStep(fmt.Sprintf(":docker: :white_check_mark: %s", app), bk.Cmd(cmd))
	}
}
func publishFinalDockerImage ( c Config , app string , insiders bool ) Operation { return func ( pipeline * bk . Pipeline ) { image := strings . ReplaceAll ( app , " " , " " ) devImage := fmt . Sprintf ( " " , images . SourcegraphDockerDevRegistry , image ) publishImage := fmt . Sprintf ( " " , images . SourcegraphDockerPublishRegistry , image ) var images [ ] string for _ , image := range [ ] string { publishImage , devImage } { if app != " " || c . RunType . Is ( TaggedRelease , ImagePatch , ImagePatchNoTest ) { images = append ( images , fmt . Sprintf ( " " , image , c . Version ) ) } if app == " " && c . RunType . Is ( ReleaseBranch ) { images = append ( images , fmt . Sprintf ( " " , image , c . Branch ) ) } if insiders { images = append ( images , fmt . Sprintf ( " " , image ) ) } } for _ , tag := range [ ] string { c . Version , c . Commit , c . shortCommit ( ) , fmt . Sprintf ( " " , c . shortCommit ( ) , c . Time . Format ( " " ) , c . BuildNumber ) , fmt . Sprintf ( " " , c . shortCommit ( ) , c . BuildNumber ) , fmt . Sprintf ( " " , c . Commit , c . BuildNumber ) , strconv . Itoa ( c . BuildNumber ) , } { internalImage := fmt . Sprintf ( " " , devImage , tag ) images = append ( images , internalImage ) } candidateImage := fmt . Sprintf ( " " , devImage , c . candidateImageTag ( ) ) cmd := fmt . Sprintf ( " " , candidateImage , strings . Join ( images , " " ) ) pipeline . AddStep ( fmt . Sprintf ( " " , app ) , bk . Cmd ( cmd ) ) } }
Tag and push final Docker image for the service defined by `app`
after the e2e tests pass.
Tag and push final Docker image for the service defined by ` app ` after the e2e tests pass .
// these tags are pushed to our dev registry, and are only // used internally