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

New multi docker #3902

Closed

Conversation

heliocastro
Copy link
Contributor

@heliocastro heliocastro commented Apr 17, 2021

Dockerfile: Multidocker based on Ubuntu 20.04

  • Switchable build arg versions
  • Scancode build from releases, not from python npip
  • Python uses pyenv. Default python is 3.8.11
  • Nodejs is using nvenv. Default nodejs is the latest LTS
  • Ruby uses rbenv. Bundler and Cocoapods now come by default
  • Wrapper script to use bashrc on direct ort usage
  • Use bash and pipefail on all operations as default. Exception for
    Android sdkmanager that behaves differently on pipefail
  • Silence gpg dearmor output on tee
  • Using a single downloader, curl
  • Go updated to last stable release

@heliocastro heliocastro requested a review from a team as a code owner April 17, 2021 12:30
@heliocastro heliocastro force-pushed the new_multi_docker branch 8 times, most recently from c1a53b3 to cfce639 Compare April 20, 2021 12:02
@heliocastro heliocastro changed the title WIP: New multi docker New multi docker Apr 20, 2021
@heliocastro heliocastro force-pushed the new_multi_docker branch 4 times, most recently from 3616688 to e34655d Compare April 20, 2021 12:51
@sschuberth sschuberth added docker About Docker topics on hold Pull requests that cannot currently be merged labels May 20, 2021
@fviernau
Copy link
Member

fviernau commented May 21, 2021

@heliocastro thanks for contributing!

The Python support in ORT as-is is indeed limited to Python 3.6 and supporting other Python versions makes a lot of sense.
Unfortunately package managers in Python are quite tricky to deal with. Regarding the support implemeted in ORT it seems to be necessary to consider all options for the implementation from scratch again, e.g. challenging also the existing implementation and potentially making larger changes to it.

Deciding for the way to go would be a pre-requisite for reviewing this PR. I'm sorry to tell that we don't have the time currently to do that in the near future.

Dockerfile Outdated Show resolved Hide resolved
Dockerfile Outdated Show resolved Hide resolved
docker/nodejs.sh Show resolved Hide resolved
@tsteenbe
Copy link
Member

@heliocastro The "Update to use pyenv" commit is not signed off that why DCO check fails - could you also add a commit message to this commit?

Dockerfile Outdated Show resolved Hide resolved
@tsteenbe
Copy link
Member

@heliocastro How difficult would it be to also build a massive source tarbal for this Docker image?

@nicorikken
Copy link
Member

I'm glad with the rework, mostly the update of ScanCode Toolkit and the ability to change both Python and Node versions

@edulix
Copy link

edulix commented Jul 16, 2021

Seems really cool, thanks @heliocastro . I've successfully compiled it with docker, but when running the pip package manager I always end up with the following:

The following configuration files and directories are used:
        /root/.ort/config/curations.yml
        /license-analysis/curations-dir
The following package managers are activated:
        Bower, Bundler, Cargo, Carthage, CocoaPods, Composer, Conan, DotNet, GoDep, GoMod, Gradle, Maven, NPM, NuGet, PIP, Pipenv, Pub, SBT, SpdxDocumentFile, Stack, Yarn
Analyzing project path:
        /project
Exception in thread "main" java.io.IOException: Cannot run program "virtualenv": error=2, No such file or directory
        at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
        at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
        at org.ossreviewtoolkit.utils.ProcessCapture.<init>(ProcessCapture.kt:88)
        at org.ossreviewtoolkit.utils.ProcessCapture.<init>(ProcessCapture.kt:31)
        at org.ossreviewtoolkit.utils.ProcessCapture.<init>(ProcessCapture.kt:35)
        at org.ossreviewtoolkit.utils.CommandLineTool$DefaultImpls.run(CommandLineTool.kt:75)
        at org.ossreviewtoolkit.analyzer.managers.VirtualEnv.run(Pip.kt:81)
        at org.ossreviewtoolkit.utils.CommandLineTool$DefaultImpls.getVersion(CommandLineTool.kt:81)
        at org.ossreviewtoolkit.analyzer.managers.VirtualEnv.getVersion(Pip.kt:81)
        at org.ossreviewtoolkit.utils.CommandLineTool$DefaultImpls.checkVersion(CommandLineTool.kt:97)
        at org.ossreviewtoolkit.analyzer.managers.VirtualEnv.checkVersion(Pip.kt:81)
        at org.ossreviewtoolkit.utils.CommandLineTool$DefaultImpls.checkVersion$default(CommandLineTool.kt:96)
        at org.ossreviewtoolkit.analyzer.managers.Pip.beforeResolution(Pip.kt:216)
        at org.ossreviewtoolkit.analyzer.PackageManager.resolveDependencies(PackageManager.kt:229)
        at org.ossreviewtoolkit.analyzer.Analyzer$analyzeInParallel$1$1$1.invokeSuspend(Analyzer.kt:131)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
