本文介绍了我如何获得与Cloudbees Jenkins构建一起工作的咕噜任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让一个Jenkins建立并运行在Cloudbees上。我已经成功地安装了NodeJs,并且从我的BitBucket存储库中获取了源代码。我正在尝试运行我的咕task任务,以在部署之前缩小和连接我的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
...
grunt@0.4.0 node_modules / grunt
├──dateformat@1.0.2-1.2.3
├──colors@0.6.0-1
├──hooker@0.2.3
├ ──eventemitter2@0.4.11
├──which@1.0.5
├──iconv-lite@0.2.7
├──coffee-script@1.3.3
├──lodash@0.9.2
├──nopt@1.0.10(abbrev@1.0.4)
├──rimraf@2.0.3(graceful-fs@1.1.14)
├──minimatch@0.2.11(sigmund@1.0.0,lru-cache@2.2.2)
├──glob@3.1.21(graceful-fs@1.2.0,inherits@1.0 .0)
├──findup-sync@0.1.2(lodash@1.0.1)
└──js-yaml@1.0.3(argparse@0.1.12)
+ grunt
/tmp/hudson3382014549646667419.sh:第8行:grunt:command not found
构建步骤'Execute shell'标记构建失败
完成:FAILUR E

关于如何使这项工作有任何想法?这在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


I'm trying to get a Jenkins build up and running on Cloudbees. I've successfully gotten NodeJs installed and my source pulled from my BitBucket repository. I am trying to run my grunt task to minify and concatenate my JS and CSS files before deploying. However, I am not able to run the grunt program, even though it is successfully installed. Below is my build script:

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

I've tried installing grunt with and without the -g option without success. Here is the console output for the grunt portion of my build:

+ npm install grunt
...
npm http GET https://registry.npmjs.org/grunt
npm http 200 https://registry.npmjs.org/grunt
...
grunt@0.4.0 node_modules/grunt
├── dateformat@1.0.2-1.2.3
├── colors@0.6.0-1
├── hooker@0.2.3
├── eventemitter2@0.4.11
├── which@1.0.5
├── iconv-lite@0.2.7
├── coffee-script@1.3.3
├── lodash@0.9.2
├── nopt@1.0.10 (abbrev@1.0.4)
├── rimraf@2.0.3 (graceful-fs@1.1.14)
├── minimatch@0.2.11 (sigmund@1.0.0, lru-cache@2.2.2)
├── glob@3.1.21 (graceful-fs@1.2.0, inherits@1.0.0)
├── findup-sync@0.1.2 (lodash@1.0.1)
└── js-yaml@1.0.3 (argparse@0.1.12)
+ grunt
/tmp/hudson3382014549646667419.sh: line 8: grunt: command not found
Build step 'Execute shell' marked build as failure
Finished: FAILURE

Any ideas on how to get this working? Is this even possible in Cloudbees?

解决方案

Grunt is now broken up, annoyingly, into a separate cli module. Also, annoyingly, that cli module does not include grunt itself.

To make this work:

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

If the folk making this change how it works to be sensible, then it may change in future.

Docs here: http://gruntjs.com/getting-started

这篇关于我如何获得与Cloudbees Jenkins构建一起工作的咕噜任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-13 20:42