fix: 因为runner为动态分配,清理工作应该在每个阶段直接执行

This commit is contained in:
2023-08-11 09:43:54 +08:00
parent f7b6a74a5e
commit b077953f59
+3 -8
View File
@@ -40,6 +40,7 @@ build-arm64:
- arm64
script:
- docker buildx build --platform=linux/arm64 --pull -t "$IMG_URL$IMG_TAG-linux-arm64" . --push
- docker rmi "$IMG_URL$IMG_TAG-linux-arm64"
build-amd64:
stage: build
@@ -47,6 +48,7 @@ build-amd64:
- amd64
script:
- docker buildx build --platform=linux/amd64 --pull -t "$IMG_URL$IMG_TAG-linux-amd64" . --push
- docker rmi "$IMG_URL$IMG_TAG-linux-amd64"
build-artifact:
stage: build
@@ -54,6 +56,7 @@ build-artifact:
script:
- docker manifest create "$IMG_URL$IMG_TAG" "$IMG_URL$IMG_TAG-linux-arm64" "$IMG_URL$IMG_TAG-linux-amd64"
- docker manifest push "$IMG_URL$IMG_TAG"
- docker manifest rm "$IMG_URL$IMG_TAG"
# 测试阶段任务
test:
@@ -69,11 +72,3 @@ deploy:
stage: deploy
script:
- echo "deploy stage"
# 清理临时镜像
clean:
stage: .post
script:
- docker rmi "$IMG_URL$IMG_TAG-linux-arm64"
- docker rmi "$IMG_URL$IMG_TAG-linux-amd64"
- docker manifest rm "$IMG_URL$IMG_TAG"