-bash: ./deploy.sh: /bin/bash^M: bad interpreter: No such file or directory

文章目录

场景

jenkins 发布失败, 报错ERROR: Exception when publishing, exception message [Exec exit status not zero. Status [126]], 这说明远程服务器的deploy.sh执行失败, 首先检查权限,没有发现问题,然后手动执行一遍又报错"-bash: ./deploy.sh: /bin/bash^M: bad interpreter: No such file or directory", 这个意味着脚本是windows回车符结尾

txt 复制代码
[JENKINS] Archiving /home/vagrant/.jenkins/workspace/jenkinsDemo/target/jenkinsDemo-1.0-SNAPSHOT.jar to com.carsonlius/jenkinsDemo/1.0-SNAPSHOT/jenkinsDemo-1.0-SNAPSHOT.jar
channel stopped
SSH: Connecting from host [ubuntu-xenial]
SSH: Connecting with configuration [107.173.111.224 自己] ...
SSH: EXEC: completed after 604 ms
SSH: Disconnecting configuration [107.173.111.224 自己] ...
ERROR: Exception when publishing, exception message [Exec exit status not zero. Status [126]]
Build step 'Send build artifacts over SSH' changed build result to UNSTABLE

解决

sed -i -e 's/\r$//' deploy.sh

相关推荐
牛奶咖啡139 小时前
CI/CD——使用Jenkins实现自动化部署与持续集成之jenkins插件与凭据配置
ci/cd·jenkins·jenkins必备插件安装·jenkins全局工具配置·jenkins的凭据配置·jenkins自动化部署流程·jenkinsgitlab集成
摇滚侠9 小时前
DSL 学习 ElasticSearch 主要就是学习 DSL 查询语言
学习·elasticsearch·jenkins
IMPYLH14 小时前
Linux 的 touch 命令
linux·运维·服务器·bash
有一个好名字1 天前
工具即双手 —— 从 Bash 到 Tool Dispatch Map
开发语言·chrome·bash
IMPYLH1 天前
Linux 的 test 命令
linux·运维·服务器·chrome·bash
IMPYLH2 天前
Linux 的 tee 命令
linux·运维·服务器·bash
庚昀◟2 天前
腾讯云 CVM + Docker + Jenkins + GitLab CI/CD 全流程指南(python、flask实现简单计算器)
python·ci/cd·docker·flask·jenkins
牛奶咖啡132 天前
CI/CD——使用Jenkins实现自动化部署与持续集成
ci/cd·jenkins·jenkins是什么?有啥用·jenkins有哪些适用场景·jenkins的优缺点·jenkins的安装部署·jenkins安装必备环境
测试那点事儿3 天前
第10章 零基础接口自动化到 Jenkins 持续集成【定时监控与邮件告警完整落地】
ci/cd·自动化·jenkins
a***72893 天前
Java进阶(ElasticSearch的安装与使用)
java·elasticsearch·jenkins