Caused by: java.io.IOException: error=2, No such file or directory
        at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
        at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:340)
        at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:271)
        at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
        ... 20 more

What am I doing wrong?

@nicorikken
Copy link
Member

nicorikken commented Jul 16, 2021

It seems to work (although I still get errors due to private dependencies), when I first run pyenv virtualenv init from the workingdir:

root@06d410c275d5:/# pyenv virtualenv init
created virtual environment CPython3.8.11.final.0-64 in 431ms
  creator CPython3Posix(dest=/opt/python/versions/3.8.11/envs/init, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/root/.local/share/virtualenv)
    added seed packages: pip==21.1.3, setuptools==57.1.0, wheel==0.36.2
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
Looking in links: /tmp/tmphejjq9lp
Requirement already satisfied: setuptools in /opt/python/versions/3.8.11/envs/init/lib/python3.8/site-packages (57.1.0)
Requirement already satisfied: pip in /opt/python/versions/3.8.11/envs/init/lib/python3.8/site-packages (21.1.3)
root@06d410c275d5:/# ls
bin  boot  dev	etc  home  lib	lib32  lib64  libx32  media  mnt  opt  proc  project  root  run  sbin  srv  sys  tmp  usr  var
root@06d410c275d5:/# /opt/ort/bin/./ort analyze -i /project -o /project/ort

Initially I was having trouble with virtualenv due to a version restriction:

root@e762e7482929:/opt/ort# pyenv virtualenv
pyenv-virtualenv: no virtualenv name given.
root@e762e7482929:/opt/ort# pyenv virtualenv-init
# Load pyenv-virtualenv automatically by adding
# the following to ~/.bashrc:
eval "$(pyenv virtualenv-init -)"
root@e762e7482929:/opt/ort# eval "$(pyenv virtualenv-init -)"
root@e762e7482929:/opt/ort# bin/./ort analyze -i /project -o /project/ort
________ _____________________
\_____  \\______   \__    ___/ the OSS Review Toolkit, version DOCKER-SNAPSHOT.
 /   |   \|       _/ |    |
/    |    \    |   \ |    |    Running 'analyze' under Java 11.0.11 on Linux with
\_______  /____|_  / |____|    8 CPUs and a maximum of 3966 MiB of memory.
        \/       \/
Environment variables:
ORT_CONFIG_DIR = /root/.ort/config
ORT_DATA_DIR = /root/.ort
TERM = xterm
ANDROID_HOME = /opt/android-sdk
The following configuration files and directories are used:
	/root/.ort/config/curations.yml
	/root/.ort/config/curations
The following package managers are activated:
	Bower, Bundler, Cargo, Carthage, CocoaPods, Composer, Conan, DotNet, GoDep, GoMod, Gradle, Maven, NPM, NuGet, PIP, Pipenv, Pub, SBT, SpdxDocumentFile, Stack, Yarn
Analyzing project path:
	/project
Exception in thread "main" java.io.IOException: Unsupported virtualenv version 20.6.0 does not fulfill >=15.1.0 <20.3.0.
	at org.ossreviewtoolkit.utils.CommandLineTool$DefaultImpls.checkVersion(CommandLineTool.kt:105)
	at org.ossreviewtoolkit.analyzer.managers.VirtualEnv.checkVersion(Pip.kt:81)
	at org.ossreviewtoolkit.utils.CommandLineTool$DefaultImpls.checkVersion$default(CommandLineTool.kt:96)
	at org.ossreviewtoolkit.analyzer.managers.Pip.beforeResolution(Pip.kt:216)
	at org.ossreviewtoolkit.analyzer.PackageManager.resolveDependencies(PackageManager.kt:229)
	at org.ossreviewtoolkit.analyzer.Analyzer$analyzeInParallel$1$1$1.invokeSuspend(Analyzer.kt:131)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

I resolved that version restriction by updating the versions in Pip.kt on line 93:
From:

