GitLab CI/CD 自动部署之 Shell 篇

一、安装 gitlab-runner

sudo wget -O /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-amd64
sudo chmod +x /usr/local/bin/gitlab-runner
sudo useradd --comment 'GitLab Runner' --create-home gitlab-runner --shell /bin/bash
sudo gitlab-runner install --user=gitlab-runner --working-directory=/home/gitlab-runner

 

二、注册 gitlab-runner

sudo gitlab-runner register

 

三、编写 .gitlab-ci.yml(先测试一下,后面再改)

stages:
- build
- test
- deploy

build_maven:
  stage: build
  script:
  - echo "build maven....."
  - echo "mvn clean"
  - echo "done"

test_springboot:
  stage: test
  script:
  - echo "run java test....."
  - echo "java -test"
  - echo "done"

deploy_springboot:
  stage: deploy
  script:
  - echo "deploy springboot...."
  - echo "run mvn install"
  - echo "done"

 

 

 

 

 

 

 

 

 

四、后面就可以自己编写 .gitlab-ci.yml 来完成自动部署啦(这个文件后面会好好研究一下)。

五、GitLab CI/CD 自动部署之 Docker 篇

posted @ 2020-11-01 20:42  M-Anonymous  阅读(2221)  评论(0编辑  收藏  举报