In general, the task is simple and clear. It is necessary that when pushing into a branch, the master on the server runs one bash script, and when pushing into the qa branch, another. Is it possible to implement this using gitlab? (! Important - not a web hook). If so, how? Describe what to do. If not, how can this be done?

  • If it is important not a webhuk, then it would be nice to explain why - andreymal
  • then it remains to use GitLab CI and pull the necessary scripts on the server you need - Senior Pomidor
  • @SeniorAutomator, great) can you show an example? the simplest one that just sh. - sanu0074
  • @ sanu0074 Do you have a gitlab installed on a unix system? - Senior Pomidor
  • @SeniorAutomator yes. Test bench on the same server as gitlab. Roughly speaking, you need to pull the script that lies on the same server on which the guitarboot is installed - sanu0074

2 answers 2

You can run different scripts for the master branch and for everyone else you can use the except and only directives. Here is an example .gitlab-ci.yml :

 image: ... stages: - build build_branch: stage: build script: - ./build_branch.sh except: - master build_master: stage: build script: - ./build_master.sh only: - master 

    you can run the script on CI GitLab, and inside these scripts you can do what you want

    go to Project -> Set up CI tab and add script

     run_job_with_some_name: stage: myStage script: - uname -a - pwd - "your some command" 

    in more detail you can read here

    • In general, I wrote a script. I had problems with the teams when running the script from the runner. Updated the question, take a look. - sanu0074