How to get image SHA256 in custom helm chart

I deploy my web application using Auto DevOps pipeline to kubernetes cluster. I utilize a custom helm chart. I have problem with 2 scenarios

  1. When ImagePullPolicy: Always:
    In this case the application get deployed on the kubernetes cluster, runs successfully. But, it gives ImagePullBackoff error when the pod restart. The pod is not able to pull docker image from gitlab container registry.
  2. Where ImagePullPolicy: IfNotPresent:
    In this case, the pod doesn’t get upgraded even if there is a new image in build stage.
    Currently, the image tag I have set to latest. From the stackoverflow I got a suggestion that I could use build image sha256 as tag. I think it will solve my problem.

I have two questions.

  1. Why the pod gives ImagepullBackoff error if the dockerjson certificate present on the kubernetes cluster?
  2. Why the helm chart doesn’t upgrade the pod when ImagePullPolicy is set to IfNotPresent?
  3. how can I get image sha256 in custom helm chart?