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

commit 876a814ad75af3dc4907395cd05935e249f3c42d
Author: mintsweet <0x1304...@gmail.com>
AuthorDate: Tue Sep 17 21:12:48 2024 +1200

    feat: imporve the jenkins transformation cicd configuration
---
 .../plugins/components/scope-config-form/index.tsx |   2 +
 .../register/jenkins/assets/workflow-run.jpeg      | Bin 0 -> 238201 bytes
 .../plugins/register/jenkins/transformation.tsx    |  31 +++++--
 .../src/plugins/register/jenkins/workflow-run.tsx  |  97 +++++++++++++++++++++
 4 files changed, 121 insertions(+), 9 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 06b4e27c6..50f7ee1a9 100644
--- a/config-ui/src/plugins/components/scope-config-form/index.tsx
+++ b/config-ui/src/plugins/components/scope-config-form/index.tsx
@@ -263,6 +263,8 @@ export const ScopeConfigForm = ({
 
               {plugin === 'jenkins' && (
                 <JenkinsTransformation
+                  plugin={plugin}
+                  connectionId={connectionId}
                   entities={entities}
                   transformation={transformation}
                   setTransformation={setTransformation}
diff --git a/config-ui/src/plugins/register/jenkins/assets/workflow-run.jpeg 
b/config-ui/src/plugins/register/jenkins/assets/workflow-run.jpeg
new file mode 100644
index 000000000..d67bfa58a
Binary files /dev/null and 
b/config-ui/src/plugins/register/jenkins/assets/workflow-run.jpeg differ
diff --git a/config-ui/src/plugins/register/jenkins/transformation.tsx 
b/config-ui/src/plugins/register/jenkins/transformation.tsx
index 0a44f1dbd..5caea5945 100644
--- a/config-ui/src/plugins/register/jenkins/transformation.tsx
+++ b/config-ui/src/plugins/register/jenkins/transformation.tsx
@@ -19,16 +19,20 @@
 import { CaretRightOutlined } from '@ant-design/icons';
 import { theme, Collapse, Tag, Input } from 'antd';
 
-import { ExternalLink, HelpTooltip } from '@/components';
-import { DOC_URL } from '@/release';
+import { ShowMore, HelpTooltip } from '@/components';
+import { CheckMatchedItems } from '@/plugins';
+
+import { WorkflowRun } from './workflow-run';
 
 interface Props {
+  plugin: string;
+  connectionId: ID;
   entities: string[];
   transformation: any;
   setTransformation: React.Dispatch<React.SetStateAction<any>>;
 }
 
-export const JenkinsTransformation = ({ entities, transformation, 
setTransformation }: Props) => {
+export const JenkinsTransformation = ({ plugin, connectionId, entities, 
transformation, setTransformation }: Props) => {
   const { token } = theme.useToken();
 
   const panelStyle: React.CSSProperties = {
@@ -46,6 +50,8 @@ export const JenkinsTransformation = ({ entities, 
transformation, setTransformat
       style={{ background: token.colorBgContainer }}
       size="large"
       items={renderCollapseItems({
+        plugin,
+        connectionId,
         entities,
         panelStyle,
         transformation,
@@ -56,11 +62,15 @@ export const JenkinsTransformation = ({ entities, 
transformation, setTransformat
 };
 
 const renderCollapseItems = ({
+  plugin,
+  connectionId,
   entities,
   panelStyle,
   transformation,
   onChangeTransformation,
 }: {
+  plugin: string;
+  connectionId: ID;
   entities: string[];
   panelStyle: React.CSSProperties;
   transformation: any;
@@ -73,17 +83,19 @@ const renderCollapseItems = ({
       style: panelStyle,
       children: (
         <>
-          <h3 style={{ marginBottom: 16 }}>
+          <h3>
             <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.JENKINS.TRANSFORMATION}>Learn 
more</ExternalLink>
-          </p>
-          <div style={{ marginTop: 16 }}>Convert a Jenkins Build as a DevLake 
Deployment when: </div>
+          <ShowMore
+            text={<p>Use Regular Expression to define Deployments to measure 
DORA metrics.</p>}
+            btnText="See how to configure"
+          >
+            <WorkflowRun />
+          </ShowMore>
+          <div>Convert a Jenkins Build as a DevLake Deployment when: </div>
           <div style={{ margin: '8px 0', paddingLeft: 28 }}>
             <span>
               The name of the <strong>Jenkins job</strong> or <strong>one of 
its stages</strong> matches
@@ -120,6 +132,7 @@ const renderCollapseItems = ({
             <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>
+          <CheckMatchedItems plugin={plugin} connectionId={connectionId} 
transformation={transformation} />
         </>
       ),
     },
diff --git a/config-ui/src/plugins/register/jenkins/workflow-run.tsx 
b/config-ui/src/plugins/register/jenkins/workflow-run.tsx
new file mode 100644
index 000000000..f156f4e7e
--- /dev/null
+++ b/config-ui/src/plugins/register/jenkins/workflow-run.tsx
@@ -0,0 +1,97 @@
+/*
+ * 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 Jenkins job 
‘Auto_build_deploy_to_demo’ to production deployments</h5>
+      <ol>
+        <li>Go to your Jenkins job list.</li>
+        <li>
+          Locate the Jenkins jobs, and find the target job 
‘Auto_build_deploy_to_demo’ (highlighted by the{' '}
+          <span className="red">red</span> rectangle).
+          <img src={Picture} width="100%" alt="" />
+        </li>
+        <li>
+          <div>
+            In the first input field, enter the following regex to identify 
deployments (as highlighted in the{' '}
+            <span className="yellow">yellow</span> rectangle):
+          </div>
+          <div style={{ marginTop: 10 }}>
+            The name of the <strong>Jenkins job</strong> or <strong>one of its 
stages</strong> matches
+            <Input style={{ width: 240 }} size="small" disabled 
value="(?i)Auto_build_deploy_to.*" />
+          </div>
+        </li>
+        <li>
+          <div>
+            In the second input field, enter the following regex to identify 
production deployments (highlighted by the{' '}
+            <span className="red">red</span> rectangle). If left empty, all 
deployments in the{' '}
+            <span className="yellow">yellow</span> 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="demo" /> , this
+            deployment will be regarded 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>
+  );
+};

Reply via email to