如何使用 Cloudbees Jenkins 构建执行繁重任务

2024-02-12

我正在尝试在 Cloudbees 上构建并运行 Jenkins。我已经成功安装了 NodeJs,并从 BitBucket 存储库中提取了源代码。我正在尝试运行我的 grunt 任务来在部署之前缩小并连接我的 JS 和 CSS 文件。但是,即使已成功安装,我也无法运行 grunt 程序。下面是我的构建脚本:

curl -s -o use-node https://repository-cloudbees.forge.cloudbees.com/distributions/ci-addons/node/use-node
NODE_VERSION=0.8.0 \
 source ./use-node
npm install
npm install grunt
grunt

我尝试过使用和不使用 -g 选项来安装 grunt,但都没有成功。这是我的构建的 grunt 部分的控制台输出:

+ npm install grunt
...
npm http GET https://registry.npmjs.org/grunt
npm http 200 https://registry.npmjs.org/grunt
...
[email protected] /cdn-cgi/l/email-protection node_modules/grunt
├── [email protected] /cdn-cgi/l/email-protection
├── [email protected] /cdn-cgi/l/email-protection
├── [email protected] /cdn-cgi/l/email-protection
├── [email protected] /cdn-cgi/l/email-protection
├── [email protected] /cdn-cgi/l/email-protection
├── [email protected] /cdn-cgi/l/email-protection
├── [email protected] /cdn-cgi/l/email-protection
├── [email protected] /cdn-cgi/l/email-protection
├── [email protected] /cdn-cgi/l/email-protection ([email protected] /cdn-cgi/l/email-protection)
├── [email protected] /cdn-cgi/l/email-protection ([email protected] /cdn-cgi/l/email-protection)
├── [email protected] /cdn-cgi/l/email-protection ([email protected] /cdn-cgi/l/email-protection, [email protected] /cdn-cgi/l/email-protection)
├── [email protected] /cdn-cgi/l/email-protection ([email protected] /cdn-cgi/l/email-protection, [email protected] /cdn-cgi/l/email-protection)
├── [email protected] /cdn-cgi/l/email-protection ([email protected] /cdn-cgi/l/email-protection)
└── [email protected] /cdn-cgi/l/email-protection ([email protected] /cdn-cgi/l/email-protection)
+ grunt
/tmp/hudson3382014549646667419.sh: line 8: grunt: command not found
Build step 'Execute shell' marked build as failure
Finished: FAILURE

关于如何让它发挥作用有什么想法吗?这在 Cloudbees 中可能吗?


令人烦恼的是,Grunt 现在被分解为一个单独的 cli 模块。另外,令人烦恼的是,该 cli 模块不包含 grunt 本身。

为了使这项工作有效:

curl -s -o use-node https://repository-cloudbees.forge.cloudbees.com/distributions/ci-addons/node/use-node
NODE_VERSION=0.8.0 \
 source ./use-node
npm install
npm install grunt
npm install grunt-cli
export PATH=$PATH:node_modules/grunt-cli/bin/
grunt

如果人们做出这种改变是明智的,那么未来可能会改变。

文档在这里:http://gruntjs.com/getting-started http://gruntjs.com/getting-started

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何使用 Cloudbees Jenkins 构建执行繁重任务 的相关文章

随机推荐