Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
feat(build): add report Image.NAME.Rebuilt field
Signed-off-by: Timofey Kirillov <timofey.kirillov@flant.com>
  • Loading branch information
distorhead committed Aug 4, 2022
1 parent 9e4a1c4 commit be6fba7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/build/build_phase.go
Expand Up @@ -150,6 +150,7 @@ type ReportImageRecord struct {
DockerImageID string
DockerImageDigest string
DockerImageName string
Rebuilt bool
}

func (phase *BuildPhase) Name() string {
Expand Down Expand Up @@ -181,6 +182,7 @@ func (phase *BuildPhase) createReport(ctx context.Context) error {
DockerImageID: desc.Info.ID,
DockerImageDigest: desc.Info.RepoDigest,
DockerImageName: desc.Info.Name,
Rebuilt: img.GetRebuilt(),
})
}

Expand Down Expand Up @@ -818,6 +820,8 @@ func (phase *BuildPhase) atomicBuildStageImage(ctx context.Context, img *Image,
stageImage.Image.SetStageDescription(desc)
}

img.SetRebuilt(true)

return nil
}); err != nil {
return err
Expand Down
9 changes: 9 additions & 0 deletions pkg/build/image.go
Expand Up @@ -35,6 +35,7 @@ type Image struct {
contentDigest string
isArtifact bool
isDockerfileImage bool
rebuilt bool

baseImageType BaseImageType
stageAsBaseImage stage.Interface
Expand Down Expand Up @@ -122,6 +123,14 @@ func (i *Image) GetLogName() string {
return i.LogName()
}

func (i *Image) SetRebuilt(rebuilt bool) {
i.rebuilt = rebuilt
}

func (i *Image) GetRebuilt() bool {
return i.rebuilt
}

func (i *Image) SetupBaseImage(c *Conveyor) {
if i.baseImageImageName != "" {
i.baseImageType = StageAsBaseImage
Expand Down

0 comments on commit be6fba7

Please sign in to comment.