diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f78f698..e5788c3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -42,7 +42,7 @@ jobs: with: build-root-directory: src/backend/core gradle-version: 6.7.1 - arguments: clean buildAndCopyZip -DmavenCredUserName=${{ secrets.NAME }} -DmavenCredPassword=${{ secrets.GITHUB_TOKEN }} -DmavenRepoUrl=http://maven.aliyun.com/nexus/content/groups/public/ + arguments: clean buildZipWithEn -DmavenCredUserName=${{ secrets.NAME }} -DmavenCredPassword=${{ secrets.GITHUB_TOKEN }} -DmavenRepoUrl=http://maven.aliyun.com/nexus/content/groups/public/ - name: Upload a Build Artifact uses: actions/upload-artifact@v2 with: @@ -59,7 +59,7 @@ jobs: release_name: ${{ github.ref }} draft: true prerelease: true - - name: Upload Release Asset + - name: Upload ZH_CN Release Asset uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -68,3 +68,12 @@ jobs: asset_path: src/backend/core/build/distributions/CodeCCCheckAtom.zip asset_name: CodeCCCheckAtom.zip asset_content_type: application/zip + - name: Upload EN Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: src/backend/core/build/distributions/CodeCCCheckAtom_en.zip + asset_name: CodeCCCheckAtom_en.zip + asset_content_type: application/zip diff --git a/.gitignore b/.gitignore index ec33037..959c739 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .codecc .idea -.vscode \ No newline at end of file +.vscode +target diff --git a/doc/aboutCodeCC.md b/docs/aboutCodeCC.md similarity index 100% rename from doc/aboutCodeCC.md rename to docs/aboutCodeCC.md diff --git a/doc/aboutCodeCC_en.md b/docs/aboutCodeCC_en.md similarity index 100% rename from doc/aboutCodeCC_en.md rename to docs/aboutCodeCC_en.md diff --git a/doc/desc.md b/docs/desc.md similarity index 100% rename from doc/desc.md rename to docs/desc.md diff --git a/doc/desc_en.md b/docs/desc_en.md similarity index 100% rename from doc/desc_en.md rename to docs/desc_en.md diff --git a/src/backend/core/build.gradle b/src/backend/core/build.gradle index 2d6ff3c..bef7ec9 100644 --- a/src/backend/core/build.gradle +++ b/src/backend/core/build.gradle @@ -120,21 +120,47 @@ allprojects { into "../../frontend/target/frontend" } - task buildZip(type: Zip, dependsOn: [shadowJar, copyFrontend]) { - from "build/libs", "task.json", "quality.json", "../../frontend/target" + task cleanTarget(type:Delete) { + delete "../../../target" + } + + task copyDocs(type:Copy) { + from "../../../docs" + into "../../../target/file/docs" + } + + task copyImages(type:Copy) { + from "../../../images" + into "../../../target/file/images" + } + + task buildZipCn(type: Zip, dependsOn: [shadowJar, copyFrontend, cleanTarget, copyDocs, copyImages]) { + from "build/libs", "task.json", "quality.json", "../../frontend/target", "../../../target" into "CodeCCCheckAtom" + archiveName "CodeCCCheckAtom.zip" } - task buildAndCopyZip(type: Copy, dependsOn: [buildZip]) { - from "build/distributions" - into "build/distributions" + task renameEnTaskJson(type:Copy) { + from "task_en.json" + into "../../../target/" rename { String fileName -> // a simple way is to remove the "-$version" from the jar filename // but you can customize the filename replacement rule as you wish. - fileName = "CodeCCCheckAtom.zip" + fileName = "task.json" } } + task buildZipWithEn(type: Zip, dependsOn: [buildZipCn, renameEnTaskJson]) { + from "build/libs", "quality.json", "../../frontend/target", "../../../target" + into "CodeCCCheckAtom" + archiveName "CodeCCCheckAtom_en.zip" + } + +// task buildAndCopyZip(type: Copy, dependsOn: [buildZipCn, buildZipEn]) { +// from "build/distributions" +// into "build/distributions" +// } + check.dependsOn ktlint // 固定入口类 不要改 diff --git a/src/backend/core/task.json b/src/backend/core/task.json index 7456020..eed9fa8 100644 --- a/src/backend/core/task.json +++ b/src/backend/core/task.json @@ -242,5 +242,27 @@ "type": "string", "description": "CodeCC任务是否运行成功,成功则未true,不然取不到" } + }, + "releaseInfo": { + "projectId": "demo", + "name": "CodeCC代码检查", + "language": "java", + "logoUrl": "${{indexFile(\"images/logo.png\")}}", + "category": "TASK", + "classifyCode": "scm", + "jobType": "AGENT", + "os": ["LINUX", "MACOS", "WINDOWS"], + "labelCodes": [], + "summary":"支持Linux、MacOS、Windows系统下执行所有CodeCC代码检查工具,包括代码缺陷(bkcheck等)、安全漏洞(敏感信息、高危组件等)、代码规范(CppLint、CheckStyle等)、圈复杂度、重复率等。", + "description": "${{indexFile(\"docs/aboutCodeCC.md\")}}", + "configInfo": { + "frontendType": "SPECIAL" + }, + "versionInfo": { + "publisher": "admin", + "releaseType": "NEW", + "version": "1.0.0", + "versionContent": "Test" + } } } \ No newline at end of file diff --git a/src/backend/core/task_en.json b/src/backend/core/task_en.json new file mode 100644 index 0000000..6919fac --- /dev/null +++ b/src/backend/core/task_en.json @@ -0,0 +1,268 @@ +{ + "atomCode": "CodeCCCheckAtom", + "execution": { + "packagePath": "CodeCCCheckAtom.jar", + "language": "java", + "minimumVersion": "1.8", + "deFmands": [], + "target": "$bk_java_path -Dfile.encoding=utf8 -jar CodeCCCheckAtom.jar" + }, + "input": { + "languages": { + "rule": {}, + "type": "atom-checkbox-list", + "required": true, + "label": "Programming Language", + "list": [], + "default": [], + "desc": "tools will match different programming language", + "tabName": "basic" + }, + "tools": { + "rule": {}, + "required": true, + "hidden": true, + "type": "atom-checkbox-list", + "label": "Code Review Tool", + "list": [], + "default": [], + "tabName": "basic" + }, + "asyncTask": { + "rule": {}, + "type": "enum-input", + "label": "Sync Method", + "list": [ + { + "value": false, + "label": "Synchronize" + }, + { + "value": true, + "label": "Asynchronous" + } + ], + "default": false, + "desc": "", + "tabName": "main", + "inline": true + }, + "asyncTaskId": { + "rule": { + "asyncTaskRequired": true + }, + "type": "task-select", + "label": "Task", + "required": true, + "tabName": "async", + "inline": true, + "list": {}, + "default": "", + "rely": {}, + "desc": "You can choose to create a task yourself in the CodeCC service, or you can directly enter the task ID. The task ID can be obtained from the CodeCC link (in /codecc/myproj/task/25324/, 25324 is the task ID). Support pipeline variables." + }, + "goPath": { + "rule": {}, + "type": "vuex-input", + "label": "GOPATH", + "default": "", + "required": false, + "desc": "Help find the code path of the dependent library to get a more useful result", + "placeholder": "Relative paths under {WORKSPACE}, please use comma to separate multiple paths, support pipeline variables", + "tabName": "basic", + "inline": true, + "rely": { + "operation": "AND", + "expression": [ + { + "key": "tools", + "value": "GOML" + } + ] + } + }, + "pyVersion": { + "rule": {}, + "type": "enum-input", + "label": "Python Version", + "required": true, + "list": [ + { + "label": "Python2", + "value": "py2" + }, + { + "label": "Python3", + "value": "py3" + } + ], + "default": "py3", + "tabName": "basic", + "inline": true, + "rely": { + "operation": "AND", + "expression": [ + { + "key": "tools", + "value": "PYLINT" + } + ] + } + }, + "scriptType": { + "rule": {}, + "type": "enum-input", + "label": "Script Type", + "required": true, + "hidden": false, + "list": [ + { + "id": "sh", + "value": "SHELL", + "label": "Shell" + } + ], + "default": "SHELL", + "tabName": "basic", + "lang": "sh", + "inline": true + }, + "script": { + "rule": { + "scriptRequired": true + }, + "label": "Script", + "hidden": false, + "default": "#Coverity/Klocwork will compile your code by calling the compilation script to identify defects\n# Please use build tools such as maven/cmake to write a compilation script build.sh\n# Make sure build.sh can compile the code\n# cd path/to/build.sh\n# sh build.sh", + "required": true, + "type": "atom-ace-editor", + "desc": "The corresponding tool will use this script to compile the code in order to track the compilation process and find code defects", + "tabName": "basic" + }, + "languageRuleSetMap": { + "hidden": true, + "default": {} + }, + "C_CPP_RULE": { + "rule": { + "ruleSetRequired": true + }, + "type": "rule-set-select", + "label": "C/C++", + "required": true, + "tabName": "basic", + "inline": true, + "list": {}, + "default": [], + "rely": { + "operation": "AND", + "expression": [ + { + "key": "languages", + "value": "C_CPP" + } + ] + } + }, + "multiPipelineMark": { + "rule": {}, + "label": "label", + "placeholder": "Optional. Only numbers, letters, and underscores are supported.", + "type": "vuex-input", + "default": "", + "tabName": "basic", + "desc": "If the pipeline has multiple code analysis plugins, a label can be used to distinguish them.", + "inline": true + }, + "toolScanType": { + "rule": {}, + "type": "radio-group", + "label": "Scan Method", + "required": true, + "list": [ + { + "label": "Incremental Scan(recommended)", + "value": "1" + }, + { + "label": "MR/PR Scan", + "value": "2" + }, + { + "label": "Full Scan", + "value": "0" + } + ], + "default": "1", + "desc": "Incremental scan: Scan the difference code between current build and previous build. Full scan will be used in the first time.\nMR/PR Scan: Scan the difference code between the source branch and the target branch of MR/PR. The source branch code needs to be pulled to the workspace\nFull Scan: Scan all codes. Klocwork, Pinpoint, Gometalinter, and repetition rate only support this scanning method." + }, + "mrCommentEnable": { + "label": "", + "default": true, + "type": "atom-checkbox", + "text": "Sync the defect info to Tencent internal Git viewing page" + }, + "newDefectJudgeFromDate": { + "default": "", + "label": "New Alerts Threshold", + "desc": "Alerts sent after the selected date are New Alerts" + }, + "transferAuthorList": { + "default": [], + "type": "author-transfer", + "label": "change owner", + "desc": "Alerts will sent to the new owner when the tools's ownership changed " + }, + "path": { + "default": [], + "type": "item-edit" + }, + "customPath": { + "default": [], + "type": "item-edit" + }, + "openScanPrj": { + "label": "", + "default": false, + "placeholder": "", + "type": "atom-checkbox", + "text": "use open sourced tool to scan project", + "desc": "Use open sourced scanning tool when selected", + "required": false, + "disabled": false, + "hidden": true + } + }, + "output": { + "BK_CI_CODECC_TASK_ID": { + "type": "string", + "description": "CodeCC task id" + }, + "BK_CI_CODECC_TASK_STATUS": { + "type": "string", + "description": "Whether the CodeCC task runs successfully" + } + }, + "releaseInfo": { + "projectId": "demo", + "name": "CodeCC Code Check", + "language": "java", + "logoUrl": "${{indexFile(\"images/logo.png\")}}", + "category": "TASK", + "classifyCode": "scm", + "jobType": "AGENT", + "os": ["LINUX", "MACOS", "WINDOWS"], + "labelCodes": [], + "summary":"Support all CodeCC code inspection tools under Linux, MacOS, and Windows systems, including code defects (bkcheck, etc.), security vulnerabilities (sensitive information, high-risk components, etc.), code specifications (CppLint, CheckStyle, etc.), cyclomatic complexity, repetition rate, etc. .", + "description": "${{indexFile(\"docs/aboutCodeCC_en.md\")}}", + "configInfo": { + "frontendType": "SPECIAL" + }, + "versionInfo": { + "publisher": "admin", + "releaseType": "NEW", + "version": "1.0.0", + "versionContent": "Test" + } + } +} \ No newline at end of file diff --git a/src/frontend/package.json b/src/frontend/package.json index ea117cc..660f92d 100644 --- a/src/frontend/package.json +++ b/src/frontend/package.json @@ -8,11 +8,13 @@ "public": "rimraf dist && webpack --mode production" }, "dependencies": { + "axios": "^0.21.1", "bk-magic-vue": "^2.2.4", "bkci-atom-components": "^1.0.0", - "axios": "^0.21.1", + "js-cookie": "^3.0.1", "vee-validate": "^2.0.3", "vue": "^2.6.10", + "vue-i18n": "^8.10.0", "vue-router": "^2.8.1", "vuex": "^2.4.0" }, diff --git a/src/frontend/src/Atom.vue b/src/frontend/src/Atom.vue index 10be583..b270f41 100644 --- a/src/frontend/src/Atom.vue +++ b/src/frontend/src/Atom.vue @@ -38,10 +38,11 @@ + 国际化 @@ -52,6 +53,7 @@ import Scan from '@/components/Scan' import Shield from '@/components/Shield' import Async from '@/components/Async' + import { toggleLang } from './i18n' export default { name: 'atom', @@ -65,9 +67,9 @@ data () { return { panels: [ - { name: 'basic', label: '基础设置' }, - { name: 'scan', label: '扫描配置' }, - { name: 'shield', label: '路径屏蔽' } + { name: 'basic', label: this.$t('基础设置') }, + { name: 'scan', label: this.$t('扫描配置') }, + { name: 'shield', label: this.$t('路径屏蔽') } ], active: 'basic', tabRedTips: {} @@ -115,6 +117,9 @@ if (name === 'scan') { window.localStorage.setItem('mr-20200702', '1') } + }, + handleToggleLang() { + toggleLang() } } } diff --git a/src/frontend/src/components/Async.vue b/src/frontend/src/components/Async.vue index 3751fd7..f5cba04 100644 --- a/src/frontend/src/components/Async.vue +++ b/src/frontend/src/components/Async.vue @@ -1,6 +1,6 @@