-    override fun getVersionRequirement(): Requirement = Requirement.buildIvy("[15.1,20.3[") 
+    override fun getVersionRequirement(): Requirement = Requirement.buildIvy("[15.1,20.7[") 

NOTE: there is a warning in the code that pip 20.3 comes with a new dependency resolver that is untested with ORT.

Copy link
Contributor

@maxhbr maxhbr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some minor comments. Tested it and it is working fine.


add_local_path "${PYENV_ROOT}/bin"

eval "$(pyenv init --path)";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
eval "$(pyenv init --path)";
eval "$(pyenv init --path)"


eval "$(pyenv init --path)";
#shellcheck disable=1091
. "$(pyenv root)"/completions/pyenv.bash;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
. "$(pyenv root)"/completions/pyenv.bash;
. "$(pyenv root)"/completions/pyenv.bash

Dockerfile Outdated
&& npm install --global npm@$NPM_VERSION bower@$BOWER_VERSION yarn@$YARN_VERSION

#------------------------------------------------------------------------
# ORT
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be

# Scancode

Dockerfile Outdated
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential \
dirmngr \
dpkg-dev \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation is mixed up here with tabs and spaces

Dockerfile Outdated

#------------------------------------------------------------------------
# Scancode from official releases
ARG SCANCODE_VERSION=21.8.4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is scancode added after ORT source? Wouldn't it be better for caching to reverse that?

maxhbr
maxhbr previously approved these changes Sep 8, 2021
@maxhbr
Copy link
Contributor

maxhbr commented Sep 14, 2021

@heliocastro : I suggested some changes in heliocastro#16

@nicorikken
Copy link
Member

nicorikken commented Sep 15, 2021

I build a new Docker image yesterday with the default settings and tried to run it for a Python project. It seems ORT is not able to access virtualenv:

+ /opt/ort/bin/ort --debug analyze -i . -o ort --package-curations-file curations.yml
13:12:09.945 [main] INFO  org.ossreviewtoolkit.model.config.LicenseFilenamePatterns - Configuring the license file patterns.
________ _____________________
\_____  \\______   \__    ___/ the OSS Review Toolkit, version DOCKER-SNAPSHOT.
 /   |   \|       _/ |    |
/    |    \    |   \ |    |    Running 'analyze' under Java 11.0.11 on Linux with
\_______  /____|_  / |____|    8 CPUs and a maximum of 3966 MiB of memory.
        \/       \/
Environment variables:
ORT_CONFIG_DIR = /root/.ort/config
ORT_DATA_DIR = /root/.ort
TERM = xterm
ANDROID_HOME = /opt/android-sdk

The following configuration files and directories are used:
	/project/curations.yml
	/root/.ort/config/curations
The following package managers are activated:
	Bower, Bundler, Cargo, Carthage, CocoaPods, Composer, Conan, DotNet, GoDep, GoMod, Gradle, Maven, NPM, NuGet, PIP, Pipenv, Pub, SBT, SpdxDocumentFile, Stack, Yarn
Analyzing project path:
	/project
