Jenkins节点抛出script.sh:2://:Permission denied error

gev0vcfq  于 2023-10-17  发布在  Jenkins
关注(0)|答案(1)|浏览(160)

我有一个连接到节点的Jenkins master。我试图在master上执行一个pipeline,以便在连接的节点上运行一个作业,在node中我有一些命令要运行。但是,当我运行管道时,我遇到了以下错误:

  • /home/ubuntu/workspace/node-pipetest@tmp/durable-87636e52/script.sh:2://:Permission denied*

错误:脚本返回退出代码126
此错误表示尝试在连接的节点上执行脚本时存在权限问题。我已经更新了chmod的权限,完全访问。还是无法解决这个问题

pipeline {
  agent any
  stages {
    stage('Dev Build') {
      agent { label 'dev-node' }
      steps {
        // shell script follows
        sh '''\
pwd

// If the application is running, kill it
sudo fuser -k 80/tcp

// This is the auto update all the repo updates
sudo apt-get update

// Install maven
sudo apt install -y maven
'''
      }
    }
  }
}
Started by user Admin Team
[Pipeline] Start of Pipeline
[Pipeline] node
Running on qa-node in /home/ubuntu/workspace/node-pipetest
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Dev Build)
[Pipeline] node
Running on dev-node in /home/ubuntu/workspace/node-pipetest
[Pipeline] {
[Pipeline] sh
+ sudo chmod +x /home/ubuntu/workspace/node-pipetest@tmp/
+ // If the application is running, kill it
/home/ubuntu/workspace/node-pipetest@tmp/durable-9d8ad363/script.sh: 5: //: Permission denied
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 126
Finished: FAILURE
z2acfund

z2acfund1#

看起来你试图使用//注解bash脚本中的一行,它抱怨说这不是一件事。
你是说#

相关问题