Skip to content

Commit b54fa2a

Browse files
author
Klesh Wong
authored
cherry #5180 env left empty when regex is omitted to v0.17 (#5183)
* fix: bitbucket pipeline/step should be marked as PRODUCTION when corresponding regex is omitted * fix: github runs/jobs should be marked as PRODUCTION when corresponding regex is omitted * fix: bamboo builds should be marked as PRODUCTION when corresponding regex is omitted * fix: gitlab pipelines/jobs should be marked as PRODUCTION when corresponding regex is omitted * fix: jenkins builds/stages should be marked as PRODUCTION when corresponding regex is omitted
1 parent 1f994a5 commit b54fa2a

27 files changed

Lines changed: 314 additions & 67 deletions

backend/helpers/pluginhelper/api/enrich_with_regex.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func (r *RegexEnricher) TryAdd(name, pattern string) errors.Error {
8484
return nil
8585
}
8686

87-
// ReturnNameIfMatched will return name if any of the targets matches the regex with the given name
87+
// ReturnNameIfMatched will return name if any of the targets matches the regex associated with the given name
8888
func (r *RegexEnricher) ReturnNameIfMatched(name string, targets ...string) string {
8989
if regex, ok := r.regexpMap[name]; !ok {
9090
return ""
@@ -97,3 +97,11 @@ func (r *RegexEnricher) ReturnNameIfMatched(name string, targets ...string) stri
9797
}
9898
return ""
9999
}
100+
101+
// ReturnNameIfMatchedOrOmitted returns the given name if regex of the given name is omitted or fallback to ReturnNameIfMatched
102+
func (r *RegexEnricher) ReturnNameIfOmittedOrMatched(name string, targets ...string) string {
103+
if _, ok := r.regexpMap[name]; !ok {
104+
return name
105+
}
106+
return r.ReturnNameIfMatched(name, targets...)
107+
}

backend/plugins/bamboo/e2e/job_build_test.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,24 @@ func TestBambooJobBuildDataFlow(t *testing.T) {
4545
RegexEnricher: helper.NewRegexEnricher(),
4646
}
4747
taskData.RegexEnricher.TryAdd(devops.DEPLOYMENT, taskData.Options.DeploymentPattern)
48-
taskData.RegexEnricher.TryAdd(devops.PRODUCTION, taskData.Options.ProductionPattern)
4948
// import raw data table
5049
// SELECT * FROM _raw_bamboo_api_job_build INTO OUTFILE "/tmp/_raw_bamboo_api_job_build.csv" FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n';
5150
dataflowTester.ImportCsvIntoRawTable("./raw_tables/_raw_bamboo_api_job_build.csv", "_raw_bamboo_api_job_build")
5251