13:12:10.515 [main] DEBUG org.ossreviewtoolkit.analyzer.Analyzer - Using the following configuration settings:
RepositoryConfiguration(excludes=Excludes(paths=[], scopes=[]), resolutions=Resolutions(issues=[], ruleViolations=[], vulnerabilities=[]), curations=Curations(packages=[], licenseFindings=[]), packageConfigurations=[], licenseChoices=LicenseChoices(repositoryLicenseChoices=[], packageLicenseChoices=[]))
13:12:10.543 [main] INFO  org.ossreviewtoolkit.analyzer.PackageManager - Not analyzing directory '/project/.git' as it is hard-coded to be ignored.
13:12:10.563 [main] INFO  org.ossreviewtoolkit.analyzer.PackageManager - Not analyzing directory '/project/.venv/lib/python3.8/site-packages' as it is hard-coded to be ignored.
13:12:10.579 [main] INFO  org.ossreviewtoolkit.analyzer.Analyzer - PIP project(s) found in:
13:12:10.580 [main] INFO  org.ossreviewtoolkit.analyzer.Analyzer - 	private-requirements.txt
13:12:10.580 [main] INFO  org.ossreviewtoolkit.analyzer.Analyzer - 	requirements.txt
Exception in thread "main" java.io.IOException: Cannot run program "virtualenv": error=2, No such file or directory
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
	at org.ossreviewtoolkit.utils.ProcessCapture.<init>(ProcessCapture.kt:88)
	at org.ossreviewtoolkit.utils.ProcessCapture.<init>(ProcessCapture.kt:31)
	at org.ossreviewtoolkit.utils.ProcessCapture.<init>(ProcessCapture.kt:35)
	at org.ossreviewtoolkit.utils.CommandLineTool$DefaultImpls.run(CommandLineTool.kt:75)
	at org.ossreviewtoolkit.analyzer.managers.VirtualEnv.run(Pip.kt:81)
	at org.ossreviewtoolkit.utils.CommandLineTool$DefaultImpls.getVersion(CommandLineTool.kt:81)
	at org.ossreviewtoolkit.analyzer.managers.VirtualEnv.getVersion(Pip.kt:81)
	at org.ossreviewtoolkit.utils.CommandLineTool$DefaultImpls.checkVersion(CommandLineTool.kt:97)
	at org.ossreviewtoolkit.analyzer.managers.VirtualEnv.checkVersion(Pip.kt:81)
	at org.ossreviewtoolkit.utils.CommandLineTool$DefaultImpls.checkVersion$default(CommandLineTool.kt:96)
	at org.ossreviewtoolkit.analyzer.managers.Pip.beforeResolution(Pip.kt:216)
	at org.ossreviewtoolkit.analyzer.PackageManager.resolveDependencies(PackageManager.kt:229)
	at org.ossreviewtoolkit.analyzer.Analyzer$analyzeInParallel$1$1$1.invokeSuspend(Analyzer.kt:131)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
Caused by: java.io.IOException: error=2, No such file or directory
	at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
	at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:340)
	at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:271)
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
	... 20 more

Trying to debug it shows virtualenv is not readily available:

root@b70198ac05fb:/project# whereis virtualenv
virtualenv:

Edit:
It again seems to be related to the PATH. Pyenv is not on the path.

docker run --rm -it --entrypoint /bin/bash -v $PWD:/project nicorikken/ort:new_multi_docker-2021-09-14-v1
root@1c20a00ab26e:/# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

Backtracking the PATH statements, I solved this issue by explictly setting:

export PATH=/opt/rbenv/bin:/opt/rbenv/shims/:/opt/rbenv/plugins/ruby-build/bin:/opt/go/bin:/opt/python/shims:/opt/python/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

So as previously the PATH (and similarly GOPATH) is lost transitioning to the main ORT docker. I assumed the Bashrc scripts would set the path again, but apparently this is not working.

@heliocastro
Copy link
Contributor Author

I build a new Docker image yesterday with the default settings and tried to run it for a Python project. It seems ORT is not able to access virtualenv:

+ /opt/ort/bin/ort --debug analyze -i . -o ort --package-curations-file curations.yml
13:12:09.945 [main] INFO  org.ossreviewtoolkit.model.config.LicenseFilenamePatterns - Configuring the license file patterns.
________ _____________________
\_____  \\______   \__    ___/ the OSS Review Toolkit, version DOCKER-SNAPSHOT.
 /   |   \|       _/ |    |
/    |    \    |   \ |    |    Running 'analyze' under Java 11.0.11 on Linux with
\_______  /____|_  / |____|    8 CPUs and a maximum of 3966 MiB of memory.
        \/       \/
Environment variables:
ORT_CONFIG_DIR = /root/.ort/config
ORT_DATA_DIR = /root/.ort
TERM = xterm
ANDROID_HOME = /opt/android-sdk

The following configuration files and directories are used:
	/project/curations.yml
	/root/.ort/config/curations
The following package managers are activated:
	Bower, Bundler, Cargo, Carthage, CocoaPods, Composer, Conan, DotNet, GoDep, GoMod, Gradle, Maven, NPM, NuGet, PIP, Pipenv, Pub, SBT, SpdxDocumentFile, Stack, Yarn
Analyzing project path:
	/project
