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

Add support for virtual environments for pip install commands #88

Open
bewczardski opened this issue Jan 24, 2024 · 1 comment
Open
Labels
feature request New feature or request

Comments

@bewczardski
Copy link

Is your feature request related to a problem? Please describe.

When using the JFrog Plugin in a python build pipeline, dependencies cannot be installed into a virtual environment.

When using the jfrog-cli locally this is possible.

Describe the solution you'd like to see

Provide a mechanism to allow virtual environment activation during the jf 'pip install' command. The JFrog Artifactory plugin provided this functionality.

Describe alternatives you've considered

PipEnv and Poetry are supported, but the JFrog Plugin should support standard tool workflows.

Additional context

Here is a simple workflow highlighting the problem. The end result is the virtual environment does not contain the jinja2 package

pipeline {
    agent {
        kubernetes {
            inheritFrom 'k8s-agent'
            yamlMergeStrategy merge()
            defaultContainer 'python'
            yaml """\
                spec:
                  containers:
                    - name: python
                      image: python:3.12-slim-bookworm
                      imagePullPolicy: Always
                      command:
                        - cat
                      tty: true
                      resources:
                        requests:
                          cpu: 250m
                          memory: 512Mi
                        limits:
                          cpu: 500m
                          memory: 512Mi
                    """.stripIndent()
        }
    }
    tools {
        jfrog 'jfrog-cli'
    }
    stages {
        stage('Install Dependencies') {
            steps {
                sh 'python -m venv venv && . venv/bin/activate'
                jf 'pip-config --repo-resolve=pypi-dev'
                jf 'pip install jinja2'
                sh '. venv/bin/activate && pip list'
            }
        }
    }
}
@bewczardski bewczardski added the feature request New feature or request label Jan 24, 2024
@BatelG
Copy link

BatelG commented Oct 9, 2024

jf pip install has --require-virtualenv flag.
how to use it properly? it cannot find the activated venv from the sh command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants