小编pab*_*car的帖子

如何在Jenkins声明性管道的代理部分中使用环境变量?

我正在为一个基于node.js的应用程序构建一个Docker镜像,其中一些依赖项需要一个私有NPM注册表的NPM令牌,但是在构建映像时,包含该令牌的变量为null,例如

docker build -t 3273e0bfe8dd329a96070382c1c554454ca91f96 --build-args NPM_TOKEN=null -f Dockerfile
Run Code Online (Sandbox Code Playgroud)

简化的管道是:

pipeline {

  environment {
    NPM_TOKEN = credentials('npm-token')
  }

  agent {
    dockerfile {
      additionalBuildArgs "--build-args NPM_TOKEN=${env.NPM_TOKEN}"
    }
  }

  stages {
    stage('Lint') { 
      steps { 
        sh 'npm run lint' 
      }
    }
  }

}
Run Code Online (Sandbox Code Playgroud)

有没有办法在该部分使用env变量或目前不支持?

顺便说一句,我已经按照Docker中的建议和私有模块有关如何使用NPM令牌构建一个docker镜像

npm jenkins jenkins-pipeline

12
推荐指数
1
解决办法
3598
查看次数

在Grails的GORM中添加更改侦听器

我是Grails的新手,我正在使用Grails 2.0.1.我想为域类的对象中的更改添加持久性事件侦听器,因此我尝试了用户指南中给出的Bootstrap.groovy中的代码:

def init = {
    applicationContext.addApplicationListener(new FooBarListener())
}
Run Code Online (Sandbox Code Playgroud)

我收到以下错误消息:

错误context.GrailsContextLoader - 执行bootstraps时出错:没有这样的属性:类的applicationContext:BootStrap

如何从BootStrap类中获取applicacionContext属性?或者文档是否过时,是否有新的/更好的方法来添加域更改侦听器?

提前致谢.

grails grails-orm grails-2.0

1
推荐指数
1
解决办法
2019
查看次数

标签 统计

grails ×1

grails-2.0 ×1

grails-orm ×1

jenkins ×1

jenkins-pipeline ×1

npm ×1