构建步骤'执行shell'将构建标记为失败

时间:2015-11-19 11:17:58

标签: jenkins

我的jenkins项目中有一个构建步骤。这是一个Execute Shell步骤。

以下是命令是我正在运行的。

sudo gcloud --project=xxxx preview app deploy app.yaml ==version=1

在部署期间,上述步骤会破坏构建,并出现以下错误。

sudo gcloud --project = cfc-melbourne-website preview app deploy app.yaml == version = 1

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

sudo: no tty present and no askpass program specified
Build step 'Execute shell' marked build as failure
No JDK named ‘null’ found
ERROR: Build step failed with exception
com.google.jenkins.plugins.credentials.oauth.GoogleRobotPrivateKeyCredentials$AccountIdNotSetException
  at com.google.jenkins.plugins.credentials.oauth.GoogleRobotPrivateKeyCredentials.getUsername(GoogleRobotPrivateKeyCredentials.java:152)
  at com.google.jenkins.plugins.credentials.oauth.RemotableGoogleCredentials.<init>(RemotableGoogleCredentials.java:54)
  at com.google.jenkins.plugins.credentials.oauth.GoogleRobotCredentials.forRemote(GoogleRobotCredentials.java:204)
  at com.google.jenkins.plugins.storage.AbstractUpload.initiateUploadsAtWorkspace(AbstractUpload.java:342)
  at com.google.jenkins.plugins.storage.AbstractUpload.perform(AbstractUpload.java:173)
  at com.google.jenkins.plugins.storage.GoogleCloudStorageUploader.perform(GoogleCloudStorageUploader.java:109)
  at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
  at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:785)
  at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:726)
  at hudson.model.Build$BuildExecution.post2(Build.java:185)
  at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:671)
  at hudson.model.Run.execute(Run.java:1766)
  at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
  at hudson.model.ResourceController.execute(ResourceController.java:98)
  at hudson.model.Executor.run(Executor.java:410)
Build step 'Google Cloud Storage Uploader' marked build as failure
Finished: FAILURE

如何解决此问题?

1 个答案:

答案 0 :(得分:1)

no tty present错误表示您在sudoers文件中有requiretty设置。这将需要一个tty。要解决此问题,您可以将用户添加到该文件并转动。

更改你的sudoers文件:

vi /etc/sudoers

并添加(假设它是你的jenkins用户):

Defaults:jenkins !authenticate

通常,您的jenkins用户无需身份验证即可使用sudo-commands。