【问题标题】:Build step 'Execute shell' marked build as failure构建步骤“执行 shell”将构建标记为失败
【发布时间】:2016-02-21 12:12:50
【问题描述】:

我的 jenkins 项目中有一个构建步骤。这是一个执行 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

我该如何解决这个问题?

【问题讨论】:

    标签: jenkins


    【解决方案1】:

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

    更改您的 sudoers 文件:

    vi /etc/sudoers
    

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

    Defaults:jenkins !authenticate
    

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

    【讨论】:

      猜你喜欢
      • 2017-06-19
      • 2019-12-01
      • 2017-10-09
      • 2019-11-25
      • 2020-05-12
      • 2016-01-26
      • 1970-01-01
      • 1970-01-01
      • 2019-05-26
      相关资源
      最近更新 更多