diff --git a/locales/en/l10n-devopsProjects-pipeline-list.js b/locales/en/l10n-devopsProjects-pipeline-list.js index b858b8e1d91..8af53e1afc5 100644 --- a/locales/en/l10n-devopsProjects-pipeline-list.js +++ b/locales/en/l10n-devopsProjects-pipeline-list.js @@ -97,13 +97,13 @@ module.exports = { BRANCH_EXCLUDED: 'Excluded Branches', BRANCH_INCLUDED: 'Included Branches', // List > Create > Advanced Settings - DELETE_OUTDATED_BRANCHES: 'Delete outdated branches', - DELETE_OUTDATED_BRANCHES_TIP: 'Set the system to automatically delete outdated branches to save disk space.', - BRANCH_SETTINGS: 'Branch Settings', - BRANCH_RETENTION_PERIOD_DAYS: 'Branch Retention Period (days)', - MAXIMUM_BRANCHES: 'Maximum Branches', - BRANCH_RETENTION_PERIOD_DAYS_DESC: 'Branches that exceed the retention period are deleted. The default value is 7.', - MAXIMUM_BRANCHES_DESC: 'When the number of branches exceeds the maximum number allowed, the earliest branch is deleted. The default value is 5.', + DELETE_OUTDATED_BRANCHES: 'Delete outdated pipelines', + DELETE_OUTDATED_BRANCHES_TIP: 'Set the system to automatically delete outdated pipelines to save disk space.', + BRANCH_SETTINGS: 'Pipelines Settings', + BRANCH_RETENTION_PERIOD_DAYS: 'Pipelines Retention Period (days)', + MAXIMUM_BRANCHES: 'Maximum Pipelines', + BRANCH_RETENTION_PERIOD_DAYS_DESC: 'Pipelines that exceed the retention period are deleted. The default value is 7.', + MAXIMUM_BRANCHES_DESC: 'When the number of pipelines exceeds the maximum number allowed, the earliest pipeline is deleted. The default value is 5.', ADD_STRATEGY: 'Add Strategy', DISCOVER_TAG_BRANCHES: 'Discover Tags', DISCOVER_BRANCHES: 'Discover Branches', diff --git a/locales/tc/l10n-devopsProjects-pipeline-list.js b/locales/tc/l10n-devopsProjects-pipeline-list.js index 6ae7802a9ef..7c6c23841ed 100644 --- a/locales/tc/l10n-devopsProjects-pipeline-list.js +++ b/locales/tc/l10n-devopsProjects-pipeline-list.js @@ -94,13 +94,13 @@ module.exports = { BRANCH_EXCLUDED: '排除分支', BRANCH_INCLUDED: '包括分支', // List > Create > Advanced Settings - DELETE_OUTDATED_BRANCHES: '丢棄舊的分支', + DELETE_OUTDATED_BRANCHES: '丢棄舊的流水線', DELETE_OUTDATED_BRANCHES_TIP: 'Set the system to automatically delete outdated branches to save disk space.', - BRANCH_SETTINGS: ' 分支設置', - BRANCH_RETENTION_PERIOD_DAYS: '保留分支的天數', - MAXIMUM_BRANCHES: '保留分支的最大個數', - BRANCH_RETENTION_PERIOD_DAYS_DESC: '達到保留天數的分支將被刪除,默認值為 7。', - MAXIMUM_BRANCHES_DESC: '如果分支數量超過保留的最大數量,將丟棄舊的分支。默認值為 5。', + BRANCH_SETTINGS: ' 流水線設置', + BRANCH_RETENTION_PERIOD_DAYS: '保留流水線的天數', + MAXIMUM_BRANCHES: '保留流水線的最大個數', + BRANCH_RETENTION_PERIOD_DAYS_DESC: '達到保留天數的流水線將被刪除,默認值為 7。', + MAXIMUM_BRANCHES_DESC: '如果流水線數量超過保留的最大數量,將丟棄舊的流水線。默認值為 5。', ADD_STRATEGY: 'Add Strategy', DISCOVER_TAG_BRANCHES: '發現 Tag 分支', DISCOVER_BRANCHES: '發現分支', diff --git a/locales/zh/l10n-devopsProjects-pipeline-list.js b/locales/zh/l10n-devopsProjects-pipeline-list.js index fe3c4cd9d86..a62175d5c6a 100644 --- a/locales/zh/l10n-devopsProjects-pipeline-list.js +++ b/locales/zh/l10n-devopsProjects-pipeline-list.js @@ -94,12 +94,12 @@ module.exports = { BRANCH_EXCLUDED: '排除分支', BRANCH_INCLUDED: '包括分支', // List > Create > Advanced Settings - DELETE_OUTDATED_BRANCHES: '删除旧分支', - DELETE_OUTDATED_BRANCHES_TIP: '设置系统自动删除过期分支以节省磁盘空间。', - BRANCH_SETTINGS: ' 分支设置', - BRANCH_RETENTION_PERIOD_DAYS: '分支保留天数(天)', - MAXIMUM_BRANCHES: '分支最大数量', - BRANCH_RETENTION_PERIOD_DAYS_DESC: '超过保留期限的分支将被删除。默认值为 7。', + DELETE_OUTDATED_BRANCHES: '删除旧流水线', + DELETE_OUTDATED_BRANCHES_TIP: '设置系统自动删除过期流水线以节省磁盘空间。', + BRANCH_SETTINGS: ' 流水线设置', + BRANCH_RETENTION_PERIOD_DAYS: '流水线保留天数(天)', + MAXIMUM_BRANCHES: '流水线最大数量', + BRANCH_RETENTION_PERIOD_DAYS_DESC: '超过保留期限的流水线将被删除。默认值为 7。', MAXIMUM_BRANCHES_DESC: '当构建记录数量超过允许的最大数量,最早的构建记录将被删除。默认值为 5。', ADD_STRATEGY: '添加策略', DISCOVER_TAG_BRANCHES: '发现标签', diff --git a/server/proxy.js b/server/proxy.js index fa276162dae..edd89af33cb 100644 --- a/server/proxy.js +++ b/server/proxy.js @@ -36,6 +36,50 @@ const k8sResourceProxy = { NEED_OMIT_HEADERS.forEach(key => proxyReq.removeHeader(key)) }, + proxyRes(proxyRes, req, client_res) { + let maxBufferSize = req.headers['x-file-size-limit'] + if (maxBufferSize) { + maxBufferSize = Number(maxBufferSize) + let body = Buffer.alloc(maxBufferSize) + let offset = 0 + let end = false + proxyRes.on('data', chunk => { + if (end) { + return + } + if (offset >= maxBufferSize) { + if (!client_res.getHeader('x-file-size-limit-out')) { + client_res.setHeader('x-file-size-limit-out', 'true') + } + proxyRes.emit('end') + end = true + return + } + chunk.copy(body, offset) + + offset += chunk.length + }) + proxyRes.pipe = function(res) { + proxyRes.on('end', () => { + end = true + const offset1 = Math.min(offset, maxBufferSize) + body = body.slice(0, offset1) + res.writeHead(proxyRes.statusCode, { + ...proxyRes.headers, + 'x-file-size': offset1, + }) + res.end(body) + }) + } + } + let addHeaders = req.headers['x-add-res-header'] + if (addHeaders) { + addHeaders = JSON.parse(addHeaders) + Object.keys(addHeaders).forEach(key => { + proxyRes.headers[key] = addHeaders[key] + }) + } + }, }, } diff --git a/src/actions/pipeline.js b/src/actions/pipeline.js index bdf92d0fa03..4370cf9d586 100644 --- a/src/actions/pipeline.js +++ b/src/actions/pipeline.js @@ -259,6 +259,7 @@ export default { on({ store, success, devops, cluster, ...props }) { const modal = Modal.open({ onOk: async (parameters, branch) => { + Notify.success({ content: `${t('PIPELINE_RUN_START_SI')}` }) await store.runBranch({ devops, name: props.params.name, diff --git a/src/components/Forms/Pipelines/ParamsFormModal/index.jsx b/src/components/Forms/Pipelines/ParamsFormModal/index.jsx index cb58aa8c6b3..cb9a4a30e30 100644 --- a/src/components/Forms/Pipelines/ParamsFormModal/index.jsx +++ b/src/components/Forms/Pipelines/ParamsFormModal/index.jsx @@ -142,6 +142,10 @@ export default class ParamsFormModal extends React.Component { const { parameters, currentBranch } = this.state this.formRef.current.validate(() => { + if (!isEmpty(formParameters) && formParameters.__branch) { + formParameters.branch = formParameters.__branch + delete formParameters.__branch + } const params = isEmpty(formParameters) ? !isEmpty(parameters) && Array.isArray(parameters) ? parameters.map(item => ({ @@ -171,7 +175,10 @@ export default class ParamsFormModal extends React.Component { label={param.name} desc={param.description} > - + ) case 'text': diff --git a/src/components/Modals/CredentialCreate/index.jsx b/src/components/Modals/CredentialCreate/index.jsx index 36dd7b4161d..3cf549ce6ab 100644 --- a/src/components/Modals/CredentialCreate/index.jsx +++ b/src/components/Modals/CredentialCreate/index.jsx @@ -294,10 +294,10 @@ export default class CredentialModal extends React.Component { label: t('CREDENTIAL_TYPE_SECRET_TEXT'), value: 'secret_text', }, - { - label: t('CREDENTIAL_TYPE_KUBECONFIG'), - value: 'kubeconfig', - }, + // { + // label: t('CREDENTIAL_TYPE_KUBECONFIG'), + // value: 'kubeconfig', + // }, ]} disabled={isEditMode} onChange={this.handleTypeChange} diff --git a/src/pages/devops/containers/Pipelines/Detail/Activity/index.jsx b/src/pages/devops/containers/Pipelines/Detail/Activity/index.jsx index 90ec69e43a9..1523042461a 100644 --- a/src/pages/devops/containers/Pipelines/Detail/Activity/index.jsx +++ b/src/pages/devops/containers/Pipelines/Detail/Activity/index.jsx @@ -145,7 +145,6 @@ export default class Activity extends React.Component { disabledBrancheNames: toJS(detail.disabledBrancheNames), parameters: toJS(detail.parameters), success: () => { - Notify.success({ content: `${t('PIPELINE_RUN_START_SI')}` }) this.handleFetch() }, }) @@ -246,8 +245,8 @@ export default class Activity extends React.Component { width: '10%', key: 'run', render: record => - record.result === 'ABORTED' || !record.result ? ( - {record.id} + !record.id ? ( + - ) : ( {record.id} diff --git a/src/pages/devops/containers/Pipelines/Detail/Layout/pipeline.jsx b/src/pages/devops/containers/Pipelines/Detail/Layout/pipeline.jsx index 8d8b8894b4f..ffd275d9a43 100644 --- a/src/pages/devops/containers/Pipelines/Detail/Layout/pipeline.jsx +++ b/src/pages/devops/containers/Pipelines/Detail/Layout/pipeline.jsx @@ -32,6 +32,7 @@ import { getPipelineStatus } from 'utils/status' import { trigger } from 'utils/action' +import { getCodeRepoTemplate } from 'utils/devOpsRepos' import './index.scss' @inject('rootStore', 'devopsStore', 'pipelineStore') @@ -256,6 +257,17 @@ export default class PipelineDetailLayout extends React.Component { getAttrs = () => { const { devopsName } = this.props.devopsStore + let repo = {} + if (this.store.detail.isMultiBranch) { + const config = toJS(this.store.pipelineConfig) + const provider = get(config, 'spec.multi_branch_pipeline.source_type') + const source = get( + config, + `spec.multi_branch_pipeline.${provider}_source`, + {} + ) + repo = getCodeRepoTemplate[provider]?.(source) ?? {} + } const syncStatus = get( this.store.pipelineConfig, @@ -275,6 +287,11 @@ export default class PipelineDetailLayout extends React.Component { name: t('KIND_TCAP'), value: kind, }, + { + hide: !this.store.detail.isMultiBranch, + name: t('CODE_REPO'), + value: repo.repo && repo.url ? `${repo.repo}(${repo.url})` : repo.url, + }, { name: t('TASK_STATUS'), value: , @@ -287,7 +304,7 @@ export default class PipelineDetailLayout extends React.Component { name: t('UPDATE_TIME_TCAP'), value: this.getUpTime(), }, - ] + ].filter(i => !i.hide) } handleScanRepository = async () => { diff --git a/src/pages/devops/containers/Pipelines/Detail/PipelineLogDialog/FullLogs/index.jsx b/src/pages/devops/containers/Pipelines/Detail/PipelineLogDialog/FullLogs/index.jsx index 51c98069bb8..83ac2f27e91 100644 --- a/src/pages/devops/containers/Pipelines/Detail/PipelineLogDialog/FullLogs/index.jsx +++ b/src/pages/devops/containers/Pipelines/Detail/PipelineLogDialog/FullLogs/index.jsx @@ -36,9 +36,9 @@ export default class FullLogs extends React.Component { } @action - getPipelineIndexLog() { + getPipelineIndexLog(refresh = false) { const { params } = this.props - this.store.getRunStatusLogs(params) + this.store.getRunStatusLogs(params, refresh) } @computed @@ -87,7 +87,8 @@ export default class FullLogs extends React.Component { } handleRefreshLogs = async () => { - await this.getPipelineIndexLog() + await this.getPipelineIndexLog(true) + await this.handleRealtime() this.scrollToBottom() } diff --git a/src/pages/devops/containers/Pipelines/Detail/PipelineLogDialog/index.scss b/src/pages/devops/containers/Pipelines/Detail/PipelineLogDialog/index.scss index ea7bd9695ba..96a231b888c 100644 --- a/src/pages/devops/containers/Pipelines/Detail/PipelineLogDialog/index.scss +++ b/src/pages/devops/containers/Pipelines/Detail/PipelineLogDialog/index.scss @@ -2,7 +2,8 @@ @import '~scss/mixins'; .container { - display: flex; + display: grid; + grid-template-columns: 215px 1fr; height: 100%; } @@ -17,13 +18,16 @@ } .left { - flex-basis: 215px; height: 500px; overflow: auto; } .right { - flex-grow: 1; + // max-height: calc(100vh - 200px); + overflow-y: auto; + display: grid; + grid-template-rows: auto 1fr; + gap: 12px; } .cutTitle { @@ -71,7 +75,6 @@ .header { height: 32px; - margin-bottom: 12px; display: grid; grid-template-columns: 1fr auto; align-items: center; @@ -93,7 +96,6 @@ .logContainer { width: 100%; - height: 100%; padding: 12px; border-radius: 4px; background-color: #242e42; diff --git a/src/pages/devops/containers/Pipelines/Detail/TaskStatus/index.jsx b/src/pages/devops/containers/Pipelines/Detail/TaskStatus/index.jsx index 290437c276f..80df6baeec1 100644 --- a/src/pages/devops/containers/Pipelines/Detail/TaskStatus/index.jsx +++ b/src/pages/devops/containers/Pipelines/Detail/TaskStatus/index.jsx @@ -256,7 +256,7 @@ export default class TaskStatus extends React.Component { /> -