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

Regression: PipInstall fails when envActivation is provided #719

Open
nickajacks1 opened this issue Mar 21, 2023 · 4 comments
Open

Regression: PipInstall fails when envActivation is provided #719

nickajacks1 opened this issue Mar 21, 2023 · 4 comments
Labels
bug Create a report to help us improve

Comments

@nickajacks1
Copy link

Describe the bug
Triggered by #677
When an envActivation is given to PipInstall, a PipDriver is created with the command set to envActivation + " && pip".
PipDriver then forwards this to CommandExecutor, setting the executablePath to the said value.
CommandExecutor escapes the spaces, treating the whole string like a single executable.
e.g. /bin/sh -c source\ env/bin/activate\ &&\ pip"

To Reproduce
Using a Jenkins Pipeline with the Artifactory plugin version 3.18.0, eg

pipeline {
  stages {
    stage('Pip Install') {
      steps {
        sh 'python3 -m venv env'
        rtPipResolver (
          id: 'PipResolver',
          serverId: 'my-server',
          repo: 'my-repo'
        )
        rtPipInstall(
          resolverId: 'PipResolver',
          args: 'pytest black',
          envActivation: '. env/bin/activate'
      }
    }
  }
}

Expected behavior
Users should be able to pass an envActivation to PipInstall.

Example Failure on Jenkins
Note the escaped spaces.

  INFO: Executing command: /bin/sh -c .\ env/bin/activate\ &&\ pip install .[dev] build -i https://myartifactory.com/pip-local/simple
  org.jfrog.build.extractor.packageManager.PackageManagerLogger error
  SEVERE: pip install failed: /bin/sh: . env/bin/activate : not found
  
  java.io.IOException: pip install failed: /bin/sh: . env/bin/activate : not found
  
  	at org.jfrog.build.extractor.pip.PipDriver.install(PipDriver.java:36)
  	at org.jfrog.build.extractor.pip.extractor.PipInstall.execute(PipInstall.java:98)
  	at org.jfrog.build.extractor.packageManager.PackageManagerExtractor.executeAndSaveBuildInfo(PackageManagerExtractor.java:33)
  	at org.jfrog.build.extractor.pip.extractor.PipInstall.main(PipInstall.java:85)
  Caused by: java.io.IOException: /bin/sh: . env/bin/activate : not found

Versions

  • Extractor version: 2.39.0
  • Operating system: Alpine Linux Docker container on Linux
  • Artifactory Jenkins Plugin Version: 3.18.0
@nickajacks1 nickajacks1 added the bug Create a report to help us improve label Mar 21, 2023
@nickajacks1
Copy link
Author

Any chance this will get traction?

@jayeshmurli
Copy link

+1 we have got the same issue after recently upgrading our Jenkins Artifactory plugin.

@thehalleffect
Copy link

I'm actually somewhat shocked that this issue doesn't have more comments and upvotes - the primary use case (afaik) for including an envActivation param in a rtPipInstall build step is completely broken by this bug.

@nickajacks1
Copy link
Author

JFrog recommends switching to the JFrog Jenkins plugin, which is a simple wrapper around the JFrog CLI tool. We have done so, and I'd recommend it too, since it's more feature rich, is actively developed, and allows one to more easily run the same code both in the Jenkinsfile and the command line.

That said, this should still be fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Create a report to help us improve
Projects
None yet
Development

No branches or pull requests

3 participants