gitlab cicd

-

创建 container runner

dockerfile

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.134.1/containers/ubuntu/.devcontainer/base.Dockerfile
ARG VARIANT="focal"
FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT}

# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>


RUN curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-ci-multi-runner/script.deb.sh | sudo bash
RUN yes | sudo apt-get install gitlab-ci-multi-runner
RUN printf 'https://gitlab.uuzu.com/\nAMJJgESUzDLumCZgSU5y\nrunner\nrunner\nshell\n' | sudo gitlab-ci-multi-runner register
RUN gitlab-ci-multi-runner start
RUN yes | apt-get install rsync
RUN yes | ssh-keygen -t rsa -C "$(whoami)@$(hostname)-$(date -I)"
  • Install GitLab Runner
  • Specify the following URL during the Runner setup: https://gitlab.uuzu.com/
  • Use the following registration token during setup: AMJJgESUzDLumCZgSU5y
  • Start the Runner! gitlab-ci-multi-runner start
  • 查看 runner list sudo gitlab-runner list

.gitlab-ci.yml

1
2
3
4
5
6
7
8
9
10
11
12
stages:
- build_QA

# 测试
build_QA:
script:
- echo "hello"
- rsync -rve ssh test.txt /workspaces/gitlab-runner

stage: build_QA
only:
- /release/

gitlab 项目配置

Variables

SSH_PRIVATE_KEY:把本机(runner所在机器)的私钥复制过来:~/.ssh/id_rsa

-

runner

-


  gitlab
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×