#Upload dist created in previous stage

1 messages · Page 1 of 1 (latest)

ocean reef
#

In the build section of my Dagger pipeline, I create a dist folder containing the build and export it. In the next step, granted I am in a CI environment, I then use twine to upload the dist folder. However, I am having trouble importing in the dist folder into the upload steps. Here is my code:

python = (
            # use a python 3.8 container
            client.container().from_("python:3.8-slim-buster")
            # load in dependencies cache
            .with_mounted_cache("/root/.cache/pip", pip_cache)
            .with_mounted_cache("/root/.cache/pypoetry", poetry_cache)
            # mount cloned repository into image
            .with_directory("/src", src)
            # set current working directory for next commands
            .with_workdir("/src")
        )

        # ======================== PACKAGE ========================
        package_python = (
            # grab container
            python
            # install test dependencies
            .with_exec(["pip", "install", "poetry"])
            # build the package
            .with_exec(["poetry", "build", "--directory=dist/"])
        )

        # execute
        await package_python.directory("/src").export(".")
        print("Package succeeded!")

        if is_ci is True:
            # define the url
            url = urljoin(f"{CI_API_V4_URL}", f"/projects/{CI_PROJECT_ID}/packages/pypi")

            # ======================== DEPLOY-DEVEL ========================
            deploy_devel_python = (
                # grab container
                python
                # install test dependencies
                .with_exec(["pip", "install", "twine"])
                # build the package
                .with_exec(["twine", "upload", "--repository-url", f"{url}", "dist/*"])
            )

            # execute
            await deploy_devel_python.directory("/src").export(".")
            print("Package succeeded!")

The error I am getting: ERROR InvalidDistribution: Cannot find file (or expand pattern): 'dist/*'

glass olive
#

In any case, sees like twine can't find the dist folder is because you need to use the package_python container in the deploy_devel_python assignment instead of python. That should find the dist folder appropriately