13:12:10.515 [main] DEBUG org.ossreviewtoolkit.analyzer.Analyzer - Using the following configuration settings:
RepositoryConfiguration(excludes=Excludes(paths=[], scopes=[]), resolutions=Resolutions(issues=[], ruleViolations=[], vulnerabilities=[]), curations=Curations(packages=[], licenseFindings=[]), packageConfigurations=[], licenseChoices=LicenseChoices(repositoryLicenseChoices=[], packageLicenseChoices=[]))
13:12:10.543 [main] INFO  org.ossreviewtoolkit.analyzer.PackageManager - Not analyzing directory '/project/.git' as it is hard-coded to be ignored.
13:12:10.563 [main] INFO  org.ossreviewtoolkit.analyzer.PackageManager - Not analyzing directory '/project/.venv/lib/python3.8/site-packages' as it is hard-coded to be ignored.
13:12:10.579 [main] INFO  org.ossreviewtoolkit.analyzer.Analyzer - PIP project(s) found in:
13:12:10.580 [main] INFO  org.ossreviewtoolkit.analyzer.Analyzer - 	private-requirements.txt
13:12:10.580 [main] INFO  org.ossreviewtoolkit.analyzer.Analyzer - 	requirements.txt
Exception in thread "main" java.io.IOException: Cannot run program "virtualenv": error=2, No such file or directory
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
	at org.ossreviewtoolkit.utils.ProcessCapture.<init>(ProcessCapture.kt:88)
	at org.ossreviewtoolkit.utils.ProcessCapture.<init>(ProcessCapture.kt:31)
	at org.ossreviewtoolkit.utils.ProcessCapture.<init>(ProcessCapture.kt:35)
	at org.ossreviewtoolkit.utils.CommandLineTool$DefaultImpls.run(CommandLineTool.kt:75)
	at org.ossreviewtoolkit.analyzer.managers.VirtualEnv.run(Pip.kt:81)
	at org.ossreviewtoolkit.utils.CommandLineTool$DefaultImpls.getVersion(CommandLineTool.kt:81)
	at org.ossreviewtoolkit.analyzer.managers.VirtualEnv.getVersion(Pip.kt:81)
	at org.ossreviewtoolkit.utils.CommandLineTool$DefaultImpls.checkVersion(CommandLineTool.kt:97)
	at org.ossreviewtoolkit.analyzer.managers.VirtualEnv.checkVersion(Pip.kt:81)
	at org.ossreviewtoolkit.utils.CommandLineTool$DefaultImpls.checkVersion$default(CommandLineTool.kt:96)
	at org.ossreviewtoolkit.analyzer.managers.Pip.beforeResolution(Pip.kt:216)
	at org.ossreviewtoolkit.analyzer.PackageManager.resolveDependencies(PackageManager.kt:229)
	at org.ossreviewtoolkit.analyzer.Analyzer$analyzeInParallel$1$1$1.invokeSuspend(Analyzer.kt:131)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
Caused by: java.io.IOException: error=2, No such file or directory
	at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
	at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:340)
	at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:271)
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
	... 20 more

Trying to debug it shows virtualenv is not readily available:

root@b70198ac05fb:/project# whereis virtualenv
virtualenv:

Edit:
It again seems to be related to the PATH. Pyenv is not on the path.

docker run --rm -it --entrypoint /bin/bash -v $PWD:/project nicorikken/ort:new_multi_docker-2021-09-14-v1
root@1c20a00ab26e:/# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

Backtracking the PATH statements, I solved this issue by explictly setting:

export PATH=/opt/rbenv/bin:/opt/rbenv/shims/:/opt/rbenv/plugins/ruby-build/bin:/opt/go/bin:/opt/python/shims:/opt/python/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

So as previously the PATH (and similarly GOPATH) is lost transitioning to the main ORT docker. I assumed the Bashrc scripts would set the path again, but apparently this is not working.

@nicorikken This is already solved in latest commits. virtualenv is installed in the current python, but temember that if you are using interactive environment, you will need run the wrappers to initialize pyenv

@heliocastro heliocastro reopened this Sep 23, 2021
@maxhbr
Copy link
Contributor

maxhbr commented Sep 27, 2021

FYI: new scancode release: https://github.com/nexB/scancode-toolkit/releases/tag/v30.1.0

@maxhbr
Copy link
Contributor

maxhbr commented Oct 8, 2021

I think dart support might be broken in this PR. When scanning antlr4 it fails with the following error:

[...]
13:31:37.532 [main] INFO  org.ossreviewtoolkit.analyzer.Analyzer - Pub project(s) found in:
13:31:37.532 [main] INFO  org.ossreviewtoolkit.analyzer.Analyzer -      runtime/Dart/pubspec.yaml
[...]
13:32:03.264 [main] INFO  org.ossreviewtoolkit.utils.ProcessCapture - Running '/home/mhuber/.ort/tools/flutter-2.2.3-stable/flutter/bin/dart pub --version' in '/'...
Exception in thread "main" java.io.IOException: Running '/home/mhuber/.ort/tools/flutter-2.2.3-stable/flutter/bin/dart pub --version' in '/' failed with exit code 64:
Missing subcommand for "dart pub".

