本文的主线 GitLab => GitLab Runner => Project => 问题
GitLab
wget --content-disposition https://packages.gitlab.com/gitlab/gitlab-ce/packages/ubuntu/bionic/gitlab-ce_12.6.7-ce.0_amd64.deb/download.deb
sudo EXTERNAL_URL="http://172.10.66.100" dpkg -i gitlab-ce_12.6.7-ce.0_amd64.deb
GitLab Runner
# Runner Executor基于Docker
sudo apt install -y docker.io
- 配置镜像加速器 => 镜像工具 => 镜像加速器
wget https://gitlab-runner-downloads.s3.amazonaws.com/latest/deb/gitlab-runner_amd64.deb
sudo dpkg -i gitlab-runner_amd64.deb
sudo gitlab-runner register
# http://172.10.66.100/
# 输入这里的token => http://172.10.66.100/admin/runners
# docker
# java:8-jdk
Project
vim .gitlab-ci.yml
stages:
- build
- test
- deploy
build:
stage: build
image: java:8-jdk
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- .gradle/wrapper
- .gradle/caches
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
script:
- ./gradlew assemble
artifacts:
paths:
- build/libs/*.jar
- 构建成功后下载artifacts.zip
unzip artifacts.zip
java -jar build/libs/java-demo-0.0.1-SNAPSHOT.jar
网友评论