基本框架
This commit is contained in:
9
ansible/files/gitlab/README.md
Normal file
9
ansible/files/gitlab/README.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# GitLab CI 示例(与 docs 对照)
|
||||
|
||||
| 文件 | 文档 |
|
||||
|------|------|
|
||||
| `gitlab-ci-minimal.example.yml` | `docs/05-04-k3s-配置gitlab-cicd.md` |
|
||||
| `gitlab-ci-multi-arch-deploy.example.yml` | `docs/05-04-k3s-配置gitlab-cicd.md` |
|
||||
| `gitlab-ci-runner-tags.example.yml` | `docs/05-03-k3s-安装gitlab-含runner.md` |
|
||||
|
||||
复制为 `.gitlab-ci.yml` 或 `include` 引用;变量与 Runner 以文档为准。
|
||||
20
ansible/files/gitlab/gitlab-ci-minimal.example.yml
Normal file
20
ansible/files/gitlab/gitlab-ci-minimal.example.yml
Normal file
@@ -0,0 +1,20 @@
|
||||
# docs/05-04-k3s-配置gitlab-cicd.md — 最小 .gitlab-ci.yml 示例
|
||||
stages:
|
||||
- lint
|
||||
- deploy
|
||||
|
||||
variables:
|
||||
KUBECONFIG: "/builds/${CI_PROJECT_PATH}/kubeconfig"
|
||||
|
||||
lint:
|
||||
stage: lint
|
||||
script:
|
||||
- yamllint manifests || true
|
||||
|
||||
deploy:
|
||||
stage: deploy
|
||||
script:
|
||||
- echo "$KUBE_CONFIG_CONTENT" > "$KUBECONFIG"
|
||||
- kubectl --kubeconfig="$KUBECONFIG" apply -f manifests/
|
||||
only:
|
||||
- main
|
||||
14
ansible/files/gitlab/gitlab-ci-multi-arch-deploy.example.yml
Normal file
14
ansible/files/gitlab/gitlab-ci-multi-arch-deploy.example.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
# docs/05-04-k3s-配置gitlab-cicd.md — 多架构 Runner tags 示例
|
||||
deploy_x86:
|
||||
stage: deploy
|
||||
tags: [x86]
|
||||
script:
|
||||
- echo "$KUBE_CONFIG_CONTENT" > "$KUBECONFIG"
|
||||
- kubectl --kubeconfig="$KUBECONFIG" apply -f manifests/x86/
|
||||
|
||||
deploy_arm64:
|
||||
stage: deploy
|
||||
tags: [arm64]
|
||||
script:
|
||||
- echo "$KUBE_CONFIG_CONTENT" > "$KUBECONFIG"
|
||||
- kubectl --kubeconfig="$KUBECONFIG" apply -f manifests/arm64/
|
||||
15
ansible/files/gitlab/gitlab-ci-runner-tags.example.yml
Normal file
15
ansible/files/gitlab/gitlab-ci-runner-tags.example.yml
Normal file
@@ -0,0 +1,15 @@
|
||||
# docs/05-03-k3s-安装gitlab-含runner.md — Runner tag 与 job 对应示例
|
||||
build_x86:
|
||||
tags: [x86]
|
||||
script:
|
||||
- echo "build for x86"
|
||||
|
||||
build_arm64:
|
||||
tags: [arm64]
|
||||
script:
|
||||
- echo "build for arm64"
|
||||
|
||||
build_armv7:
|
||||
tags: [armv7]
|
||||
script:
|
||||
- echo "build for armv7"
|
||||
Reference in New Issue
Block a user