Usage: dart pub [arguments...]
-h, --help          Print this usage information.
    --[no-]trace    Print debugging information when an error occurs.
-v, --verbose       Shortcut for "--verbosity=all".

Available subcommands:
  add         Add a dependency to pubspec.yaml.
  cache       Work with the system cache.
  deps        Print package dependencies.
  downgrade   Downgrade the current package's dependencies to oldest versions.
  get         Get the current package's dependencies.
  global      Work with global packages.
  login       Log into pub.dev.
  logout      Log out of pub.dev.
  outdated    Analyze your dependencies to find which ones can be upgraded.
  publish     Publish the current package to pub.dartlang.org.
  remove      Removes a dependency from the current package.
  upgrade     Upgrade the current package's dependencies to latest versions.
  uploader    Manage uploaders for a package on pub.dartlang.org.

Run "dart help" to see global options.
See https://dart.dev/tools/pub/cmd/pub-global for detailed documentation.

        at org.ossreviewtoolkit.analyzer.managers.Pub.run(Pub.kt:600)
        at org.ossreviewtoolkit.utils.CommandLineTool$DefaultImpls.getVersion(CommandLineTool.kt:81)
        at org.ossreviewtoolkit.analyzer.managers.Pub.getVersion(Pub.kt:98)
        at org.ossreviewtoolkit.utils.CommandLineTool$DefaultImpls.getVersion$default(CommandLineTool.kt:80)
        at org.ossreviewtoolkit.analyzer.Analyzer.analyze(Analyzer.kt:113)
        at org.ossreviewtoolkit.cli.commands.AnalyzerCommand.run(AnalyzerCommand.kt:189)
        at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:204)
        at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:213)
        at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:17)
        at com.github.ajalt.clikt.core.CliktCommand.parse(CliktCommand.kt:396)
        at com.github.ajalt.clikt.core.CliktCommand.parse$default(CliktCommand.kt:393)
        at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:411)
        at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:436)
        at org.ossreviewtoolkit.cli.OrtMainKt.main(OrtMain.kt:108)

Might also be broken on master, I have not tested that.


#------------------------------------------------------------------------
# Scancode from official releases
ARG SCANCODE_VERSION=30.1.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you also need to change the scancodeVersion in ./gradle.properties.

@tsteenbe
Copy link
Member

@heliocastro Instead of nvm what do you thing of using n which seems to have a simpler API for example see https://blog.insiderattack.net/working-with-multiple-nodejs-versions-85c8eef7a600

heliocastro and others added 5 commits November 5, 2021 14:36
* Switchable build arg versions
* Scancode build from releases, not from python npip
* Python uses pyenv. Default python is 3.8.11
* Nodejs is using nvenv.  Default nodejs is the latest LTS
* Ruby uses rbenv. Bundler and Cocoapods now come by default
* Wrapper script to use bashrc on direct ort usage
* Use bash and pipefail on all operations as default. Exception for
Android sdkmanager that behaves differently on pipefail
* Silence gpg dearmor output on tee
* Using a single downloader, curl
* Go updated to last stable release

Signed-off-by: Helio Chissini de Castro <helio@kde.org>
Signed-off-by: Maximilian Huber <gh@maxhbr.de>
Signed-off-by: Helio Chissini de Castro <helio@kde.org>
Signed-off-by: Helio Chissini de Castro <helio@kde.org>
For some not yet identified, defauly Ubuntu openjdk 11 fail to build
current instance of Ort upstream code.
AdoptOpenJDk fix the issue as a better solution.

Signed-off-by: Helio Chissini de Castro <helio@kde.org>
@sschuberth
Copy link
Member

Superseded by #4746.

@ReXtrem
Copy link

ReXtrem commented Aug 22, 2023

Would be nice if you just push the docker-image to Docker Hub

@sschuberth
Copy link
Member

Would be nice if you just push the docker-image to Docker Hub

Please refer to #2441 for that matter instead of commenting on closed PRs.

@heliocastro heliocastro deleted the new_multi_docker branch November 12, 2023 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docker About Docker topics on hold Pull requests that cannot currently be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants