Skip to content

Commit c827491

Browse files
fix(build, imageSpec): invalidate cache (breaking changes)
Signed-off-by: Aleksei Igrychev <aleksei.igrychev@palark.com>
1 parent 73fcd70 commit c827491

File tree

1 file changed

+16
-25
lines changed

1 file changed

+16
-25
lines changed

Diff for: pkg/build/stage/image_spec.go

+16-25
Original file line numberDiff line numberDiff line change
@@ -111,44 +111,35 @@ func (s *ImageSpecStage) PrepareImage(ctx context.Context, _ Conveyor, _ contain
111111
return nil
112112
}
113113

114-
const imageSpecStageCacheVersion = "2"
115114

116115
func (s *ImageSpecStage) GetDependencies(_ context.Context, _ Conveyor, _ container_backend.ContainerBackend, _, _ *StageImage, _ container_backend.BuildContextArchiver) (string, error) {
117116
var args []string
118117

119-
args = append(args, imageSpecStageCacheVersion)
118+
// imageSpec
120119
args = append(args, s.imageSpec.Author)
121120
args = append(args, fmt.Sprint(s.imageSpec.ClearHistory))
122121

123-
args = append(args, fmt.Sprint(s.imageSpec.ClearWerfLabels))
124-
args = append(args, sortSliceWithNewSlice(s.imageSpec.RemoveLabels)...)
125-
args = append(args, sortSliceWithNewSlice(s.imageSpec.RemoveVolumes)...)
126-
args = append(args, sortSliceWithNewSlice(s.imageSpec.RemoveEnv)...)
127-
128-
args = append(args, sortSliceWithNewSlice(s.imageSpec.Volumes)...)
129-
args = append(args, mapToSortedArgs(s.imageSpec.Labels)...)
122+
// imageSpec.config
123+
args = append(args, strings.Join(s.imageSpec.Cmd, " "))
124+
args = append(args, strings.Join(s.imageSpec.Entrypoint, " "))
130125
args = append(args, mapToSortedArgs(s.imageSpec.Env)...)
131126
args = append(args, sortSliceWithNewSlice(s.imageSpec.Expose)...)
127+
args = append(args, fmt.Sprint(s.imageSpec.Healthcheck))
128+
args = append(args, mapToSortedArgs(s.imageSpec.Labels)...)
129+
args = append(args, s.imageSpec.StopSignal)
132130
args = append(args, s.imageSpec.User)
133-
args = append(args, strings.Join(s.imageSpec.Cmd, " "))
134-
args = append(args, fmt.Sprint(s.imageSpec.ClearCmd))
135-
args = append(args, strings.Join(s.imageSpec.Entrypoint, " "))
136-
args = append(args, fmt.Sprint(s.imageSpec.ClearEntrypoint))
131+
args = append(args, sortSliceWithNewSlice(s.imageSpec.Volumes)...)
137132
args = append(args, s.imageSpec.WorkingDir)
138-
args = append(args, s.imageSpec.StopSignal)
139-
args = append(args, fmt.Sprint(s.imageSpec.Healthcheck))
140133

141-
if s.imageSpec.ClearUser {
142-
args = append(args, fmt.Sprint(s.imageSpec.ClearUser))
143-
}
144-
145-
if s.imageSpec.ClearWorkingDir {
146-
args = append(args, fmt.Sprint(s.imageSpec.ClearWorkingDir))
147-
}
134+
args = append(args, sortSliceWithNewSlice(s.imageSpec.RemoveLabels)...)
135+
args = append(args, sortSliceWithNewSlice(s.imageSpec.RemoveVolumes)...)
136+
args = append(args, sortSliceWithNewSlice(s.imageSpec.RemoveEnv)...)
137+
args = append(args, fmt.Sprint(s.imageSpec.KeepEssentialWerfLabels))
148138

149-
if s.imageSpec.KeepEssentialWerfLabels {
150-
args = append(args, fmt.Sprint(s.imageSpec.KeepEssentialWerfLabels))
151-
}
139+
args = append(args, fmt.Sprint(s.imageSpec.ClearCmd))
140+
args = append(args, fmt.Sprint(s.imageSpec.ClearEntrypoint))
141+
args = append(args, fmt.Sprint(s.imageSpec.ClearUser))
142+
args = append(args, fmt.Sprint(s.imageSpec.ClearWorkingDir))
152143

153144
return util.Sha256Hash(args...), nil
154145
}

0 commit comments

Comments
 (0)