Skip to content

Commit fd94a65

Browse files
committed
Merge branch 'dev' into debug
2 parents e87c805 + d10d295 commit fd94a65

3 files changed

Lines changed: 30 additions & 19 deletions

File tree

.github/workflows/build-debug.yml

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,18 @@ on:
88

99
permissions:
1010
contents: read
11-
packages: write
11+
packages: read
1212

1313
env:
14-
REGISTRY: ghcr.io
14+
REGISTRY: harbor.internal.bppleman.cn:30443
15+
REGISTRY_USERNAME: robot$harbor-bppleman
16+
REGISTRY_SECRET: ${{ secrets.HARBOR_SECRET }}
1517
HTTP_PROXY: http://127.0.0.1:6152
1618
HTTPS_PROXY: http://127.0.0.1:6152
1719

1820
jobs:
1921
build-and-push:
20-
name: 构建多平台镜像并推送到 GHCR
22+
name: 构建多平台镜像并推送到 Harbor
2123
runs-on: [self-hosted, macOS, ARM64]
2224

2325
steps:
@@ -28,42 +30,51 @@ jobs:
2830
- name: 构建 builder 工具
2931
run: cargo install --path crates/builder
3032

33+
- name: 初始化 fnm 环境
34+
run: |
35+
eval "$(fnm env --shell bash)"
36+
fnm use 24
37+
echo "$(dirname $(which node))" >> "$GITHUB_PATH"
38+
3139
- name: 安装 Dashboard 依赖
3240
run: pnpm install
3341
working-directory: dashboard
3442

35-
- name: 登录到 GHCR
43+
- name: 登录到 Harbor
3644
uses: docker/login-action@v3
3745
with:
3846
registry: ${{ env.REGISTRY }}
39-
username: ${{ github.repository_owner }}
40-
password: ${{ secrets.GITHUB_TOKEN }}
47+
username: ${{ env.REGISTRY_USERNAME }}
48+
password: ${{ env.REGISTRY_SECRET }}
4149

4250
- name: Set up Docker Buildx
4351
uses: docker/setup-buildx-action@v3
4452
with:
4553
driver-opts: network=host
4654
config-inline: |
47-
[registry."ghcr.io"]
48-
[registry."ghcr.io".auth]
49-
username = "${{ github.repository_owner }}"
50-
password = "${{ secrets.GITHUB_TOKEN }}"
55+
[registry."${{ env.REGISTRY }}"]
56+
[registry."${{ env.REGISTRY }}".auth]
57+
username = "${{ env.REGISTRY_USERNAME }}"
58+
password = "${{ env.REGISTRY_SECRET }}"
5159
5260
- name: 检查基础镜像可访问性,不存在则构建并推送
5361
run: |
5462
set -e
55-
BASE_IMAGE=$(builder tag base debug --registry ghcr --user ${{ github.repository_owner }})
63+
BASE_IMAGE=$( \
64+
builder tag base debug \
65+
--registry ${{ env.REGISTRY }} \
66+
--user ${{ github.repository_owner }}
67+
)
5668
echo "🔍 检查基础镜像: $BASE_IMAGE"
5769
5870
if docker buildx imagetools inspect "$BASE_IMAGE" > /dev/null 2>&1; then
5971
echo "✅ 基础镜像已存在,跳过构建"
6072
else
6173
echo "⚠️ 基础镜像不存在,开始构建并推送..."
62-
builder image base \
63-
debug \
74+
builder image base debug \
6475
--arch amd,arm \
65-
--user ${{ github.repository_owner }} \
66-
--registry ghcr
76+
--registry ${{ env.REGISTRY }} \
77+
--user ${{ github.repository_owner }}
6778
echo "✅ 基础镜像构建并推送完成"
6879
fi
6980
@@ -77,5 +88,5 @@ jobs:
7788
debug \
7889
--arch amd,arm \
7990
--dashboard \
80-
--user ${{ github.repository_owner }} \
81-
--registry ghcr
91+
--registry ${{ env.REGISTRY }} \
92+
--user ${{ github.repository_owner }}

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ authors = ["BppleMan"]
1414
version = "2.6.15"
1515
edition = "2024"
1616
license = "Apache-2.0"
17-
repository = "https://github.com/BppleMan/convertor"
17+
repository = "https://github.com/convertor-gitops/convertor"
1818

1919
[workspace.dependencies]
2020
# 本地/工作区包

crates/builder/src/commands/image.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ impl ImageCommand {
103103
command
104104
}
105105

106+
#[allow(unused)]
106107
fn cleanup_remote_tag(&self, tag: &Tag, arch: Arch) -> Command {
107108
let mut command = Command::new("docker");
108109
command.arg("rmi").arg(tag.remote(&self.registry, Some(arch), None));
@@ -148,7 +149,6 @@ impl Commander for ImageCommand {
148149
for arch in self.arch.iter().copied() {
149150
commands.push(self.remote_tag_image(&tag, arch));
150151
commands.push(self.push_image(&tag, arch));
151-
commands.push(self.cleanup_remote_tag(&tag, arch));
152152
}
153153
// 最后创建多架构清单并推送,需要包含version标签和latest标签
154154
commands.push(self.manifest_image(&tag, &self.version));

0 commit comments

Comments
 (0)