我使用Docker插件进行竹子操作,我需要在docker容器中执行脚本。
sh脚本包含:
script.sh: line 35: \"${bamboo.ini_source_path}\",: bad substitution
如果我将此行直接放在Container Command中,$ {bamboo.ini_source_path}将替换为此变量的值。
我将/bin/bashscript.sh放入Container Command时遇到的问题是因为我收到错误:
withr::with_libpaths('app/library', devtools::install_local('MYPACKAGE'))
## ERROR: failed to create lock directory 'XXXXXXXXXX'
## Warning in dir.create(lockdir, recursive = TRUE) :
## cannot create dir 'YYYYYYYYYY', reason 'Permission denied'
withr::with_libpaths('app/library', devtools::install_local('WWWWWWWWW', args = '--no-lock'))
## ERROR: unable to create 'app/library/MYPACKAGE'
dir.create('app/library/MYPACKAGE')
withr::with_libpaths('app/library', devtools::install_local('MYPACKAGE', args = '--no-lock'))
## Warning in file.create(to[okay]) :
## cannot create file '/app/library/MYPACKAGE/libs/i386', reason 'No such file or directory'
## Warning in file.create(to[okay]) :
## cannot create file '/app/library/MYPACKAGE/libs/x64', reason 'No such file or directory'
## Error in file.copy(files, file.path(instdir, "exec"), TRUE) :
## more 'from' files than 'to' files
我有没有办法从docker容器中的脚本中获取bamboo.ini_source_path变量?
谢谢!
答案 0 :(得分:1)
您使用的是哪个版本的Bamboo? Bamboo 6.1.0中已修复此问题:
Unable to use variables in Container name field in Run docker task
解决方法:强>
运行
之类的命令echo "export sourcepath=$ini_source_path" > scriptname.sh
chmod +x scriptname.sh
Docker Task将$ {bamboo.working.directory}映射到Docker \数据卷。
因此,刚才创建的scriptname.sh脚本在Docker容器中可用。脚本将被执行,并将正确设置变量。