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

pip_requirements hashing improvements cause requirements files in sub-dirs to not be found #6599

Closed
caphrim007 opened this issue Jun 27, 2020 · 2 comments

Comments

@caphrim007
Copy link

What Renovate type are you using?
Self-hosted

Describe the bug
The recently added hashing for pip_requirements appears to supply cwdFile

https://github.com/renovatebot/renovate/blob/master/lib/manager/pip_requirements/artifacts.ts#L32

that, when combined with the cwd path constructed in exec

cwd = join(execConfig.localDir, dirname(cwdFile));

causes the package file to not be found. The initial implementation (that I had been testing) had the cwdFile in artifact.ts set to cwdFile: '.',. They may be why it stopped working when the feature was released as that "dot" value was changed to packageFileName in the final release.

Did you see anything helpful in debug logs?

I have the following environment variables defined for my particular environment. You will see these reflected in the logs

                - name: RENOVATE_CONFIG_FILE
                  value: /tmp/renovate-config.js
                - name: RENOVATE_BASE_DIR
                  value: /scratch

My localDir is detected as

DEBUG: Using localDir: /scratch/repos/bitbucket/org/project (repository=org/project)
DEBUG: Executing command (repository=org/project, branch=renovate/boto3-1.x)
       "command": "hashin boto3==1.14.12 -r requirements/production.txt"
DEBUG: Failed to update requirements/production.txt file (repository=org/project, branch=renovate/boto3-1.x)
       "err": {
         "killed": false,
         "code": 1,
         "signal": null,
         "cmd": "hashin boto3==1.14.12 -r requirements/production.txt",
         "stdout": "",
         "stderr": "Traceback (most recent call last):\n  File \"/usr/local/python/3.8.3/bin/hashin\", line 8, in <module>\n
    sys.exit(main())\n  File \"/usr/local/python/3.8.3/lib/python3.8/site-packages/hashin.py\", line 836, in main\n
    return run(\n  File \"/usr/local/python/3.8.3/lib/python3.8/site-packages/hashin.py\", line 135, in run\n
    return run_packages(specs, requirements_file, *args, **kwargs)\n  File \"/usr/local/python/3.8.3/lib/
python3.8/site-packages/hashin.py\", line 261, in run_packages\n    with open(file) as f:\n
FileNotFoundError: [Errno 2] No such file or directory: 'requirements/production.txt'\n",

         "message": "Command failed: hashin boto3==1.14.12 -r requirements/production.txt\nTraceback
 (most recent call last):\n  File \"/usr/local/python/3.8.3/bin/hashin\", line 8, in <module>\n
    sys.exit(main())\n  File \"/usr/local/python/3.8.3/lib/python3.8/site-packages/hashin.py\", line 836, in main\n
    return run(\n  File \"/usr/local/python/3.8.3/lib/python3.8/site-packages/hashin.py\", line 135, in run\n
    return run_packages(specs, requirements_file, *args, **kwargs)\n  File \"/usr/local/python/3.8.3/lib/
python3.8/site-packages/hashin.py\", line 261, in run_packages\n    with open(file) as f:\n
FileNotFoundError: [Errno 2] No such file or directory: 'requirements/production.txt'\n",

         "stack": "Error: Command failed: hashin boto3==1.14.12 -r requirements/production.txt\nTraceback
 (most recent call last):\n  File \"/usr/local/python/3.8.3/bin/hashin\", line 8, in <module>\n
    sys.exit(main())\n  File \"/usr/local/python/3.8.3/lib/python3.8/site-packages/hashin.py\", line 836, in main\n
    return run(\n  File \"/usr/local/python/3.8.3/lib/python3.8/site-packages/hashin.py\", line 135, in run\n
    return run_packages(specs, requirements_file, *args, **kwargs)\n  File \"/usr/local/python/3.8.3/lib/
python3.8/site-packages/hashin.py\", line 261, in run_packages\n    with open(file) as f:\n
FileNotFoundError: [Errno 2] No such file or directory: 'requirements/production.txt'\n\n
    at ChildProcess.exithandler (child_process.js:303:12)\n    at ChildProcess.emit (events.js:315:20)\n
    at ChildProcess.EventEmitter.emit (domain.js:482:12)\n    at maybeClose (internal/child_process.js:1021:16)\n
    at Socket.<anonymous> (internal/child_process.js:443:11)\n    at Socket.emit (events.js:315:20)\n
    at Socket.EventEmitter.emit (domain.js:482:12)\n    at Pipe.<anonymous> (net.js:674:12)"
       }

If I am reading the logic of the cwd variable builder correctly, then I think it is building the following path

/scratch/repos/bitbucket/org/project/requirements

And then trying to execute hashin from within that directory

hashin boto3==1.14.12 -r requirements/production.txt

Which will not find the file

To Reproduce

I think the bug is related to the subDirectory that my package file resides in. This was functioning before the addition of the hashing improvements though, so it feels like a regression.

Additional context

@rarkins
Copy link
Collaborator

rarkins commented Jun 27, 2020

Yeah, I think it should be reverted back to '.'

@renovate-release
Copy link
Collaborator

🎉 This issue has been resolved in version 21.18.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants