Skip to content

Commit 6c40030

Browse files
committed
feat: add image data type
1 parent a67e84d commit 6c40030

2 files changed

Lines changed: 31 additions & 8 deletions

File tree

pkg/common/env_type.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ func NewEnvironmentType(s string) (EnvironmentType, error) {
3737
panic(fmt.Sprintf("EnvironmentType not implemented. '%s'", s))
3838
}
3939

40+
// GetEnvTypes returns all env types.
41+
func GetEnvTypes() []EnvironmentType {
42+
return []EnvironmentType{
43+
EnvironmentDev,
44+
EnvironmentTesting,
45+
EnvironmentStaging,
46+
EnvironmentProd,
47+
}
48+
}
49+
4050
// GetEnvTypesHelp reports some help string for env. types.
4151
func GetEnvTypesHelp() string {
4252
return fmt.Sprintf(

pkg/image/image-type.go

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,15 @@ type Type int
99

1010
const (
1111
// If you change this here -> adjust the `New*` functions.
12-
ImageService Type = 0 // A service migration image.
13-
ImageDBMigration Type = 1 // A DB migration image.
14-
ImageBundle Type = 2 // A manifest bundle from `imgpkg` or similar.
15-
ImageServiceName = "service"
16-
ImageDBMigrationName = "dbmigration"
17-
ImageBundleName = "bundle"
12+
ImageService Type = 0 // A service image.
13+
ImageDBMigration Type = 1 // A DB migration image.
14+
ImageBundle Type = 2 // A manifest bundle from `imgpkg` or similar.
15+
ImageData Type = 3 // A data image with only files.
16+
17+
ImageServiceName = "service"
18+
ImageDBMigrationName = "dbmigration"
19+
ImageBundleName = "bundle"
20+
ImageDataName = "data"
1821
)
1922

2023
func NewType(s string) (Type, error) {
@@ -25,19 +28,27 @@ func NewType(s string) (Type, error) {
2528
return ImageDBMigration, nil
2629
case ImageBundleName:
2730
return ImageBundle, nil
31+
case ImageDataName:
32+
return ImageData, nil
2833
}
2934

3035
return 0, fmt.Errorf("wrong build type '%s'", s)
3136
}
3237

3338
// GetImageTypesHelp reports some help string for image types.
3439
func GetImageTypesHelp() string {
35-
return fmt.Sprintf("[%s, %s, %s]", ImageServiceName, ImageDBMigrationName, ImageBundle)
40+
return fmt.Sprintf(
41+
"[%s, %s, %s, %s]",
42+
ImageServiceName,
43+
ImageDBMigrationName,
44+
ImageBundle,
45+
ImageData,
46+
)
3647
}
3748

3849
// GetAllImageTypes returns all possible image types.
3950
func GetAllImageTypes() []Type {
40-
return []Type{ImageService, ImageDBMigration, ImageBundle}
51+
return []Type{ImageService, ImageDBMigration, ImageBundle, ImageData}
4152
}
4253

4354
// String implements the interface [pflags.Value].
@@ -49,6 +60,8 @@ func (v Type) String() string {
4960
return ImageDBMigrationName
5061
case ImageBundle:
5162
return ImageBundleName
63+
case ImageData:
64+
return ImageDataName
5265
}
5366

5467
panic("Not implemented.")

0 commit comments

Comments
 (0)