Skip to content

Commit

Permalink
feat: adding --tag in the bsf oci command
Browse files Browse the repository at this point in the history
Signed-off-by: hanshal101 <[email protected]>
  • Loading branch information
hanshal101 authored and hanshal101 committed Jul 5, 2024
1 parent 0cb31b1 commit d9cf443
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cmd/oci/oci.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
)

var (
platform, output string
platform, output, tag string
push, loadDocker, loadPodman, devDeps bool
)
var (
Expand All @@ -32,6 +32,7 @@ var (
func init() {
OCICmd.Flags().StringVarP(&platform, "platform", "p", "", "The platform to build the image for")
OCICmd.Flags().StringVarP(&output, "output", "o", "", "location of the build artifacts generated")
OCICmd.Flags().StringVarP(&tag, "tag", "t", "", "Tag")
OCICmd.Flags().BoolVarP(&loadDocker, "load-docker", "", false, "Load the image into docker daemon")
OCICmd.Flags().BoolVarP(&loadPodman, "load-podman", "", false, "Load the image into podman")
OCICmd.Flags().BoolVarP(&push, "push", "", false, "Push the image to the registry")
Expand Down Expand Up @@ -91,7 +92,12 @@ var OCICmd = &cobra.Command{

symlink := "/result"

err = nixcmd.Build(output+symlink, genOCIAttrName(artifact.Artifact, platform, artifact))
buildOutputPath := output + symlink
if tag != "" {
buildOutputPath = fmt.Sprintf("%s:%s", buildOutputPath, tag)
}

err = nixcmd.Build(buildOutputPath, genOCIAttrName(artifact.Artifact, platform, artifact))
if err != nil {
fmt.Println(styles.ErrorStyle.Render("error: ", err.Error()))
os.Exit(1)
Expand Down

0 comments on commit d9cf443

Please sign in to comment.