-
Notifications
You must be signed in to change notification settings - Fork 2
doc: add how to write upgrade doc #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,11 +46,40 @@ mv upgrade-ubuntu-latest-amd64 upgrade && chmod +x upgrade | |
| - 数据准备多次执行应该具备幂等性,确保可以重复运行。 | ||
| - 需要添加 `skip-clean-namespace` 的 Tag 确保执行后实例不被清理。 | ||
|
|
||
| ```feature | ||
| 功能: gitlab 升级 | ||
|
|
||
| @priority-high | ||
| @e2e | ||
| @prepare-17.8 | ||
| @prepare-17.11 | ||
| @gitlab-operator-prepare-upgrade | ||
| @skip-cleanup-namespace | ||
| @allure.label.case_id:gitlab-operator-prepare-upgrade | ||
| 场景: 安装 gitlab 实例,准备数据 | ||
| 假定 命名空间 "gitlab-upgrade" 已存在 | ||
| 并且 集群已安装 ingress controller | ||
| 当 已导入 "gitlab 实例" 资源 | ||
| """ | ||
| yaml: ./testdata/values-gitlab-upgrade.yaml | ||
| onConflict: ignore | ||
| """ | ||
| 并且 导入测试数据到 Gitlab 成功 | ||
| """ | ||
| url: http://test-gitlab-upgrade.example.com | ||
| username: root | ||
| password: 07Apples@ | ||
| timeout: 15m | ||
| importProjectPath: ./testdata/resources/test-upgrade-repo_export.tar.gz | ||
| """ | ||
| ``` | ||
|
|
||
| 2. 检查升级数据。 | ||
|
|
||
| - 和数据准备相对应,负责升级实例以及检查准备的数据是否丢失。 | ||
| - 存在多次升级时,需要添加 `skip-clean-namespace` 的 Tag 确保执行后实例不被清理。 | ||
|
|
||
|
|
||
| ### 编写配置文件 | ||
|
|
||
| 将文件保存为 upgrade.yaml | ||
|
|
@@ -61,18 +90,56 @@ operatorConfig: | |
| namespace: gitlab-ce-operator # operator 部署 ns | ||
| name: gitlab-ce-operator # operator 名称 | ||
| upgradePaths: # 定义升级路径,可以包含多个 | ||
| - name: v17.8 upgrade to v17.11 # 升级名称 | ||
| versions: # 定义升级路经 | ||
| - name: v17.8 # 版本名称 | ||
| testCommand: | # 执行测试指令 | ||
| gitlab17.8.test --godog.concurrency=1 --godog.format=allure --godog.tags=@prepare | ||
| bundleVersion: v17.8.10 # bundle 版本号 | ||
| channel: stable | ||
| - name: v17.11 # 版本名称 | ||
| testCommand: | | ||
| gitlab17.11.test --godog.concurrency=1 --godog.format=allure --godog.tags=@upgrade --bdd.cleanup=false | ||
| bundleVersion: v17.11.1 # bundle 版本号 | ||
| channel: stable | ||
| - name: v17.8 upgrade to v17.11 # 升级名称 | ||
| versions: # 定义升级路经 | ||
| - name: v17.8 # 版本名称 | ||
| testCommand: | | ||
| [email protected] GODOG_ARGS="--godog.format=allure" make test | ||
| bundleVersion: v17.8.10 | ||
| channel: stable | ||
| - name: v17.11 # 版本名称 | ||
| testCommand: | | ||
| [email protected] GODOG_ARGS="--godog.format=allure --bdd.cleanup=false" make test | ||
| bundleVersion: v17.11.1 | ||
| channel: stable | ||
| ``` | ||
|
|
||
| ### 构建测试镜像 | ||
|
|
||
| 需要在测试镜像中添加升级测试的制品: | ||
|
|
||
| ```dockerfile | ||
| FROM docker-mirrors.alauda.cn/library/golang:1.24-bookworm AS builder | ||
|
|
||
| WORKDIR /tools | ||
| RUN mkdir -p /tools/bin | ||
|
|
||
| COPY testing /app | ||
| ENV GOPROXY='https://build-nexus.alauda.cn/repository/golang/,direct' | ||
| RUN set -eux; \ | ||
| cd /app && \ | ||
| go test -c -o /tools/bin/gitlab.test ./ | ||
|
|
||
| # add content | ||
| # renovate: datasource=github-releases depName=upgrade-test packageName=AlaudaDevops/upgrade-test | ||
| ARG UPGRADE_TEST_VERSION=v0.0.5 | ||
| RUN if [ "$(arch)" = "arm64" ] || [ "$(arch)" = "aarch64" ]; then ARCH="arm64"; else ARCH="amd64"; fi; \ | ||
| wget https://github.com/AlaudaDevops/upgrade-test/releases/download/${UPGRADE_TEST_VERSION}/upgrade-ubuntu-latest-${ARCH} && \ | ||
| mv upgrade-ubuntu-latest-${ARCH} /tools/bin/upgrade && \ | ||
| chmod +x /tools/bin/upgrade | ||
| # add end | ||
|
|
||
| FROM build-harbor.alauda.cn/devops/test-bdd:latest | ||
|
|
||
| COPY --from=builder /tools/bin/gitlab.test /tools/bin/gitlab.test | ||
| COPY --from=builder /tools/bin/upgrade /tools/bin/upgrade | ||
| COPY . /app | ||
|
|
||
| WORKDIR /app/testing | ||
| ENV TEST_COMMAND="gitlab.test" | ||
|
|
||
| ENTRYPOINT ["gitlab.test"] | ||
| CMD ["--godog.concurrency=2", "--godog.format=allure", "[email protected]"] | ||
| ``` | ||
|
|
||
| ### 运行测试 | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
升级路径为空时,提示用户。