簡體   English   中英

合並提交后在git ci / cd上觸發腳本

[英]Trigger scripts on git ci/cd after merge committed

我想做一些從git ci / cd調用的腳本。 引發合並請求時,應先執行第一個腳本,然后在管理員提交請求后,我要執行另一個腳本

這是我現在在.yml上的代碼:

script1:
  script: 
  - sshpass -p password ssh user@host "cmd.exe /c powershell.exe path\to\local\script1"  
  only:
  - merge_requests

script2:
  script: 
  - sshpass -p password ssh user@host "cmd.exe /c powershell.exe path\to\local\script2"  
  stage: deploy

有了這些代碼,git ci仍然在拋出合並請求時執行我的script2,並且在提交請求后部署我的master分支。 我只想執行script2代碼中描述的腳本,而無需進行任何部署。

最后,我只在目標分支上使用。

這是我正在使用的最終代碼:

script1:
  script: 
  - sshpass -p password ssh user@host "cmd.exe /c powershell.exe path\to\local\script1"  
  only:
  - merge_requests

script2:
  script: 
  - sshpass -p password ssh user@host "cmd.exe /c powershell.exe path\to\local\script2"  
  only:
  - mytargetbranch

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM