func (Interceptor) DockerBuild(ctx context.Context) error {
	image, err := build.GetImageName(INTERCEPTOR_IMAGE_ENV_VAR)
	if err != nil {
		return err
	}
	return build.DockerBuild(image, "interceptor/Dockerfile", ".")
}
DockerBuild builds the interceptor docker image. It looks for the
KEDAHTTP_INTERCEPTOR_IMAGE environment variable and builds the image with
that as the name
package main
import (
	"context"
	"fmt"
	"github.com/kedacore/http-add-on/pkg/build"
	"github.com/kedacore/http-add-on/pkg/env"
	"github.com/magefile/mage/mg"
	"github.com/magefile/mage/sh"
)
const (
	DEFAULT_NAMESPACE string = "kedahttp"
	ACR_REGISTRY_NAME         = "KEDAHTTP_ACR_REGISTRY"
	SCALER_IMAGE_ENV_VAR      = "KEDAHTTP_SCALER_IMAGE"
	INTERCEPTOR_IMAGE_ENV_VAR = "KEDAHTTP_INTERCEPTOR_IMAGE"
	OPERATOR_IMAGE_ENV_VAR    = "KEDAHTTP_OPERATOR_IMAGE"
	NAMESPACE_ENV_VAR         = "KEDAHTTP_NAMESPACE"
)
var goBuild = sh.OutCmd("go", "build", "-o")
type Scaler mg.Namespace
func (Scaler) Build(ctx context.Context) error {
	fmt.Println("Running scaler binary build")
	out, err := goBuild("bin/scaler", "./scaler")
	if err != nil {
		return err
	}
	fmt.Println("Finished building scaler")
	fmt.Println("Command Output: ", out)
	return nil
}
func (Scaler) Test(ctx context.Context) error {
	fmt.Println("Running scaler tests")
	testOutput, err := sh.Output("go", "test", "./scaler/...")
	fmt.Println(testOutput)
	if err != nil {
		return err
	}
	return nil
}
func (Scaler) DockerBuild(ctx context.Context) error {
	img, err := build.GetImageName(SCALER_IMAGE_ENV_VAR)
	if err != nil {
		return err
	}
	return build.DockerBuild(img, "scaler/Dockerfile", ".")
}
func (Scaler) DockerBuildACR(ctx context.Context) error {
	registry, err := env.Get(ACR_REGISTRY_NAME)
	if err != nil {
		return err
	}
	image, err := build.GetImageName(SCALER_IMAGE_ENV_VAR)
	if err != nil {
		return err
	}
	return build.DockerBuildACR(registry, image, "scaler/Dockerfile", ".")
}
func (Scaler) DockerPush(ctx context.Context) error {
	image, err := build.GetImageName(SCALER_IMAGE_ENV_VAR)
	if err != nil {
		return err
	}
	return build.DockerPush(image)
}
type Operator mg.Namespace
func (Operator) Build(ctx context.Context) error {
	fmt.Println("Running operator binary build")
	out, err := goBuild("bin/operator", "./operator")
	if err != nil {
		return err
	}
	fmt.Println("Finished building operator")
	fmt.Println("Command Output: ", out)
	return nil
}
func (Operator) Test(ctx context.Context) error {
	fmt.Println("Running operator tests")
	testOutput, err := sh.Output("go", "test", "./operator/...")
	if err != nil {
		return err
	}
	fmt.Println(testOutput)
	return nil
}
func (Operator) DockerBuild(ctx context.Context) error {
	img, err := build.GetImageName(OPERATOR_IMAGE_ENV_VAR)
	if err != nil {
		return err
	}
	return build.DockerBuild(img, "operator/Dockerfile", ".")
}
func (Operator) DockerBuildACR(ctx context.Context) error {
	registry, err := env.Get(ACR_REGISTRY_NAME)
	if err != nil {
		return err
	}
	image, err := build.GetImageName(OPERATOR_IMAGE_ENV_VAR)
	if err != nil {
		return err
	}
	return build.DockerBuildACR(registry, image, "operator/Dockerfile", ".")
}
func (Operator) DockerPush(ctx context.Context) error {
	image, err := build.GetImageName(OPERATOR_IMAGE_ENV_VAR)
	if err != nil {
		return err
	}
	return build.DockerPush(image)
}
type Interceptor mg.Namespace
func (Interceptor) Build(ctx context.Context) error {
	fmt.Println("Running interceptor binary build")
	out, err := goBuild("bin/interceptor", "./interceptor")
	if err != nil {
		return err
	}
	fmt.Println("Finished building interceptor")
	fmt.Println("Command Output: ", out)
	return nil
}
func (Interceptor) Test(ctx context.Context) error {
	fmt.Println("Running interceptor tests")
	testOutput, err := sh.Output("go", "test", "./interceptor/...")
	if err != nil {
		return err
	}
	fmt.Println(testOutput)
	return nil
}