Skip to content

How can we provide the dependencies along with function code in the source zip ? #2980

@prajinkhadka

Description

@prajinkhadka

Fission/Kubernetes version
client:
fission/core:
BuildDate: "2024-01-14T15:43:35Z"
GitCommit: 7e8d5dd
Version: v1.20.1
server:
fission/core:
BuildDate: "2024-01-14T15:43:35Z"
GitCommit: 7e8d5dd
Version: v1.20.1

$ fission version
$ kubectl version

Kubernetes platform (e.g. Google Kubernetes Engine)
Docker application on Mac OS ( M1 2020 Air )

Describe the bug
I am trying to create the fission function or package by providing a source zip ( that contains both the dependencies and function code ).
For example in Python,
pip3 install pyyaml -t . will install dependencies in the current directory.

and build.sh script contains:
cp -r ${SRC_PKG} ${DEPLOY_PKG}

The files in the directory are:

.
├── build.sh
├── function.py
└── lib
└── site-packages
├── Crypto
│   ├── Cipher
│   │   ├── AES.py
│   │   ├── AES.pyi
│   │   ├── ARC2.py
│   │   ├── ARC2.pyi
│   │   ├── ARC4.py
│   │   ├── ARC4.pyi
│   │   ├── Blowfish.py
│   │   ├── Blowfish.pyi
│   │   ├── CAST.py

I create the zip src of this directory with:
zip -r demo-src-pkg.zip .

and use this zip file to create the package:

I get this error:
Name: demo-src-pkg-zip-uufr
Environment: python
Status: failed
Build Logs:
error fetching source package: Invalid argument - failed to download url : Get "http://127.0.0.1:53812/v1/archive?id=%2Ffission%2Ffission-functions%2F873a3796-39b8-4839-bf30-5d06119056f3": dial tcp 127.0.0.1:53812: connect: connection refused%

If I just zip without dependencies (just with the build.sh and function.py ) it works.

How can I pass my dependencies?

To Reproduce
touch function.py
and just add :
def main():
return "hello"

touch build.sh
#!/bin/sh
cp -r ${SRC_PKG} ${DEPLOY_PKG}

pip3 install pyyaml -t . will install dependencies in the current directory.

Create Package:
fission package create --sourcearchive demo-src-pkg.zip --env python --buildcmd "./build.sh"

Expected result
I reckon Fission will just unzip this zip file and copy it to the deploy package directory.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions