diff --git a/services/prow/config/jobs/images/deepin-auto-translation/Dockerfile b/services/prow/config/jobs/images/deepin-auto-translation/Dockerfile new file mode 100644 index 0000000..2dade3d --- /dev/null +++ b/services/prow/config/jobs/images/deepin-auto-translation/Dockerfile @@ -0,0 +1,40 @@ +FROM alpine:latest + +# 配置清华 alpine 源 +RUN cp /etc/apk/repositories /etc/apk/repositories.bak && \ + sed -i 's|dl-cdn.alpinelinux.org|mirrors.tuna.tsinghua.edu.cn|g' /etc/apk/repositories && \ + apk update + +# 安装必要的工具和依赖 +RUN apk add --no-cache \ + bash \ + libstdc++ \ + curl \ + git && \ + # 清理缓存 + rm -rf /var/cache/apk/* + + +# 复制翻译脚本到镜像中 +ADD deepin-auto-translation /app/deepin-auto-translation + +# 安装bun +# 这里使用 curl 下载并执行安装脚本 +RUN curl -fsSL https://bun.sh/install | bash +ENV BUN_INSTALL="~/.bun" \ + PATH="$BUN_INSTALL/bin:$PATH" + +# 安装transifex +# 这里使用 curl 下载并执行安装脚本 +RUN curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash && mv /tx /usr/local/bin/tx + +# 安装脚本运行依赖 +RUN cd /app/deepin-auto-translation && BUN_INSTALL="~/.bun" ~/.bun/bin/bun install + +# 复制入口点脚本到镜像中 +COPY entrypoint /app/entrypoint + +RUN chmod +x /app/entrypoint + +# 设置入口点 +#ENTRYPOINT ["bash", "/app/entrypoint"] diff --git a/services/prow/config/jobs/images/deepin-auto-translation/deepin-auto-translation b/services/prow/config/jobs/images/deepin-auto-translation/deepin-auto-translation new file mode 160000 index 0000000..8b158bb --- /dev/null +++ b/services/prow/config/jobs/images/deepin-auto-translation/deepin-auto-translation @@ -0,0 +1 @@ +Subproject commit 8b158bb0bc52cc45a6f9d6169495530bfd5defbd diff --git a/services/prow/config/jobs/images/deepin-auto-translation/entrypoint b/services/prow/config/jobs/images/deepin-auto-translation/entrypoint new file mode 100644 index 0000000..901d415 --- /dev/null +++ b/services/prow/config/jobs/images/deepin-auto-translation/entrypoint @@ -0,0 +1,17 @@ +#!/bin/bash + +# 设置翻译仓库路径配置 +mkdir -p /app/deepin-auto-translation/repo/${REPO_OWNER}/ +ln -s $(pwd) /app/deepin-auto-translation/repo/${REPO_OWNER}/${REPO_NAME} + + +# 设置git配置 +git config --global user.name "deepin-ci-robot" +git config --global user.email "packages@deepin.org" +git -C /app/deepin-auto-translation pull || true + +# 设置transifix配置 +echo "- o:${REPO_OWNER}:p:${REPO_NAME}" > /app/deepin-auto-translation/transifex-projects.yml + +# 启动翻译脚本 +cd /app/deepin-auto-translation && BUN_INSTALL="~/.bun" ~/.bun/bin/bun index.ts diff --git a/services/prow/config/jobs/submits.yml b/services/prow/config/jobs/submits.yml index af6eb3e..ae01979 100644 --- a/services/prow/config/jobs/submits.yml +++ b/services/prow/config/jobs/submits.yml @@ -335,6 +335,67 @@ desktop-translator: &desktop-translator testgrid-alert-email: hudeng@deepin.org description: Runs Prow desktop-translator job for translating ts files to desktop files. +deepin-auto-translation: &deepin-auto-translation + name: deepin-auto-translation + decorate: true + decoration_config: + timeout: 240m + always_run: true + run_if_changed: ".ts$" + labels: + app: deepin-auto-translation + spec: + nodeSelector: + kubernetes.io/arch: amd64 + hostAliases: + - ip: 10.20.64.81 + hostnames: + - github.com + - ip: 10.20.64.82 + hostnames: + - api.github.com + - ip: 10.20.64.83 + hostnames: + - github.githubassets.com + - ip: 10.20.64.84 + hostnames: + - raw.githubusercontent.com + - ip: 10.20.64.85 + hostnames: + - collector.github.com + - ip: 10.20.64.86 + hostnames: + - avatars.githubusercontent.com + containers: + - name: deepin-auto-translation + image: "hub.deepin.com/prow/deepin-auto-translation:latest" + command: + - /app/entrypoint + env: + - name: GITHUB_TOKEN + valueFrom: + secretKeyRef: + name: obs-api-credential + key: github-token + volumeMounts: + - name: config + mountPath: /app/deepin-auto-translation/secrets.ts + subPath: secrets.ts + readOnly: true + - name: config + mountPath: /root/.transifexrc + subPath: transifexrc + readOnly: true + volumes: + - name: config + configMap: + name: deepin-auto-translation-cfg + annotations: + testgrid-dashboards: sig-deepin-cicd + testgrid-tab-name: deepin-auto-translation + testgrid-alert-email: hudeng@deepin.org + description: Runs Prow deepin-auto-translation job to translate ts files by using llm ai models. + github-pr-review-ci: &github-pr-review-ci name: github-pr-review-ci decorate: false @@ -857,6 +918,8 @@ static-check: &static-check Runs Prow static-check to config , and add comment. presubmits: + peeweep-test/AITest: + - <<: *deepin-auto-translation peeweep-test: - <<: *github-trigger-obs-ci - <<: *github-pr-review-ci @@ -875,17 +938,22 @@ presubmits: linuxdeepin/deepin-osconfig: - <<: *github-trigger-obs-ci - <<: *github-pr-review-ci + - <<: *deepin-auto-translation linuxdeepin/linglong: - <<: *github-trigger-obs-ci - <<: *github-pr-review-ci + - <<: *deepin-auto-translation linuxdeepin/dde-shell: - <<: *github-trigger-obs-ci - <<: *github-pr-review-ci + - <<: *deepin-auto-translation linuxdeepin/dde-tray-loader: - <<: *github-trigger-obs-ci - <<: *github-pr-review-ci + - <<: *deepin-auto-translation linuxdeepin: - <<: *github-pr-review-ci + - <<: *deepin-auto-translation linuxdeepin/treeland.private: - <<: *github-trigger-obs-ci deepin-community/GHC_packages: