Skip to content

Commit

Permalink
fix(final-repo): service values .Values.werf.repo should use --final-…
Browse files Browse the repository at this point in the history
…repo instead of --repo

Signed-off-by: Timofey Kirillov <timofey.kirillov@flant.com>
  • Loading branch information
distorhead committed Jun 14, 2022
1 parent 79810cc commit e0562f6
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 13 deletions.
6 changes: 3 additions & 3 deletions cmd/werf/bundle/export/export.go
Expand Up @@ -224,7 +224,7 @@ func runExport(ctx context.Context) error {
logboek.LogOptionalLn()

var imagesInfoGetters []*image.InfoGetter
var imagesRepository string
var imagesRepo string

if len(werfConfig.StapelImages) != 0 || len(werfConfig.ImagesFromDockerfile) != 0 {
stagesStorage, err := common.GetStagesStorage(containerBackend, &commonCmdData)
Expand Down Expand Up @@ -258,7 +258,7 @@ func runExport(ctx context.Context) error {

storageManager := manager.NewStorageManager(projectName, stagesStorage, finalStagesStorage, secondaryStagesStorageList, cacheStagesStorageList, storageLockManager)

imagesRepository = storageManager.GetStagesStorage().String()
imagesRepo = storageManager.GetServiceValuesRepo()

conveyorOptions, err := common.GetConveyorOptionsWithParallel(&commonCmdData, buildOptions)
if err != nil {
Expand Down Expand Up @@ -322,7 +322,7 @@ func runExport(ctx context.Context) error {
return fmt.Errorf("getting HEAD commit time failed: %w", err)
}

if vals, err := helpers.GetServiceValues(ctx, werfConfig.Meta.Project, imagesRepository, imagesInfoGetters, helpers.ServiceValuesOptions{
if vals, err := helpers.GetServiceValues(ctx, werfConfig.Meta.Project, imagesRepo, imagesInfoGetters, helpers.ServiceValuesOptions{
Env: *commonCmdData.Environment,
CommitHash: headHash,
CommitDate: headTime,
Expand Down
6 changes: 3 additions & 3 deletions cmd/werf/bundle/publish/publish.go
Expand Up @@ -250,7 +250,7 @@ func runPublish(ctx context.Context) error {
}

var imagesInfoGetters []*image.InfoGetter
var imagesRepository string
var imagesRepo string

if len(werfConfig.StapelImages) != 0 || len(werfConfig.ImagesFromDockerfile) != 0 {
stagesStorage, err := common.GetStagesStorage(containerBackend, &commonCmdData)
Expand Down Expand Up @@ -284,7 +284,7 @@ func runPublish(ctx context.Context) error {

storageManager := manager.NewStorageManager(projectName, stagesStorage, finalStagesStorage, secondaryStagesStorageList, cacheStagesStorageList, storageLockManager)

imagesRepository = storageManager.StagesStorage.String()
imagesRepo = storageManager.GetServiceValuesRepo()

conveyorOptions, err := common.GetConveyorOptionsWithParallel(&commonCmdData, buildOptions)
if err != nil {
Expand Down Expand Up @@ -353,7 +353,7 @@ func runPublish(ctx context.Context) error {
return fmt.Errorf("getting HEAD commit time failed: %w", err)
}

if vals, err := helpers.GetServiceValues(ctx, werfConfig.Meta.Project, imagesRepository, imagesInfoGetters, helpers.ServiceValuesOptions{
if vals, err := helpers.GetServiceValues(ctx, werfConfig.Meta.Project, imagesRepo, imagesInfoGetters, helpers.ServiceValuesOptions{
Env: *commonCmdData.Environment,
CommitHash: headHash,
CommitDate: headTime,
Expand Down
6 changes: 3 additions & 3 deletions cmd/werf/converge/converge.go
Expand Up @@ -270,7 +270,7 @@ func run(ctx context.Context, containerBackend container_backend.ContainerBacken
}

var imagesInfoGetters []*image.InfoGetter
var imagesRepository string
var imagesRepo string
if len(werfConfig.StapelImages) != 0 || len(werfConfig.ImagesFromDockerfile) != 0 {
stagesStorage, err := common.GetStagesStorage(containerBackend, &commonCmdData)
if err != nil {
Expand Down Expand Up @@ -304,7 +304,7 @@ func run(ctx context.Context, containerBackend container_backend.ContainerBacken

storageManager := manager.NewStorageManager(projectName, stagesStorage, finalStagesStorage, secondaryStagesStorageList, cacheStagesStorageList, storageLockManager)

imagesRepository = storageManager.StagesStorage.String()
imagesRepo = storageManager.GetServiceValuesRepo()

conveyorOptions, err := common.GetConveyorOptionsWithParallel(&commonCmdData, buildOptions)
if err != nil {
Expand Down Expand Up @@ -404,7 +404,7 @@ func run(ctx context.Context, containerBackend container_backend.ContainerBacken
return fmt.Errorf("getting HEAD commit time failed: %w", err)
}

if vals, err := helpers.GetServiceValues(ctx, werfConfig.Meta.Project, imagesRepository, imagesInfoGetters, helpers.ServiceValuesOptions{
if vals, err := helpers.GetServiceValues(ctx, werfConfig.Meta.Project, imagesRepo, imagesInfoGetters, helpers.ServiceValuesOptions{
Namespace: namespace,
Env: *commonCmdData.Environment,
SetDockerConfigJsonValue: *commonCmdData.SetDockerConfigJsonValue,
Expand Down
8 changes: 4 additions & 4 deletions cmd/werf/render/render.go
Expand Up @@ -247,7 +247,7 @@ func runRender(ctx context.Context) error {
logboek.LogOptionalLn()

var imagesInfoGetters []*image.InfoGetter
var imagesRepository string
var imagesRepo string
var isStub bool
var stubImagesNames []string

Expand Down Expand Up @@ -293,7 +293,7 @@ func runRender(ctx context.Context) error {

storageManager := manager.NewStorageManager(projectName, stagesStorage, finalStagesStorage, secondaryStagesStorageList, cacheStagesStorageList, storageLockManager)

imagesRepository = storageManager.StagesStorage.String()
imagesRepo = storageManager.GetServiceValuesRepo()

conveyorOptions, err := common.GetConveyorOptionsWithParallel(&commonCmdData, buildOptions)
if err != nil {
Expand Down Expand Up @@ -328,7 +328,7 @@ func runRender(ctx context.Context) error {

logboek.LogOptionalLn()
} else {
imagesRepository = "REPO"
imagesRepo = "REPO"
isStub = true

for _, img := range werfConfig.StapelImages {
Expand Down Expand Up @@ -371,7 +371,7 @@ func runRender(ctx context.Context) error {
return fmt.Errorf("getting HEAD commit time failed: %w", err)
}

if vals, err := helpers.GetServiceValues(ctx, werfConfig.Meta.Project, imagesRepository, imagesInfoGetters, helpers.ServiceValuesOptions{
if vals, err := helpers.GetServiceValues(ctx, werfConfig.Meta.Project, imagesRepo, imagesInfoGetters, helpers.ServiceValuesOptions{
Namespace: namespace,
Env: *commonCmdData.Environment,
IsStub: isStub,
Expand Down
7 changes: 7 additions & 0 deletions pkg/storage/manager/storage_manager.go
Expand Up @@ -176,6 +176,13 @@ func (m *StorageManager) GetSecondaryStagesStorageList() []storage.StagesStorage
return m.SecondaryStagesStorageList
}

func (m *StorageManager) GetServiceValuesRepo() string {
if m.FinalStagesStorage != nil {
return m.FinalStagesStorage.String()
}
return m.StagesStorage.String()
}

func (m *StorageManager) GetImageInfoGetter(imageName string, stg stage.Interface, opts image.InfoGetterOptions) *image.InfoGetter {
stageID := stg.GetStageImage().Image.GetStageDescription().StageID
info := stg.GetStageImage().Image.GetStageDescription().Info
Expand Down

0 comments on commit e0562f6

Please sign in to comment.