1 2 3 4 5 6 7 8 9 | #prerequisite, openssh-server curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash sudo apt-get install gitlab-ce #sudo vim /etc/gitlab/gitlab.rb # change external_url to local ip. sudo gitlab-ctl reconfigure #sudo cat /etc/gitlab/initial_root_password |
Open browser, visit http://localhost, login as 'root'.
Admin -> CI/CD -> Runners -> Register an instance runner, and get the registration token.
1 2 3 | curl -L "https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh" | sudo bash sudo apt-get install gitlab-runner sudo gitlab-runner register |
.gitlab-ci.yml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | stages: - deps - build - test - deploy cache: paths: - include - lib - bin build-deps: stage: deps script: - echo "will build include and lib to parent directory..." - cd 3rdParty; ./build_all.sh build-job: stage: build script: - g++ helloworld.cpp -o bin/helloworld unit-test-job: stage: test script: - chmod +x helloworld.sh - ./helloworld.sh lint-test-job: stage: test script: - sleep 10 deploy-job: stage: deploy environment: production script: - ./pack.sh artifacts: paths: - bin.tgz expire_in: 4 days |
refer to:
https://blog.csdn.net/weixin_47358139/article/details/126267861
https://blog.csdn.net/qq_42001163/article/details/122938040
https://blog.51cto.com/flyfish225/2145495
https://blog.csdn.net/zyy247796143/article/details/123842374