Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image digest is used for image ID #36

Closed
nabuskey opened this issue Oct 18, 2023 · 2 comments
Closed

Image digest is used for image ID #36

nabuskey opened this issue Oct 18, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@nabuskey
Copy link
Collaborator

The image ID field is filled with image digest, not image ID.

regImgId, err := apps.PushImage(ctx, dockerClient, imageTag)
if err != nil {
return ctrl.Result{}, err
}
if regImgId == nil {
return ctrl.Result{}, fmt.Errorf("failed to get registry image id after push")
}
resource.Status.ImageID = *regImgId

PushImage returns:

di, err := client.DistributionInspect(ctx, tag, authConfig)
if err != nil {
return nil, err
}
regImgId := di.Descriptor.Digest.String()
log.Info("Image Pushed", "digest", regImgId)
return &regImgId, nil

Because digest is passed to Docker client, the test fails.

_, err = dockerClient.ImageRemove(ctx, resource.Status.ImageID, types.ImageRemoveOptions{})

Did we meant to return the digest instead of id in this?

func PushImage(ctx context.Context, client *dockerClient.Client, tag string) (*string, error) {

@nabuskey nabuskey added the bug Something isn't working label Oct 18, 2023
@nabuskey nabuskey mentioned this issue Oct 17, 2023
@nimakaviani
Copy link
Contributor

I think we should populate GitServerStatus to keep both the imageId and the imageDigest. the data will come in handy later on

@nimakaviani
Copy link
Contributor

well actually thinking about it more and looking at the code, the image ID is rather fixed, knowing the GitResource. for the test to pass, we just need to make sure the reference contains both the id and its SHA256. I will send a fix for this.

@nimakaviani nimakaviani added this to the v0.2 release milestone Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants