Notion Blog
心情随笔1 分钟阅读

bitbucket的pipeline使用(进入服务器运行脚本)

1、 SSH配置,

服务器和bitbucket都要配置,方便提交代码后进入服务器运行脚本

将公钥复制到远程主机上的~/.ssh/authorized_keys 中

pipelines配置

登录指定服务器运行服务器上的脚本

服务器run.sh 脚本

git pull
pid=`lsof -i:443 |tail -n 1 |awk '{print $2}'`
kill -9 $pid
python3.8 /app/mock/wk-mock/main.py

bitbucket-pipelines.yaml 脚本

pipelines:
  branches:
    master:
      - step:
          name: Build and deploy to test
          deployment: test
          script:
            - pipe: atlassian/ssh-run:0.2.8
              variables:
                SSH_USER: 'root'
                SERVER: '124.XX.XX.214'
                COMMAND: 'cd /app/mock/wk-mock/;nohup sh run.sh >/app/mock/wk-mock/log.log 2>&1 &'
          after-script:
              # Collect checkstyle results, if any, and convert to Bitbucket Code Insights.
            - pipe: atlassian/checkstyle-report:0.2.0




有关使用上的问题,欢迎您在底部评论区留言,一起交流~

读者评论

评论会同步写入该文在 Notion 中的页面底部(与正文同页,便于管理)。

0/1500

暂无评论,欢迎抢沙发。