This is an automated email from the ASF dual-hosted git repository.
mintsweet pushed a commit to branch feat-dora-config
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/feat-dora-config by this push:
new 7e784c4cb feat: improve the bamboo transformation cicd configuration
7e784c4cb is described below
commit 7e784c4cb75e06bbde9f5e5020a40ddb1cf03c48
Author: mintsweet <[email protected]>
AuthorDate: Wed Sep 18 20:02:50 2024 +1200
feat: improve the bamboo transformation cicd configuration
---
.../plugins/components/scope-config-form/index.tsx | 2 +
.../register/bamboo/assets/workflow-run.jpeg | Bin 0 -> 113157 bytes
config-ui/src/plugins/register/bamboo/config.tsx | 6 +-
.../src/plugins/register/bamboo/transformation.tsx | 117 ++++++++++++---------
.../src/plugins/register/bamboo/workflow-run.tsx | 94 +++++++++++++++++
5 files changed, 167 insertions(+), 52 deletions(-)
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 162b728de..061a91b42 100644
--- a/config-ui/src/plugins/components/scope-config-form/index.tsx
+++ b/config-ui/src/plugins/components/scope-config-form/index.tsx
@@ -205,6 +205,8 @@ export const ScopeConfigForm = ({
{plugin === 'bamboo' && (
<BambooTransformation
+ plugin="bamboo"
+ connectionId={connectionId}
entities={entities}
transformation={transformation}
setTransformation={setTransformation}
diff --git a/config-ui/src/plugins/register/bamboo/assets/workflow-run.jpeg
b/config-ui/src/plugins/register/bamboo/assets/workflow-run.jpeg
new file mode 100644
index 000000000..d7d98e675
Binary files /dev/null and
b/config-ui/src/plugins/register/bamboo/assets/workflow-run.jpeg differ
diff --git a/config-ui/src/plugins/register/bamboo/config.tsx
b/config-ui/src/plugins/register/bamboo/config.tsx
index cd7f8f775..c41e71d27 100644
--- a/config-ui/src/plugins/register/bamboo/config.tsx
+++ b/config-ui/src/plugins/register/bamboo/config.tsx
@@ -49,10 +49,6 @@ export const BambooConfig: IPluginConfig = {
},
scopeConfig: {
entities: ['CICD', 'CROSS'],
- transformation: {
- envNamePattern: '(?i)prod(.*)',
- deploymentPattern: '',
- productionPattern: '',
- },
+ transformation: {},
},
};
diff --git a/config-ui/src/plugins/register/bamboo/transformation.tsx
b/config-ui/src/plugins/register/bamboo/transformation.tsx
index 07c1fb35a..23840b246 100644
--- a/config-ui/src/plugins/register/bamboo/transformation.tsx
+++ b/config-ui/src/plugins/register/bamboo/transformation.tsx
@@ -20,16 +20,21 @@ import { useState, useEffect } from 'react';
import { CaretRightOutlined } from '@ant-design/icons';
import { theme, Collapse, Tag, Input, Checkbox } from 'antd';
-import { ExternalLink, HelpTooltip } from '@/components';
+import { ShowMore, ExternalLink, HelpTooltip } from '@/components';
+import { Deployments, CheckMatchedItems } from '@/plugins';
import { DOC_URL } from '@/release';
+import { WorkflowRun } from './workflow-run';
+
interface Props {
+ plugin: string;
+ connectionId: ID;
entities: string[];
transformation: any;
setTransformation: React.Dispatch<React.SetStateAction<any>>;
}
-export const BambooTransformation = ({ entities, transformation,
setTransformation }: Props) => {
+export const BambooTransformation = ({ plugin, connectionId, entities,
transformation, setTransformation }: Props) => {
const [useCustom, setUseCustom] = useState(false);
useEffect(() => {
@@ -44,6 +49,12 @@ export const BambooTransformation = ({ entities,
transformation, setTransformati
const checked = (e.target as HTMLInputElement).checked;
if (!checked) {
+ setTransformation({
+ ...transformation,
+ deploymentPattern: undefined,
+ productionPattern: undefined,
+ });
+ } else {
setTransformation({
...transformation,
deploymentPattern: '',
@@ -71,6 +82,8 @@ export const BambooTransformation = ({ entities,
transformation, setTransformati
style={{ background: token.colorBgContainer }}
size="large"
items={renderCollapseItems({
+ plugin,
+ connectionId,
entities,
panelStyle,
transformation,
@@ -83,6 +96,8 @@ export const BambooTransformation = ({ entities,
transformation, setTransformati
};
const renderCollapseItems = ({
+ plugin,
+ connectionId,
entities,
panelStyle,
transformation,
@@ -90,6 +105,8 @@ const renderCollapseItems = ({
useCustom,
onChangeUseCustom,
}: {
+ plugin: string;
+ connectionId: ID;
entities: string[];
panelStyle: React.CSSProperties;
transformation: any;
@@ -118,56 +135,62 @@ const renderCollapseItems = ({
Convert a Bamboo Deployment to a DevLake Deployment
</Checkbox>
<div style={{ margin: '8px 0', paddingLeft: 28 }}>
- <span>If its environment name matches</span>
- <Input
- style={{ width: 180, margin: '0 8px' }}
- placeholder="(?i)prod(.*)"
- value={transformation.envNamePattern}
- onChange={(e) =>
- onChangeTransformation({
- ...transformation,
- envNamePattern: e.target.value,
- })
- }
+ <span>If the environment</span>
+ <Deployments
+ plugin={plugin}
+ connectionId={connectionId}
+ transformation={transformation}
+ setTransformation={onChangeTransformation}
/>
<span>, this deployment is a ‘Production Deployment’</span>
</div>
<Checkbox checked={useCustom} onChange={onChangeUseCustom}>
- Convert a Bamboo Plan Build to a DevLake Deployment when its name
or one of its job builds’ names
+ Convert a Bamboo Plan Build to a DevLake Deployment when:
</Checkbox>
- <div style={{ margin: '8px 0', paddingLeft: 28 }}>
- <span>matches</span>
- <Input
- style={{ width: 180, margin: '0 8px' }}
- placeholder="(deploy|push-image)"
- value={transformation.deploymentPattern ?? ''}
- onChange={(e) =>
- onChangeTransformation({
- ...transformation,
- deploymentPattern: e.target.value,
- productionPattern: !e.target.value ? '' :
transformation.productionPattern,
- })
- }
- />
- <span>.</span>
- <HelpTooltip content="View your Bamboo Builds:
https://confluence.atlassian.com/bamboo/viewing-a-plan-s-build-information-289276861.html"
/>
- </div>
- <div style={{ margin: '8px 0', paddingLeft: 28 }}>
- <span>If the name also matches</span>
- <Input
- style={{ width: 180, 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
Deployments will be tagged as in the Production environment. " />
- </div>
+ {useCustom && (
+ <div style={{ paddingLeft: 28 }}>
+ <ShowMore
+ text={<p>Select this option only if you are not enabling
Bamboo Deployments</p>}
+ btnText="See how to configure"
+ >
+ <WorkflowRun />
+ </ShowMore>
+ <div style={{ margin: '8px 0' }}>
+ <span>The name of the plan or one of its jobs matches</span>
+ <Input
+ style={{ width: 180, margin: '0 8px' }}
+ placeholder="(?i)(deploy|push-image)"
+ value={transformation.deploymentPattern ?? ''}
+ onChange={(e) =>
+ onChangeTransformation({
+ ...transformation,
+ deploymentPattern: e.target.value,
+ productionPattern: !e.target.value ? '' :
transformation.productionPattern,
+ })
+ }
+ />
+ <span>.</span>
+ <HelpTooltip content="View your Bamboo Builds:
https://confluence.atlassian.com/bamboo/viewing-a-plan-s-build-information-289276861.html"
/>
+ </div>
+ <div style={{ margin: '8px 0' }}>
+ <span>If the name also matches</span>
+ <Input
+ style={{ width: 180, margin: '0 8px' }}
+ placeholder="(?i)(prod|release)"
+ value={transformation.productionPattern ?? ''}
+ onChange={(e) =>
+ onChangeTransformation({
+ ...transformation,
+ productionPattern: e.target.value,
+ })
+ }
+ />
+ <span>, this deployment will be regarded as a ‘Production
Deployment’</span>
+ <HelpTooltip content="If you leave this field empty, all
Deployments will be tagged as in the Production environment. " />
+ </div>
+ <CheckMatchedItems plugin={plugin} connectionId={connectionId}
transformation={transformation} />
+ </div>
+ )}
</>
),
},
diff --git a/config-ui/src/plugins/register/bamboo/workflow-run.tsx
b/config-ui/src/plugins/register/bamboo/workflow-run.tsx
new file mode 100644
index 000000000..e52d33497
--- /dev/null
+++ b/config-ui/src/plugins/register/bamboo/workflow-run.tsx
@@ -0,0 +1,94 @@
+/*
+ * 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 { Input } from 'antd';
+import styled from 'styled-components';
+
+import { ExternalLink } from '@/components';
+
+import Picture from './assets/workflow-run.jpeg';
+
+const Wrapper = styled.div`
+ padding: 8px 16px;
+ width: 100%;
+ font-size: 12px;
+ background-color: #fff;
+ box-sizing: border-box;
+ overflow: hidden;
+
+ li {
+ margin-bottom: 20px;
+
+ &:last-child {
+ margin-bottom: 0;
+ }
+ }
+
+ span.blue {
+ color: #7497f7;
+ }
+
+ span.yellow {
+ color: #f4be55;
+ }
+
+ span.red {
+ color: #ff8b8b;
+ }
+`;
+
+export const WorkflowRun = () => {
+ return (
+ <Wrapper>
+ <h5>Example - Convert all builds of Bamboo plan ‘p1’ to production
deployments</h5>
+ <ol>
+ <li>Go to your Bamboo plan list.</li>
+ <li>
+ Locate the Bamboo plan ‘p1’. All 4 builds of this plan will be
converted to production deployments with the
+ following steps.
+ <img src={Picture} width="100%" alt="" />
+ </li>
+ <li>
+ <div>In the first input field, enter the following regex to identify
deployments:</div>
+ <div style={{ marginTop: 10 }}>
+ The name of the plan or one of its jobs matches{' '}
+ <Input style={{ width: 240 }} size="small" disabled value="(?i)p1"
/>
+ </div>
+ </li>
+ <li>
+ <div>
+ In the second input field, enter the following regex to identify
the production deployments in the{' '}
+ <span className="red">red</span> rectangle. If you leave it empty,
all deployments in the yellow rectangle
+ will be regarded as Production Deployments.
+ </div>
+ <div style={{ marginTop: 10 }}>
+ If the name also matches <Input style={{ width: 100 }}
size="small" disabled value="(?i)p1" />, this
+ deployment will be classified as a ‘Production Deployment’
+ </div>
+ </li>
+ </ol>
+ <div>
+ For more information, please refer to{' '}
+ <ExternalLink
link="https://devlake.apache.org/docs/Configuration/Jenkins/#step-3---adding-transformation-rules-optional">
+ this documentation
+ </ExternalLink>
+ .
+ </div>
+ </Wrapper>
+ );
+};