@@ -28,6 +28,7 @@ var ciImageBuildCmd = &cobra.Command{
2828 branchName , _ := cmd .Flags ().GetString ("branchname" )
2929 imageIdentifier , _ := cmd .Flags ().GetString ("image-identifier" )
3030 imageTag , _ := cmd .Flags ().GetString ("image-tag" )
31+ imageTagPrefix , _ := cmd .Flags ().GetString ("image-tag-prefix" )
3132 dockerfile , _ := cmd .Flags ().GetString ("dockerfile" )
3233 reuseExisting , _ := cmd .Flags ().GetBool ("image-reuse" )
3334 buildPath , _ := cmd .Flags ().GetString ("build-path" )
@@ -85,6 +86,11 @@ var ciImageBuildCmd = &cobra.Command{
8586 // Unless golang calculates checksum itself, passing plain output uses just too much memory.
8687 imageTag = string (fileListing )
8788
89+ // Add prefix if it is specified
90+ if len (imageTagPrefix ) > 0 {
91+ imageTag = imageTagPrefix + string ('-' ) + imageTag
92+ }
93+
8894 // Calculate hash sum
8995 // sha1_hash := fmt.Sprintf("%x", sha1.Sum([]byte(fileListing)))
9096 // imageTag = sha1_hash[0:40]
@@ -236,6 +242,7 @@ func init() {
236242 ciImageBuildCmd .Flags ().String ("branchname" , "" , "Branch name (used as an extra tag for image identification)" )
237243 ciImageBuildCmd .Flags ().String ("image-identifier" , "" , "Docker image identifier (i.e. \" php\" )" )
238244 ciImageBuildCmd .Flags ().String ("image-tag" , "" , "Docker image tag (optional, check '--image-reuse' flag)" )
245+ ciImageBuildCmd .Flags ().String ("image-tag-prefix" , "" , "Prefix for Docker image tag (optional)" )
239246 ciImageBuildCmd .Flags ().String ("dockerfile" , "" , "Dockerfile (relative path)" )
240247 ciImageBuildCmd .Flags ().String ("build-path" , "" , "Docker image build path" )
241248 ciImageBuildCmd .Flags ().Bool ("image-reuse" , true , "Do not rebuild image if identical image:tag exists in remote" )
0 commit comments