gitlab 令牌使用 gitlab runner

2021-10-18 11:16:00 字數 2135 閱讀 6910

# curl -l --output /usr/local/bin/gitlab-runner "https://gitlab-runner- downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-386" (大概要半小時左右)

2.給二進位制檔案新增執行許可權

# chmod +x /usr/local/bin/gitlab-runner

3.建立gitlab-ci使用者

# useradd --comment 'gitlab runner' --create-home test --shell /bin/bash

4.安裝啟動

# gitlab-runner install --user=test --working-directory=/home/test

5.檢視gitlab-runner版本與資訊

# gitlab-runner -v

# gitlab-runner register 手動填寫註冊

runtime platform arch=amd64 os=linux pid=11348

revision=943fc252 version=13.6.0

running in system-mode.

enter the gitlab instance url (for example, 輸入gitlab的url

​enter the registration token: #輸入註冊令牌

​enter a description for the runner: #輸入runner的描述 [gitlab-cicd]:

test

enter tags for the runner (comma-separated): #輸入標籤

test

registering runner... succeeded runner=k-_pmtnn

enter an executor: virtualbox, custom, shell, ssh, docker+machine, docker-ssh+machine, kubernetes, docker, docker-ssh, parallels: #輸入以何種方式提供runner

sshenter the ssh server address (for example, my.server.com): #輸入ssh的位址

192.168.38.160

enter the ssh server port (for example, 22): #輸入ssh的埠

22enter the ssh user (for example, root): #輸入使用ssh的使用者

root

enter the ssh password (for example, docker.io): #輸入使用ssh的使用者的密碼

123456

enter the path to the ssh identity file (for example, /home/user/.ssh/id_rsa): #輸入ssh私鑰位址

/root/.ssh/id_rsa

runner registered successfully. feel free to start it, but if it's running already the config should be automatically reloaded!

​顯示successfully即為註冊成功

url和註冊令牌在gitlab-server上可以進行查詢

# gitlab-runner status 檢視執行狀態

# gitlab-runner stop 關閉gitlab-runner

# gitlab-runner start 啟動gitlab-runner

# gitlab-runner restart 重啟gitlab-runner

gitlab使用攻略

一 首次使用授權 git bash裡配置ssh key ssh keygen t rsa c cat ssh id rsa.pub 二 clone專案 git clone git git git branch git branch dev git checkout b dev git reset h...

Gitlab使用總結

1.從某一功能分支新建乙個自己的開發分支 二.將master分支clone到本地 三.切換到自己的開發分支 git branch a git checkout new branch 四.修改後push到遠端倉庫 git add a git commit git push 五.在後台發起merge r...

GitLab使用教程

1 本地安裝git 2 git 配置使用者名稱密碼 git config global user.name administrator git config global user.email admin example.com 3 建立乙個新專案 流程 登入到gitlab伺服器建立專案 本地建立相...