You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by mi...@apache.org on 2024/02/27 07:26:52 UTC
(incubator-devlake) branch release-v0.21-cherry-pick-7011 created (now 81f709030)
This is an automated email from the ASF dual-hosted git repository.
mintsweet pushed a change to branch release-v0.21-cherry-pick-7011
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
at 81f709030 feat: missed circleci transformation (#7011)
This branch includes the following new commits:
new 81f709030 feat: missed circleci transformation (#7011)
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(incubator-devlake) 01/01: feat: missed circleci transformation (#7011)
Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
mintsweet pushed a commit to branch release-v0.21-cherry-pick-7011
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
commit 81f7090307c15923ce11ab0b963f4742ff19acf3
Author: 青湛 <0x...@gmail.com>
AuthorDate: Tue Feb 27 16:11:30 2024 +1300
feat: missed circleci transformation (#7011)
---
.../plugins/components/scope-config-form/index.tsx | 9 ++
.../plugins/components/scope-config-form/misc.ts | 4 +
config-ui/src/plugins/register/circleci/index.ts | 1 +
.../plugins/register/circleci/transformation.tsx | 172 +++++++++++++++++++++
config-ui/src/release/stable.ts | 1 +
5 files changed, 187 insertions(+)
diff --git a/config-ui/src/plugins/components/scope-config-form/index.tsx b/config-ui/src/plugins/components/scope-config-form/index.tsx
index 3e897143e..8892c03dd 100644
--- a/config-ui/src/plugins/components/scope-config-form/index.tsx
+++ b/config-ui/src/plugins/components/scope-config-form/index.tsx
@@ -32,6 +32,7 @@ import { BitbucketTransformation } from '@/plugins/register/bitbucket';
import { AzureTransformation } from '@/plugins/register/azure';
import { TapdTransformation } from '@/plugins/register/tapd';
import { BambooTransformation } from '@/plugins/register/bamboo';
+import { CircleCITransformation } from '@/plugins/register/circleci';
import { operator } from '@/utils';
import { TIPS_MAP } from './misc';
@@ -207,6 +208,14 @@ export const ScopeConfigForm = ({
/>
)}
+ {plugin === 'circleci' && (
+ <CircleCITransformation
+ entities={entities}
+ transformation={transformation}
+ setTransformation={setTransformation}
+ />
+ )}
+
{plugin === 'github' && (
<GitHubTransformation
entities={entities}
diff --git a/config-ui/src/plugins/components/scope-config-form/misc.ts b/config-ui/src/plugins/components/scope-config-form/misc.ts
index 5188ee38a..19e6575a0 100644
--- a/config-ui/src/plugins/components/scope-config-form/misc.ts
+++ b/config-ui/src/plugins/components/scope-config-form/misc.ts
@@ -31,6 +31,10 @@ export const TIPS_MAP: Record<string, { name: string; link: string }> = {
name: 'BitBucket',
link: DOC_URL.PLUGIN.BITBUCKET.TRANSFORMATION,
},
+ circleci: {
+ name: 'CircleCI',
+ link: DOC_URL.PLUGIN.CIRCLECI.TRANSFORMATION,
+ },
github: {
name: 'GitHub',
link: DOC_URL.PLUGIN.GITHUB.TRANSFORMATION,
diff --git a/config-ui/src/plugins/register/circleci/index.ts b/config-ui/src/plugins/register/circleci/index.ts
index de415db39..5f16858cb 100644
--- a/config-ui/src/plugins/register/circleci/index.ts
+++ b/config-ui/src/plugins/register/circleci/index.ts
@@ -17,3 +17,4 @@
*/
export * from './config';
+export * from './transformation';
diff --git a/config-ui/src/plugins/register/circleci/transformation.tsx b/config-ui/src/plugins/register/circleci/transformation.tsx
new file mode 100644
index 000000000..90a00377d
--- /dev/null
+++ b/config-ui/src/plugins/register/circleci/transformation.tsx
@@ -0,0 +1,172 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import { CaretRightOutlined } from '@ant-design/icons';
+import { theme, Collapse, Tag, Input } from 'antd';
+
+import { ExternalLink, HelpTooltip } from '@/components';
+import { DOC_URL } from '@/release';
+
+interface Props {
+ entities: string[];
+ transformation: any;
+ setTransformation: React.Dispatch<React.SetStateAction<any>>;
+}
+
+export const CircleCITransformation = ({ entities, transformation, setTransformation }: Props) => {
+ const { token } = theme.useToken();
+
+ const panelStyle: React.CSSProperties = {
+ marginBottom: 24,
+ background: token.colorFillAlter,
+ borderRadius: token.borderRadiusLG,
+ border: 'none',
+ };
+
+ return (
+ <Collapse
+ bordered={false}
+ defaultActiveKey={['CICD']}
+ expandIcon={({ isActive }) => <CaretRightOutlined rotate={isActive ? 90 : 0} rev="" />}
+ style={{ background: token.colorBgContainer }}
+ size="large"
+ items={renderCollapseItems({
+ entities,
+ panelStyle,
+ transformation,
+ onChangeTransformation: setTransformation,
+ })}
+ />
+ );
+};
+
+const renderCollapseItems = ({
+ entities,
+ panelStyle,
+ transformation,
+ onChangeTransformation,
+}: {
+ entities: string[];
+ panelStyle: React.CSSProperties;
+ transformation: any;
+ onChangeTransformation: any;
+}) =>
+ [
+ {
+ key: 'CICD',
+ label: 'CI/CD',
+ style: panelStyle,
+ children: (
+ <>
+ <h3 style={{ marginBottom: 16 }}>
+ <span>Deployment</span>
+ <Tag style={{ marginLeft: 4 }} color="blue">
+ DORA
+ </Tag>
+ </h3>
+ <p style={{ marginBottom: 16 }}>
+ Use Regular Expression to define Deployments in DevLake in order to measure DORA metrics.{' '}
+ <ExternalLink link={DOC_URL.PLUGIN.CIRCLECI.TRANSFORMATION}>Learn more</ExternalLink>
+ </p>
+ <div>Convert a CircleCI Workflow Run as a DevLake Deployment when: </div>
+ <div style={{ margin: '8px 0', paddingLeft: 28 }}>
+ <span>
+ The name of the <strong>CircleCI workflow</strong> or <strong>one of its jobs</strong> matches
+ </span>
+ <Input
+ style={{ width: 200, margin: '0 8px' }}
+ placeholder="(deploy|push-image)"
+ value={transformation.deploymentPattern ?? ''}
+ onChange={(e) =>
+ onChangeTransformation({
+ ...transformation,
+ deploymentPattern: e.target.value,
+ productionPattern: !e.target.value ? '' : transformation.productionPattern,
+ })
+ }
+ />
+ <i style={{ color: '#E34040' }}>*</i>
+ <HelpTooltip content="CircleCI Workflows: https://circleci.com/docs/workflows/" />
+ </div>
+ <div style={{ margin: '8px 0', paddingLeft: 28 }}>
+ <span>If the name also matches</span>
+ <Input
+ style={{ width: 200, margin: '0 8px' }}
+ placeholder="prod(.*)"
+ value={transformation.productionPattern ?? ''}
+ onChange={(e) =>
+ onChangeTransformation({
+ ...transformation,
+ productionPattern: e.target.value,
+ })
+ }
+ />
+ <span>, this Deployment is a ‘Production Deployment’</span>
+ <HelpTooltip content="If you leave this field empty, all DevLake Deployments will be tagged as in the Production environment." />
+ </div>
+ </>
+ ),
+ },
+ {
+ key: 'ADDITIONAL',
+ label: 'Additional Settings',
+ style: panelStyle,
+ children: (
+ <>
+ <p>
+ Enable the <ExternalLink link={DOC_URL.PLUGIN.REFDIFF}>RefDiff</ExternalLink> plugin to pre-calculate
+ version-based metrics
+ <HelpTooltip content="Calculate the commits diff between two consecutive tags that match the following RegEx. Issues closed by PRs which contain these commits will also be calculated. The result will be shown in table.refs_commits_diffs and table.refs_issues_diffs." />
+ </p>
+ <div className="refdiff">
+ Compare the last
+ <Input
+ style={{ margin: '0 8px', width: 60 }}
+ placeholder="10"
+ value={transformation.refdiff?.tagsLimit ?? ''}
+ onChange={(e) =>
+ onChangeTransformation({
+ ...transformation,
+ refdiff: {
+ ...transformation?.refdiff,
+ tagsLimit: +e.target.value,
+ },
+ })
+ }
+ />
+ tags that match the
+ <Input
+ style={{ margin: '0 8px', width: 200 }}
+ placeholder="(regex)$"
+ value={transformation.refdiff?.tagsPattern ?? ''}
+ onChange={(e) =>
+ onChangeTransformation({
+ ...transformation,
+ refdiff: {
+ ...transformation?.refdiff,
+ tagsPattern: e.target.value,
+ },
+ })
+ }
+ />
+ for calculation
+ </div>
+ </>
+ ),
+ },
+ ].filter((it) => entities.includes(it.key) || it.key === 'ADDITIONAL');
diff --git a/config-ui/src/release/stable.ts b/config-ui/src/release/stable.ts
index 142a3650a..8d3b7e7f8 100644
--- a/config-ui/src/release/stable.ts
+++ b/config-ui/src/release/stable.ts
@@ -44,6 +44,7 @@ const URLS = {
},
CIRCLECI: {
RATE_LIMIT: 'https://devlake.apache.org/docs/Configuration/CircleCI#fixed-rate-limit-optional',
+ TRANSFORMATION: 'https://devlake.apache.org/docs/Configuration/CircleCI#step-13---adding-scope-config-optional',
},
GITHUB: {
BASIS: 'https://devlake.apache.org/docs/Configuration/GitHub',