operator icon indicating copy to clipboard operation
operator copied to clipboard

failed to create state file when provided

Open VinozzZ opened this issue 3 years ago • 2 comments

I'm getting the following error when trying to use a porter bundle that has "state" provided in the manifest when running in the operator: could not create a new gzip reader for the statefile: unexpected EOF This is when using "state" to store off terraform tfstate files ex:

state:
  - name: tfstate
    path: terraform/terraform.tfstate
  - name: tfvars
    path: terraform/terraform.tfvars.json

This works when setting the tfstate file as a bundle output and using it that way. Running this on beta.2 in the operator

originally reported by @sgettys

VinozzZ avatar Aug 16 '22 17:08 VinozzZ

Looks like how k8s mounts the /porter/state.tgz file there needs to be a check for the unexpected EOF. The state file will exist but be empty. Adding in fix and testing this now

sgettys avatar Aug 16 '22 18:08 sgettys

After some investigation from @sgettys , the problem is related to https://github.com/cnabio/cnab-go/issues/266. the k8s driver writes "null" file onto the volume that's used by invocation image which causes unexpectedEOF error. https://github.com/cnabio/cnab-go/blob/main/driver/kubernetes/kubernetes.go#L426 The reason why this is working with porter CLI is because docker-driver treats all files as tars. https://github.com/cnabio/cnab-go/blob/main/driver/docker/docker.go#L440

VinozzZ avatar Aug 18 '22 20:08 VinozzZ

The workaround fix in porter is completes: https://github.com/getporter/porter/issues/2307

VinozzZ avatar Dec 21 '22 17:12 VinozzZ

Can we close this issue or is there still something else that needs to happen?

carolynvs avatar Jan 12 '23 21:01 carolynvs

This should be complete

sgettys avatar Jan 12 '23 21:01 sgettys