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

Using ./ in a relative path corrupts the bundle zip #292

Closed
gislikonrad opened this issue Sep 19, 2023 · 12 comments · Fixed by #299
Closed

Using ./ in a relative path corrupts the bundle zip #292

gislikonrad opened this issue Sep 19, 2023 · 12 comments · Fixed by #299
Labels
bug Something isn't working

Comments

@gislikonrad
Copy link

gislikonrad commented Sep 19, 2023

When using apigeecli apis create bundle -n helloworld -f ./myfolder/apiproxy, the proxy gets created, but is undeployable. This is due to differences in the bundle zip.

I wrote a program to output the entries in the bundle zip.

This is what a bundle looks like that was created with the-f proxies/hellowworld/apiproxy option.

contents of healthy_proxy.zip

  • apiproxy/
  • apiproxy/policies/
  • apiproxy/policies/add-cors.xml
  • apiproxy/policies/check-quota.xml
  • apiproxy/proxies/
  • apiproxy/proxies/default.xml
  • apiproxy/targets/
  • apiproxy/targets/default.xml
  • apiproxy/helloworld.xml

...and this is what a bundle looks like that was created with-f ./proxies/helloworld/apiproxy option.

contents of unhealthy_proxy.zip

  • ./
  • ./proxies/
  • ./proxies/helloworld/
  • ./proxies/helloworld/apiproxy/
  • apiproxy/
  • apiproxy/policies/
  • apiproxy/policies/add-cors.xml
  • apiproxy/policies/check-quota.xml
  • apiproxy/proxies/
  • apiproxy/proxies/default.xml
  • apiproxy/targets/
  • apiproxy/targets/default.xml
  • apiproxy/helloworld.xml
@srinandan srinandan added the bug Something isn't working label Sep 19, 2023
@kurtkanaskie
Copy link
Collaborator

On Mac:
Using -f ./apiproxy worked for me and I could deploy, the downloaded zip looked right too.

Using -f ./folder/apiproxy worked too and I could deploy in the UI, the downloaded zip has:

unzip test-path-with-dot_rev3_2023_09_19.zip 
Archive:  test-path-with-dot_rev3_2023_09_19.zip
   creating: folder/
   creating: folder/apiproxy/
   creating: apiproxy/
   creating: apiproxy/policies/
  inflating: apiproxy/policies/AM-Response.xml  
  inflating: apiproxy/policies/AM-XFF.xml  
  inflating: apiproxy/policies/PY-OSVariables.xml  
   creating: apiproxy/proxies/
  inflating: apiproxy/proxies/default.xml  
   creating: apiproxy/resources/
   creating: apiproxy/resources/py/
  inflating: apiproxy/resources/py/PY-OSVariables.py  
  inflating: apiproxy/test-path-with-dot.xml  

@gislikonrad
Copy link
Author

Interesting. I'm also on a mac and it was totally broken for me when using the ./ prefix.

@ssvaidyanathan
Copy link
Collaborator

@gislikonrad / @kurtkanaskie - can you share the apigeecli version you are running?

@gislikonrad
Copy link
Author

> apigeecli -v
apigeecli version 1.123 date: 2023-09-07T15:53:40Z [commit: 863de4d]

@gislikonrad
Copy link
Author

gislikonrad commented Sep 19, 2023

I installed yesterday. I'm running MacOS Ventura 13.5.2 (22G91) on an M1 Max Macbook Pro.

@kurtkanaskie
Copy link
Collaborator

kurtkanaskie commented Sep 19, 2023

Same for me regarding Mac and cli
MacOS Ventura 13.5.2
apigeecli version 1.123 date: 2023-09-07T15:53:40Z [commit: 863de4d]

@kurtkanaskie
Copy link
Collaborator

I do notice that the exported bundle has an extraneous folder in it, but it still deploys.

apis create bundle --name=test-path-with-dot --proxy-folder=./folder/apiproxy
apis fetch --name=test-path-with-dot
unzip test-path-with-dot_3.zip

tree
.
├── apiproxy
│   ├── policies
│   │   ├── AM-Response.xml
│   │   ├── AM-XFF.xml
│   │   └── PY-OSVariables.xml
│   ├── proxies
│   │   └── default.xml
│   ├── resources
│   │   └── py
│   │       └── PY-OSVariables.py
│   └── test-path-with-dot.xml
├── folder
│   └── apiproxy
└── test-path-with-dot_3.zip

@gislikonrad
Copy link
Author

@kurtkanaskie What if you point to a subfolder that is deeper that two levels? Example, './proxies/folder/apiproxy'

@srinandan
Copy link
Collaborator

There have been others with a similar problem (#276). Unfortunately we have not been able to reproduce it.

I was able to create and deploy a proxy with: apigeecli apis create bundle -n test1 -f ./proxies/test1/apiproxy -t $token, followed by apigeecli apis deploy -n test1 -e dev -v 1 --wait -t $token

@srinandan srinandan linked a pull request Sep 19, 2023 that will close this issue
@srinandan
Copy link
Collaborator

I think I have identified the problem. My comment here was incorrect. That proxy did not deploy successfully.

I narrowed the problem to this: 1) If there are two or more subfolders 2) And the relative path begins with a folder that is used in the proxy bundle (ex: proxies, policies, sharedflows etc), then we run into a problem. I think this fix addresses the problem.

@kurtkanaskie - I can show you how to reproduce the problem and then we can see if the fix addresses all variations.

@ssvaidyanathan
Copy link
Collaborator

@gislikonrad - we just released a beta version
Can you try installing that and see if the fix works as expected?

export APIGEECLI_VERSION=v1.124.0-beta
curl -L https://raw.githubusercontent.com/apigee/apigeecli/main/downloadLatest.sh | sh -

@gislikonrad
Copy link
Author

This has been successfully fixed. Thank you.

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

Successfully merging a pull request may close this issue.

4 participants