From d3f93a8389cbf198ce217e2001b7ae0c7df62d2b Mon Sep 17 00:00:00 2001 From: Jinjing Zhou Date: Fri, 14 Oct 2022 14:26:01 +0800 Subject: [PATCH] bug: fix explicit channel setting with conda env.yaml (#1008) * fix channel Signed-off-by: Jinjing.Zhou * lint Signed-off-by: Jinjing.Zhou * fix test Signed-off-by: Jinjing.Zhou Signed-off-by: Jinjing.Zhou --- e2e/language/python_test.go | 9 +++++++++ e2e/language/testdata/python/conda_channel/build.envd | 10 ++++++++++ e2e/language/testdata/python/conda_channel/env.yaml | 3 +++ pkg/lang/ir/conda.go | 2 +- 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 e2e/language/testdata/python/conda_channel/build.envd create mode 100644 e2e/language/testdata/python/conda_channel/env.yaml diff --git a/e2e/language/python_test.go b/e2e/language/python_test.go index a701051a1..2caf87e4e 100644 --- a/e2e/language/python_test.go +++ b/e2e/language/python_test.go @@ -54,4 +54,13 @@ var _ = Describe("python", Ordered, func() { e.RunContainer()() e.DestroyContainer()() }) + + It("Should build conda with separate channel setting successfully", func() { + exampleName := "python/conda_channel" + testcase := "e2e" + e := e2e.NewExample(e2e.BuildContextDirWithName(exampleName), testcase) + e.BuildImage(true)() + e.RunContainer()() + e.DestroyContainer()() + }) }) diff --git a/e2e/language/testdata/python/conda_channel/build.envd b/e2e/language/testdata/python/conda_channel/build.envd new file mode 100644 index 000000000..46853559a --- /dev/null +++ b/e2e/language/testdata/python/conda_channel/build.envd @@ -0,0 +1,10 @@ +def build(): + config.conda_channel( + channel=""" +channels: + - defaults + - dglteam # dgllife in env.yaml only works if specify channels here + """ + ) + install.conda_packages(env_file="env.yaml") + base(os="ubuntu20.04", language="python3.8") diff --git a/e2e/language/testdata/python/conda_channel/env.yaml b/e2e/language/testdata/python/conda_channel/env.yaml new file mode 100644 index 000000000..849610dea --- /dev/null +++ b/e2e/language/testdata/python/conda_channel/env.yaml @@ -0,0 +1,3 @@ +name: imarobot # should ignore this name +dependencies: + - dgl \ No newline at end of file diff --git a/pkg/lang/ir/conda.go b/pkg/lang/ir/conda.go index c675bd9bb..458d77cc7 100644 --- a/pkg/lang/ir/conda.go +++ b/pkg/lang/ir/conda.go @@ -39,7 +39,7 @@ const ( var ( // this file can be used by both conda and mamba // https://mamba.readthedocs.io/en/latest/user_guide/configuration.html#multiple-rc-files - condarc = fileutil.EnvdHomeDir(".condarc") + condarc = "/opt/conda/.condarc" //go:embed install-conda.sh installCondaBash string //go:embed install-mamba.sh