52+
// verify env when production regex is not set
53+
dataflowTester.FlushTabler(&models.BambooJobBuild{})
54+
dataflowTester.Subtask(tasks.ExtractJobBuildMeta, taskData)
55+
dataflowTester.Subtask(tasks.ExtractJobBuildMeta, taskData)
56+
dataflowTester.VerifyTable(
57+
models.BambooJobBuild{},
58+
"./snapshot_tables/_tool_bamboo_job_builds_no_prod_env.csv",
59+
e2ehelper.ColumnWithRawData(
60+
"environment",
61+
),
62+
)
63+
5364
// verify extraction
65+
taskData.RegexEnricher.TryAdd(devops.PRODUCTION, taskData.Options.ProductionPattern)
5466
dataflowTester.FlushTabler(&models.BambooJobBuild{})
5567
dataflowTester.Subtask(tasks.ExtractJobBuildMeta, taskData)
5668
dataflowTester.VerifyTable(
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
connection_id,job_build_key,environment,_raw_data_params,_raw_data_table,_raw_data_id,_raw_data_remark
2+
3,TEST1-TEST1-JOB1-22,PRODUCTION,"{""connectionId"":3,""ProjectKey"":""TEST1""}",_raw_bamboo_api_job_build,199,
3+
3,TEST1-TEST1-JOB1-23,PRODUCTION,"{""connectionId"":3,""ProjectKey"":""TEST1""}",_raw_bamboo_api_job_build,198,
4+
3,TEST1-TEST2-JOB1-2,PRODUCTION,"{""connectionId"":3,""ProjectKey"":""TEST1""}",_raw_bamboo_api_job_build,123,
5+
3,TEST1-TEST2-JOB1-3,PRODUCTION,"{""connectionId"":3,""ProjectKey"":""TEST1""}",_raw_bamboo_api_job_build,122,
6+
3,TEST1-TEST3-JOB1-2,PRODUCTION,"{""connectionId"":3,""ProjectKey"":""TEST1""}",_raw_bamboo_api_job_build,154,
7+
3,TEST1-TEST3-JOB1-3,PRODUCTION,"{""connectionId"":3,""ProjectKey"":""TEST1""}",_raw_bamboo_api_job_build,153,
8+
3,TEST1-TEST4-JOB1-1,PRODUCTION,"{""connectionId"":3,""ProjectKey"":""TEST1""}",_raw_bamboo_api_job_build,139,
9+
3,TEST1-TEST4-JOB1-2,PRODUCTION,"{""connectionId"":3,""ProjectKey"":""TEST1""}",_raw_bamboo_api_job_build,138,
10+
3,TEST1-TEST4-JOB1-3,PRODUCTION,"{""connectionId"":3,""ProjectKey"":""TEST1""}",_raw_bamboo_api_job_build,137,

backend/plugins/bamboo/tasks/job_build_extractor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func ExtractJobBuild(taskCtx plugin.SubTaskContext) errors.Error {
5555
body.PlanName = plan.PlanName
5656
body.PlanBuildKey = fmt.Sprintf("%s-%v", plan.PlanKey, body.Number)
5757
body.Type = data.RegexEnricher.ReturnNameIfMatched(devops.DEPLOYMENT, body.JobName)
58-
body.Environment = data.RegexEnricher.ReturnNameIfMatched(devops.PRODUCTION, body.JobName)
58+
body.Environment = data.RegexEnricher.ReturnNameIfOmittedOrMatched(devops.PRODUCTION, body.JobName)
5959
results := make([]interface{}, 0)
6060
results = append(results, body)
6161
for _, v := range res.VcsRevisions.VcsRevision {

backend/plugins/bitbucket/e2e/pipeline_steps_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ func TestBitbucketPipelineStepsDataFlow(t *testing.T) {
3434
dataflowTester := e2ehelper.NewDataFlowTester(t, "bitbucket", bitbucket)
3535

3636
regexEnricher := helper.NewRegexEnricher()
37-
_ = regexEnricher.TryAdd(devops.DEPLOYMENT, "main")
38-
_ = regexEnricher.TryAdd(devops.PRODUCTION, "pipeline")
37+
_ = regexEnricher.TryAdd(devops.DEPLOYMENT, "staging")
38+
// _ = regexEnricher.TryAdd(devops.PRODUCTION, "pipeline") // when production regex is omitted, all steps will be treated as production
3939
taskData := &tasks.BitbucketTaskData{
4040
Options: &tasks.BitbucketOptions{
4141
ConnectionId: 1,
@@ -67,6 +67,8 @@ func TestBitbucketPipelineStepsDataFlow(t *testing.T) {
6767
"run_number",
6868
//"trigger",
6969
//"result",
70+
"type",
71+
"environment",
7072
),
7173
)
7274

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
connection_id,bitbucket_id,pipeline_id,repo_id,name,state,max_time,started_on,completed_on,duration_in_seconds,build_seconds_used,run_number,_raw_data_params,_raw_data_table,_raw_data_id,_raw_data_remark
2-
1,{009577b4-99a8-4498-99bf-a00ef7254ca3},{5decbbb2-f4e6-4f3a-aab0-f74c40497c51},likyh/likyhphp,staging,COMPLETED,120,2023-02-20T09:38:47.203+00:00,2023-02-20T09:38:52.307+00:00,5,5,1,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,285,
3-
1,{0706054d-bde3-4d27-af26-8ff9bc675e6c},{5decbbb2-f4e6-4f3a-aab0-f74c40497c51},likyh/likyhphp,production,COMPLETED,120,2023-02-20T09:39:04.211+00:00,2023-02-20T09:39:09.267+00:00,5,5,1,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,286,
4-
1,{089a4513-1ea5-4890-8c08-f647ad5ff836},{8b417a17-72e6-4e16-ae4a-97f6e279f68e},likyh/likyhphp,staging,PENDING,120,,,0,0,1,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,405,
5-
1,{0fa0137f-e029-459e-8760-289ed9e6b57d},{5decbbb2-f4e6-4f3a-aab0-f74c40497c51},likyh/likyhphp,Test,COMPLETED,120,2023-02-20T09:38:30.581+00:00,2023-02-20T09:38:35.012+00:00,4,4,1,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,284,
6-
1,{1218e6e3-f34e-4ebc-a767-2a69285681ca},{2d91d69f-d84b-423d-ae4d-c1d3f2c27166},likyh/likyhphp,staging,COMPLETED,120,2023-02-20T09:23:50.415+00:00,2023-02-20T09:23:55.180+00:00,5,4,1,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,144,
7-
1,{148bfd03-8b7f-4483-982c-18b020124350},{b5d2ab02-2013-415e-b146-61ff3bf19502},likyh/likyhphp,production,COMPLETED,120,2023-02-20T09:23:40.970+00:00,2023-02-20T09:23:40.970+00:00,0,0,1,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,533,
8-
1,{14c24a3e-ffff-4d15-956d-83bba2ea8191},{5fb099c8-ebdd-4d3e-97d8-a12ebfca5446},likyh/likyhphp,staging,PENDING,120,,,0,0,1,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,291,
9-
1,{263500ac-4242-4996-95bd-739b5cafd3ef},{1e20072e-b22a-443f-ad92-3d9435393d5b},likyh/likyhphp,Test,COMPLETED,120,2023-02-20T09:12:34.572+00:00,2023-02-20T09:12:39.614+00:00,5,5,1,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,91,
10-
1,{2915edc8-9a5a-4a76-831b-f7ce30938d4e},{b5d2ab02-2013-415e-b146-61ff3bf19502},likyh/likyhphp,staging,COMPLETED,120,2023-02-20T09:23:40.928+00:00,2023-02-20T09:23:40.928+00:00,0,0,1,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,532,
11-
1,{61e34fbf-87a2-4271-827e-b336ff4c4396},{d7bf8394-6e18-42c4-b3a3-70514fc4079f},likyh/likyhphp,staging,COMPLETED,120,2023-02-20T09:15:45.450+00:00,2023-02-20T09:15:50.609+00:00,5,5,1,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,632,
12-
1,{6d73cef4-ade5-413a-b3ff-92472198790f},{5fb099c8-ebdd-4d3e-97d8-a12ebfca5446},likyh/likyhphp,Test,PENDING,120,,,0,0,1,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,290,
13-
1,{74ceee44-533a-489b-8d9b-3c9c0ef57ff3},{2d91d69f-d84b-423d-ae4d-c1d3f2c27166},likyh/likyhphp,production,COMPLETED,120,2023-02-20T09:24:05.997+00:00,2023-02-20T09:24:12.269+00:00,6,6,1,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,145,
14-
1,{9b079475-6fed-40bb-b591-711351c12f71},{2d91d69f-d84b-423d-ae4d-c1d3f2c27166},likyh/likyhphp,Test,COMPLETED,120,2023-02-20T09:23:31.978+00:00,2023-02-20T09:23:36.923+00:00,5,4,1,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,143,
15-
1,{a72dea81-cd04-45db-8af9-958ed814d050},{1e20072e-b22a-443f-ad92-3d9435393d5b},likyh/likyhphp,Test,COMPLETED,120,2023-02-20T09:12:04.411+00:00,2023-02-20T09:12:10.347+00:00,6,5,1,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,90,
16-
1,{ac0a2d0b-d67d-47c6-8e23-ee33ccdfe2d8},{b5d2ab02-2013-415e-b146-61ff3bf19502},likyh/likyhphp,Test,COMPLETED,120,2023-02-20T09:23:40.750+00:00,2023-02-20T09:23:40.750+00:00,0,0,1,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,531,
17-
1,{c2da4b2d-f971-4c5f-90b7-1c55ea80121c},{d7bf8394-6e18-42c4-b3a3-70514fc4079f},likyh/likyhphp,production,COMPLETED,120,2023-02-20T09:16:01.886+00:00,2023-02-20T09:16:09.885+00:00,8,7,1,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,633,
18-
1,{c596152f-6c3e-45db-a841-f8d312366cb1},{02c4dfe8-70a6-442c-8bd8-19061979c2cf},likyh/likyhphp,Test,PENDING,120,,,0,0,1,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,11,
19-
1,{caf86c6c-c60a-4e62-b838-6480ad110182},{1e20072e-b22a-443f-ad92-3d9435393d5b},likyh/likyhphp,Test,COMPLETED,120,2023-02-20T09:11:43.393+00:00,2023-02-20T09:11:53.145+00:00,10,9,1,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,89,
20-
1,{d464ab91-8b50-4ad5-8c22-d2a6d1ca5d22},{01fad871-cd21-4a80-bd59-74148dd5be8e},likyh/likyhphp,Test,COMPLETED,120,2023-02-20T08:58:31.520+00:00,2023-02-20T08:58:45.945+00:00,14,14,1,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,1,
21-
1,{d986f8fb-c8a3-4d2b-95cd-75f294c06262},{02c4dfe8-70a6-442c-8bd8-19061979c2cf},likyh/likyhphp,staging,PENDING,120,,,0,0,1,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,12,
22-
1,{dae66dc7-4d3e-43c9-ae04-8a8bcc1747c6},{02c4dfe8-70a6-442c-8bd8-19061979c2cf},likyh/likyhphp,production,PENDING,120,,,0,0,1,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,13,
23-
1,{e4753fd7-469e-4d15-a689-0fd882fee2d4},{d7bf8394-6e18-42c4-b3a3-70514fc4079f},likyh/likyhphp,Test,COMPLETED,120,2023-02-20T09:17:33.116+00:00,2023-02-20T09:17:37.835+00:00,5,4,2,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,631,
24-
1,{e74ae72c-1c09-4cb1-8c19-16e070204f07},{8b417a17-72e6-4e16-ae4a-97f6e279f68e},likyh/likyhphp,Test,PENDING,120,,,0,0,1,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,404,
25-
1,{ea7acd3f-d51c-41a1-9f53-458178d227f0},{5fb099c8-ebdd-4d3e-97d8-a12ebfca5446},likyh/likyhphp,production,PENDING,120,,,0,0,1,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,292,
26-
1,{eafe4c3f-6cfc-42c8-81c2-575dc6dee0f7},{8b417a17-72e6-4e16-ae4a-97f6e279f68e},likyh/likyhphp,production,PENDING,120,,,0,0,1,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,406,
1+
connection_id,bitbucket_id,pipeline_id,repo_id,name,state,max_time,started_on,completed_on,duration_in_seconds,build_seconds_used,run_number,type,environment,_raw_data_params,_raw_data_table,_raw_data_id,_raw_data_remark
2+
1,{009577b4-99a8-4498-99bf-a00ef7254ca3},{5decbbb2-f4e6-4f3a-aab0-f74c40497c51},likyh/likyhphp,staging,COMPLETED,120,2023-02-20T09:38:47.203+00:00,2023-02-20T09:38:52.307+00:00,5,5,1,DEPLOYMENT,PRODUCTION,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,285,
3+
1,{0706054d-bde3-4d27-af26-8ff9bc675e6c},{5decbbb2-f4e6-4f3a-aab0-f74c40497c51},likyh/likyhphp,production,COMPLETED,120,2023-02-20T09:39:04.211+00:00,2023-02-20T09:39:09.267+00:00,5,5,1,,PRODUCTION,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,286,
4+
1,{089a4513-1ea5-4890-8c08-f647ad5ff836},{8b417a17-72e6-4e16-ae4a-97f6e279f68e},likyh/likyhphp,staging,PENDING,120,,,0,0,1,DEPLOYMENT,PRODUCTION,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,405,
5+
1,{0fa0137f-e029-459e-8760-289ed9e6b57d},{5decbbb2-f4e6-4f3a-aab0-f74c40497c51},likyh/likyhphp,Test,COMPLETED,120,2023-02-20T09:38:30.581+00:00,2023-02-20T09:38:35.012+00:00,4,4,1,,PRODUCTION,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,284,
6+
1,{1218e6e3-f34e-4ebc-a767-2a69285681ca},{2d91d69f-d84b-423d-ae4d-c1d3f2c27166},likyh/likyhphp,staging,COMPLETED,120,2023-02-20T09:23:50.415+00:00,2023-02-20T09:23:55.180+00:00,5,4,1,DEPLOYMENT,PRODUCTION,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,144,
7+
1,{148bfd03-8b7f-4483-982c-18b020124350},{b5d2ab02-2013-415e-b146-61ff3bf19502},likyh/likyhphp,production,COMPLETED,120,2023-02-20T09:23:40.970+00:00,2023-02-20T09:23:40.970+00:00,0,0,1,,PRODUCTION,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,533,
8+
1,{14c24a3e-ffff-4d15-956d-83bba2ea8191},{5fb099c8-ebdd-4d3e-97d8-a12ebfca5446},likyh/likyhphp,staging,PENDING,120,,,0,0,1,DEPLOYMENT,PRODUCTION,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,291,
9+
1,{263500ac-4242-4996-95bd-739b5cafd3ef},{1e20072e-b22a-443f-ad92-3d9435393d5b},likyh/likyhphp,Test,COMPLETED,120,2023-02-20T09:12:34.572+00:00,2023-02-20T09:12:39.614+00:00,5,5,1,,PRODUCTION,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,91,
10+
1,{2915edc8-9a5a-4a76-831b-f7ce30938d4e},{b5d2ab02-2013-415e-b146-61ff3bf19502},likyh/likyhphp,staging,COMPLETED,120,2023-02-20T09:23:40.928+00:00,2023-02-20T09:23:40.928+00:00,0,0,1,DEPLOYMENT,PRODUCTION,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,532,
11+
1,{61e34fbf-87a2-4271-827e-b336ff4c4396},{d7bf8394-6e18-42c4-b3a3-70514fc4079f},likyh/likyhphp,staging,COMPLETED,120,2023-02-20T09:15:45.450+00:00,2023-02-20T09:15:50.609+00:00,5,5,1,DEPLOYMENT,PRODUCTION,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,632,
12+
1,{6d73cef4-ade5-413a-b3ff-92472198790f},{5fb099c8-ebdd-4d3e-97d8-a12ebfca5446},likyh/likyhphp,Test,PENDING,120,,,0,0,1,,PRODUCTION,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,290,
13+
1,{74ceee44-533a-489b-8d9b-3c9c0ef57ff3},{2d91d69f-d84b-423d-ae4d-c1d3f2c27166},likyh/likyhphp,production,COMPLETED,120,2023-02-20T09:24:05.997+00:00,2023-02-20T09:24:12.269+00:00,6,6,1,,PRODUCTION,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,145,
14+
1,{9b079475-6fed-40bb-b591-711351c12f71},{2d91d69f-d84b-423d-ae4d-c1d3f2c27166},likyh/likyhphp,Test,COMPLETED,120,2023-02-20T09:23:31.978+00:00,2023-02-20T09:23:36.923+00:00,5,4,1,,PRODUCTION,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,143,
15+
1,{a72dea81-cd04-45db-8af9-958ed814d050},{1e20072e-b22a-443f-ad92-3d9435393d5b},likyh/likyhphp,Test,COMPLETED,120,2023-02-20T09:12:04.411+00:00,2023-02-20T09:12:10.347+00:00,6,5,1,,PRODUCTION,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,90,
16+
1,{ac0a2d0b-d67d-47c6-8e23-ee33ccdfe2d8},{b5d2ab02-2013-415e-b146-61ff3bf19502},likyh/likyhphp,Test,COMPLETED,120,2023-02-20T09:23:40.750+00:00,2023-02-20T09:23:40.750+00:00,0,0,1,,PRODUCTION,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,531,
17+
1,{c2da4b2d-f971-4c5f-90b7-1c55ea80121c},{d7bf8394-6e18-42c4-b3a3-70514fc4079f},likyh/likyhphp,production,COMPLETED,120,2023-02-20T09:16:01.886+00:00,2023-02-20T09:16:09.885+00:00,8,7,1,,PRODUCTION,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,633,
18+
1,{c596152f-6c3e-45db-a841-f8d312366cb1},{02c4dfe8-70a6-442c-8bd8-19061979c2cf},likyh/likyhphp,Test,PENDING,120,,,0,0,1,,PRODUCTION,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,11,
19+
1,{caf86c6c-c60a-4e62-b838-6480ad110182},{1e20072e-b22a-443f-ad92-3d9435393d5b},likyh/likyhphp,Test,COMPLETED,120,2023-02-20T09:11:43.393+00:00,2023-02-20T09:11:53.145+00:00,10,9,1,,PRODUCTION,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,89,
20+
1,{d464ab91-8b50-4ad5-8c22-d2a6d1ca5d22},{01fad871-cd21-4a80-bd59-74148dd5be8e},likyh/likyhphp,Test,COMPLETED,120,2023-02-20T08:58:31.520+00:00,2023-02-20T08:58:45.945+00:00,14,14,1,,PRODUCTION,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,1,
21+
1,{d986f8fb-c8a3-4d2b-95cd-75f294c06262},{02c4dfe8-70a6-442c-8bd8-19061979c2cf},likyh/likyhphp,staging,PENDING,120,,,0,0,1,DEPLOYMENT,PRODUCTION,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,12,
22+
1,{dae66dc7-4d3e-43c9-ae04-8a8bcc1747c6},{02c4dfe8-70a6-442c-8bd8-19061979c2cf},likyh/likyhphp,production,PENDING,120,,,0,0,1,,PRODUCTION,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,13,
23+
1,{e4753fd7-469e-4d15-a689-0fd882fee2d4},{d7bf8394-6e18-42c4-b3a3-70514fc4079f},likyh/likyhphp,Test,COMPLETED,120,2023-02-20T09:17:33.116+00:00,2023-02-20T09:17:37.835+00:00,5,4,2,,PRODUCTION,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,631,
24+
1,{e74ae72c-1c09-4cb1-8c19-16e070204f07},{8b417a17-72e6-4e16-ae4a-97f6e279f68e},likyh/likyhphp,Test,PENDING,120,,,0,0,1,,PRODUCTION,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,404,
25+
1,{ea7acd3f-d51c-41a1-9f53-458178d227f0},{5fb099c8-ebdd-4d3e-97d8-a12ebfca5446},likyh/likyhphp,production,PENDING,120,,,0,0,1,,PRODUCTION,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,292,
26+
1,{eafe4c3f-6cfc-42c8-81c2-575dc6dee0f7},{8b417a17-72e6-4e16-ae4a-97f6e279f68e},likyh/likyhphp,production,PENDING,120,,,0,0,1,,PRODUCTION,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,406,

backend/plugins/bitbucket/tasks/pipeline_extractor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ func ExtractApiPipelines(taskCtx plugin.SubTaskContext) errors.Error {
101101
BitbucketCreatedOn: api.Iso8601TimeToTime(bitbucketApiPipeline.CreatedOn),
102102
BitbucketCompleteOn: api.Iso8601TimeToTime(bitbucketApiPipeline.CompletedOn),
103103
Type: data.RegexEnricher.ReturnNameIfMatched(devops.DEPLOYMENT, bitbucketApiPipeline.Target.RefName),
104-
Environment: data.RegexEnricher.ReturnNameIfMatched(devops.PRODUCTION, bitbucketApiPipeline.Target.RefName),
104+
Environment: data.RegexEnricher.ReturnNameIfOmittedOrMatched(devops.PRODUCTION, bitbucketApiPipeline.Target.RefName),
105105
}
106106
if err != nil {
107107
return nil, err

backend/plugins/bitbucket/tasks/pipeline_steps_extractor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func ExtractPipelineSteps(taskCtx plugin.SubTaskContext) errors.Error {
9494
BuildSecondsUsed: apiPipelineStep.BuildSecondsUsed,
9595
RunNumber: apiPipelineStep.RunNumber,
9696
Type: data.RegexEnricher.ReturnNameIfMatched(devops.DEPLOYMENT, apiPipelineStep.Name),
97-
Environment: data.RegexEnricher.ReturnNameIfMatched(devops.PRODUCTION, apiPipelineStep.Name),
97+
Environment: data.RegexEnricher.ReturnNameIfOmittedOrMatched(devops.PRODUCTION, apiPipelineStep.Name),
9898
}
9999
return []interface{}{
100100
bitbucketStep,

0 commit comments

Comments
 (0)