Implement checksum computation for sha256 tagger (fix issue #2290)#2301
Implement checksum computation for sha256 tagger (fix issue #2290)#2301seblegall wants to merge 1 commit intoGoogleContainerTools:masterfrom
Conversation
459ac56 to
644f604
Compare
Codecov Report
|
644f604 to
43ffe9d
Compare
|
@seblegall thanks for taking a stab at this one! looks like some of your tests are failing, can you take a look? |
|
I don’t think there’s an issue to be fixed here. I’ll try to elaborate tomorrow when I have more time! |
|
@nkubala Yes, I'm on it. Seems I have troubles with the temp file creation tools. I'm not sure why it fails but will have a look. @dgageot I'm not sure it works. From what I can see, here is what appends : func doDev(ctx context.Context, out io.Writer) error {
//...
default:
r, config, err := newRunner(opts)
if err != nil {
return errors.Wrap(err, "creating runner")
}
err = r.Dev(ctx, out, config.Build.Artifacts)Then.. // First run
if err := r.buildTestDeploy(ctx, out, artifacts); err != nil {and finally.. // imageTags generates tags for a list of artifacts
func (r *SkaffoldRunner) imageTags(ctx context.Context, out io.Writer, artifacts []*latest.Artifact) (tag.ImageTags, error) {
//...
for i := range artifacts {
tagErrs[i] = make(chan tagErr, 1)
i := i
go func() {
tag, err := r.Tagger.GenerateFullyQualifiedImageName(artifacts[i].Workspace, artifacts[i].ImageName)
tagErrs[i] <- tagErr{tag: tag, err: err}
}()
}So, In my understanding, if the image name doesn't already contains a tag, there is no reason one is added anywhere else. |
43ffe9d to
8e1fffc
Compare
|
Oh, and now that I just get more familiar with integration test, I found out that : https://github.com/GoogleContainerTools/skaffold/blob/master/integration/build_test.go#L65 Which seems to prouve expected tag for sha256 is always |
8e1fffc to
d099ab4
Compare
…a256 tagger Instead of returning a "latest" tag by default the tagger will now return a checksum based on the sha256 of the working dir. The function walk across all files and directories of the working dir, sum the sha256 of each and compute a checksum of the resulting sum. Errors on some files only are ignored. If the directory cannot be walk at all, then the default tag is latest.
d099ab4 to
5245cbe
Compare
|
@nkubala tests are now ok. It was a little tricky to make them fully reproducible. Let met know if you have any though about this PR. (logic, tests, etc..). 😃 |
|
hey @seblegall, thanks for all the work you put in on this! after some discussion on #2290, I think we've decided to abandon the |
fix #2290
Instead of returning a
latesttag by default the tagger will nowreturn a checksum based on the sha256 of the working dir.
The function walk across all files and directories of the working dir,
sum the sha256 of each and compute a checksum of the resulting sum.
Errors on some files only are ignored. If the directory cannot be walk
at all, then the default tag is
latest.