构建步骤“执行外壳"将构建标记为失败 [英] Build step 'Execute shell' marked build as failure

查看:152
本文介绍了构建步骤“执行外壳"将构建标记为失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在jenkins项目中有一个构建步骤.这是一个执行外壳程序步骤.

I have a build step in my jenkins project. This is an Execute Shell step.

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

The following is the command is what I am running.

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

在部署过程中,以上步骤中断了构建过程,并出现以下错误.

During the deployment the above step breaks the build, with the following error.

sudo gcloud --project = cfc-melbourne-website预览应用程序部署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

我该如何解决?

推荐答案

no tty present错误表明您在sudoers文件中具有requiretty设置.这将需要一个tty.为了解决这个问题,您可以将用户添加到该文件中,然后打开.

The no tty present error indicates that you have the requiretty setting in your sudoers file. This will require a tty. To solve this you can add your user to that file and turn .

更改您的sudoers文件:

change your sudoers-file:

vi /etc/sudoers

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

and add (assuming it's your jenkins-user):

Defaults:jenkins !authenticate

通常,您的jenkins用户无需身份验证即可使用sudo命令.

Normally your jenkins user can use sudo-commands without authentication.

这篇关于构建步骤“执行外壳"将构建标记为失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