You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by wa...@apache.org on 2023/01/06 05:20:04 UTC

[incubator-devlake] branch fix-add-bitbucket-e2e updated: feat: add bitbucket pipeline e2e test (#3147)

This is an automated email from the ASF dual-hosted git repository.

warren pushed a commit to branch fix-add-bitbucket-e2e
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/fix-add-bitbucket-e2e by this push:
     new 9d86eb9c1 feat: add bitbucket pipeline e2e test (#3147)
9d86eb9c1 is described below

commit 9d86eb9c1e6d0e038d548daf9277cd74f52ae3c6
Author: tsoc <47...@users.noreply.github.com>
AuthorDate: Fri Jan 6 13:19:59 2023 +0800

    feat: add bitbucket pipeline e2e test (#3147)
    
    * feat: add bitbucket pipeline e2e test
    
    * fix: remove create_date and complete_on in bibucket pipeline tool table test
    
    * fix: change time to iso86time in bitbucketApiPipeline
    
    * fix: ignore created_data and finished_data temporarily
    
    * fix: e2e
    
    Co-authored-by: Klesh Wong <zh...@merico.dev>
---
 plugins/bitbucket/e2e/pipelines_test.go            | 87 ++++++++++++++++++++++
 .../raw_tables/_raw_bitbucket_api_pipelines.csv    | 12 +++
 .../snapshot_tables/_tool_bitbucket_pipelines.csv  | 11 +++
 .../e2e/snapshot_tables/_tool_bitbucket_repos.csv  |  2 +-
 .../e2e/snapshot_tables/cicd_pipelines.csv         | 11 +++
 plugins/bitbucket/tasks/pipeline_extractor.go      | 21 +++---
 6 files changed, 132 insertions(+), 12 deletions(-)

diff --git a/plugins/bitbucket/e2e/pipelines_test.go b/plugins/bitbucket/e2e/pipelines_test.go
new file mode 100644
index 000000000..0edbbdbb1
--- /dev/null
+++ b/plugins/bitbucket/e2e/pipelines_test.go
@@ -0,0 +1,87 @@
+/*
+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.
+*/
+
+package e2e
+
+import (
+	"testing"
+
+	"github.com/apache/incubator-devlake/helpers/e2ehelper"
+	"github.com/apache/incubator-devlake/models/domainlayer/devops"
+	"github.com/apache/incubator-devlake/plugins/bitbucket/impl"
+	"github.com/apache/incubator-devlake/plugins/bitbucket/models"
+	"github.com/apache/incubator-devlake/plugins/bitbucket/tasks"
+)
+
+func TestBitbucketPipelineDataFlow(t *testing.T) {
+
+	var bitbucket impl.Bitbucket
+	dataflowTester := e2ehelper.NewDataFlowTester(t, "bitbucket", bitbucket)
+
+	bitbucketRepository := &models.BitbucketRepo{
+		BitbucketId: "thenicetgp/ptest",
+	}
+	taskData := &tasks.BitbucketTaskData{
+		Options: &tasks.BitbucketOptions{
+			ConnectionId: 1,
+			Owner:        "thenicetgp",
+			Repo:         "ptest",
+		},
+		Repo: bitbucketRepository,
+	}
+	// import raw data table
+	dataflowTester.ImportCsvIntoRawTable("./raw_tables/_raw_bitbucket_api_pipelines.csv", "_raw_bitbucket_api_pipelines")
+
+	// verify extraction
+	dataflowTester.FlushTabler(&models.BitbucketPipeline{})
+	dataflowTester.Subtask(tasks.ExtractApiPipelinesMeta, taskData)
+	dataflowTester.VerifyTable(
+		models.BitbucketPipeline{},
+		"./snapshot_tables/_tool_bitbucket_pipelines.csv",
+		[]string{
+			"connection_id",
+			"bitbucket_id",
+			"status",
+			"result",
+			"ref_name",
+			"web_url",
+			"duration_in_seconds",
+			"_raw_data_params",
+			"_raw_data_table",
+			"_raw_data_id",
+			"_raw_data_remark",
+		},
+	)
+
+	// verify conversion
+	dataflowTester.FlushTabler(&devops.CICDPipelineCommit{})
+	dataflowTester.FlushTabler(&devops.CICDPipeline{})
+	dataflowTester.Subtask(tasks.ConvertPipelineMeta, taskData)
+	dataflowTester.VerifyTable(
+		devops.CICDPipeline{},
+		"./snapshot_tables/cicd_pipelines.csv",
+		[]string{
+			"id",
+			"name",
+			"result",
+			"status",
+			"type",
+			"duration_sec",
+			"environment",
+		},
+	)
+}
diff --git a/plugins/bitbucket/e2e/raw_tables/_raw_bitbucket_api_pipelines.csv b/plugins/bitbucket/e2e/raw_tables/_raw_bitbucket_api_pipelines.csv
new file mode 100644
index 000000000..97156b371
--- /dev/null
+++ b/plugins/bitbucket/e2e/raw_tables/_raw_bitbucket_api_pipelines.csv
@@ -0,0 +1,12 @@
+id,params,data,url,input,created_at
+41,"{""ConnectionId"":1,""Owner"":""thenicetgp"",""Repo"":""ptest""}","{""type"": ""pipeline"", ""uuid"": ""{a57ab3dc-2afd-4e23-acd3-7acf1bb0cf28}"", ""repository"": {""type"": ""repository"", ""full_name"": ""thenicetgp/ptest"", ""links"": {""self"": {""href"": ""https://api.bitbucket.org/2.0/repositories/thenicetgp/ptest""}, ""html"": {""href"": ""https://bitbucket.org/thenicetgp/ptest""}, ""avatar"": {""href"": ""https://bytebucket.org/ravatar/%7Bb304e403-4841-4ebe-9d4e-432025a507d2%7 [...]
+42,"{""ConnectionId"":1,""Owner"":""thenicetgp"",""Repo"":""ptest""}","{""type"": ""pipeline"", ""uuid"": ""{844365c2-2d8c-4b67-9e27-21c2fcda7bd7}"", ""repository"": {""type"": ""repository"", ""full_name"": ""thenicetgp/ptest"", ""links"": {""self"": {""href"": ""https://api.bitbucket.org/2.0/repositories/thenicetgp/ptest""}, ""html"": {""href"": ""https://bitbucket.org/thenicetgp/ptest""}, ""avatar"": {""href"": ""https://bytebucket.org/ravatar/%7Bb304e403-4841-4ebe-9d4e-432025a507d2%7 [...]
+43,"{""ConnectionId"":1,""Owner"":""thenicetgp"",""Repo"":""ptest""}","{""type"": ""pipeline"", ""uuid"": ""{0af285e5-c07d-48eb-b0e9-b579f63f6f54}"", ""repository"": {""type"": ""repository"", ""full_name"": ""thenicetgp/ptest"", ""links"": {""self"": {""href"": ""https://api.bitbucket.org/2.0/repositories/thenicetgp/ptest""}, ""html"": {""href"": ""https://bitbucket.org/thenicetgp/ptest""}, ""avatar"": {""href"": ""https://bytebucket.org/ravatar/%7Bb304e403-4841-4ebe-9d4e-432025a507d2%7 [...]
+44,"{""ConnectionId"":1,""Owner"":""thenicetgp"",""Repo"":""ptest""}","{""type"": ""pipeline"", ""uuid"": ""{fc8cfdbd-2e0f-4789-9abb-19bf326f704b}"", ""repository"": {""type"": ""repository"", ""full_name"": ""thenicetgp/ptest"", ""links"": {""self"": {""href"": ""https://api.bitbucket.org/2.0/repositories/thenicetgp/ptest""}, ""html"": {""href"": ""https://bitbucket.org/thenicetgp/ptest""}, ""avatar"": {""href"": ""https://bytebucket.org/ravatar/%7Bb304e403-4841-4ebe-9d4e-432025a507d2%7 [...]
+45,"{""ConnectionId"":1,""Owner"":""thenicetgp"",""Repo"":""ptest""}","{""type"": ""pipeline"", ""uuid"": ""{0b0986ff-87ab-4c61-8244-72ee93270992}"", ""repository"": {""type"": ""repository"", ""full_name"": ""thenicetgp/ptest"", ""links"": {""self"": {""href"": ""https://api.bitbucket.org/2.0/repositories/thenicetgp/ptest""}, ""html"": {""href"": ""https://bitbucket.org/thenicetgp/ptest""}, ""avatar"": {""href"": ""https://bytebucket.org/ravatar/%7Bb304e403-4841-4ebe-9d4e-432025a507d2%7 [...]
+46,"{""ConnectionId"":1,""Owner"":""thenicetgp"",""Repo"":""ptest""}","{""type"": ""pipeline"", ""uuid"": ""{105b3616-0140-4f17-993e-65d8836cbfd4}"", ""repository"": {""type"": ""repository"", ""full_name"": ""thenicetgp/ptest"", ""links"": {""self"": {""href"": ""https://api.bitbucket.org/2.0/repositories/thenicetgp/ptest""}, ""html"": {""href"": ""https://bitbucket.org/thenicetgp/ptest""}, ""avatar"": {""href"": ""https://bytebucket.org/ravatar/%7Bb304e403-4841-4ebe-9d4e-432025a507d2%7 [...]
+47,"{""ConnectionId"":1,""Owner"":""thenicetgp"",""Repo"":""ptest""}","{""type"": ""pipeline"", ""uuid"": ""{76e9c380-bedf-48f8-ad11-9b4a60307dd6}"", ""repository"": {""type"": ""repository"", ""full_name"": ""thenicetgp/ptest"", ""links"": {""self"": {""href"": ""https://api.bitbucket.org/2.0/repositories/thenicetgp/ptest""}, ""html"": {""href"": ""https://bitbucket.org/thenicetgp/ptest""}, ""avatar"": {""href"": ""https://bytebucket.org/ravatar/%7Bb304e403-4841-4ebe-9d4e-432025a507d2%7 [...]
+48,"{""ConnectionId"":1,""Owner"":""thenicetgp"",""Repo"":""ptest""}","{""type"": ""pipeline"", ""uuid"": ""{60bd9ab0-57d7-4da6-bf39-3b04e8133223}"", ""repository"": {""type"": ""repository"", ""full_name"": ""thenicetgp/ptest"", ""links"": {""self"": {""href"": ""https://api.bitbucket.org/2.0/repositories/thenicetgp/ptest""}, ""html"": {""href"": ""https://bitbucket.org/thenicetgp/ptest""}, ""avatar"": {""href"": ""https://bytebucket.org/ravatar/%7Bb304e403-4841-4ebe-9d4e-432025a507d2%7 [...]
+49,"{""ConnectionId"":1,""Owner"":""thenicetgp"",""Repo"":""ptest""}","{""type"": ""pipeline"", ""uuid"": ""{d676e969-7294-4ca2-9173-4fba9b419fe9}"", ""repository"": {""type"": ""repository"", ""full_name"": ""thenicetgp/ptest"", ""links"": {""self"": {""href"": ""https://api.bitbucket.org/2.0/repositories/thenicetgp/ptest""}, ""html"": {""href"": ""https://bitbucket.org/thenicetgp/ptest""}, ""avatar"": {""href"": ""https://bytebucket.org/ravatar/%7Bb304e403-4841-4ebe-9d4e-432025a507d2%7 [...]
+50,"{""ConnectionId"":1,""Owner"":""thenicetgp"",""Repo"":""ptest""}","{""type"": ""pipeline"", ""uuid"": ""{accb6177-eea1-4d13-9806-037645ca3f67}"", ""repository"": {""type"": ""repository"", ""full_name"": ""thenicetgp/ptest"", ""links"": {""self"": {""href"": ""https://api.bitbucket.org/2.0/repositories/thenicetgp/ptest""}, ""html"": {""href"": ""https://bitbucket.org/thenicetgp/ptest""}, ""avatar"": {""href"": ""https://bytebucket.org/ravatar/%7Bb304e403-4841-4ebe-9d4e-432025a507d2%7 [...]
+
diff --git a/plugins/bitbucket/e2e/snapshot_tables/_tool_bitbucket_pipelines.csv b/plugins/bitbucket/e2e/snapshot_tables/_tool_bitbucket_pipelines.csv
new file mode 100644
index 000000000..929dde8f9
--- /dev/null
+++ b/plugins/bitbucket/e2e/snapshot_tables/_tool_bitbucket_pipelines.csv
@@ -0,0 +1,11 @@
+connection_id,bitbucket_id,status,result,ref_name,web_url,duration_in_seconds,_raw_data_params,_raw_data_table,_raw_data_id,_raw_data_remark
+1,{0af285e5-c07d-48eb-b0e9-b579f63f6f54},IN_PROGRESS,PAUSED,main,http://bitbucket-pipelines.prod.public.atl-paas.net//rest/1.0/accounts/{64135f6a-3978-4297-99b1-21827e0faf0b}/repositories/{b304e403-4841-4ebe-9d4e-432025a507d2}/pipelines/{0af285e5-c07d-48eb-b0e9-b579f63f6f54},10,"{""ConnectionId"":1,""Owner"":""thenicetgp"",""Repo"":""ptest""}",_raw_bitbucket_api_pipelines,43,
+1,{0b0986ff-87ab-4c61-8244-72ee93270992},IN_PROGRESS,PAUSED,main,http://bitbucket-pipelines.prod.public.atl-paas.net//rest/1.0/accounts/{64135f6a-3978-4297-99b1-21827e0faf0b}/repositories/{b304e403-4841-4ebe-9d4e-432025a507d2}/pipelines/{0b0986ff-87ab-4c61-8244-72ee93270992},10,"{""ConnectionId"":1,""Owner"":""thenicetgp"",""Repo"":""ptest""}",_raw_bitbucket_api_pipelines,45,
+1,{105b3616-0140-4f17-993e-65d8836cbfd4},IN_PROGRESS,PAUSED,pipeline,http://bitbucket-pipelines.prod.public.atl-paas.net//rest/1.0/accounts/{64135f6a-3978-4297-99b1-21827e0faf0b}/repositories/{b304e403-4841-4ebe-9d4e-432025a507d2}/pipelines/{105b3616-0140-4f17-993e-65d8836cbfd4},9,"{""ConnectionId"":1,""Owner"":""thenicetgp"",""Repo"":""ptest""}",_raw_bitbucket_api_pipelines,46,
+1,{60bd9ab0-57d7-4da6-bf39-3b04e8133223},COMPLETED,FAILED,feature/pipelinetest,http://bitbucket-pipelines.prod.public.atl-paas.net//rest/1.0/accounts/{64135f6a-3978-4297-99b1-21827e0faf0b}/repositories/{b304e403-4841-4ebe-9d4e-432025a507d2}/pipelines/{60bd9ab0-57d7-4da6-bf39-3b04e8133223},0,"{""ConnectionId"":1,""Owner"":""thenicetgp"",""Repo"":""ptest""}",_raw_bitbucket_api_pipelines,48,
+1,{76e9c380-bedf-48f8-ad11-9b4a60307dd6},COMPLETED,STOPPED,pipeline,http://bitbucket-pipelines.prod.public.atl-paas.net//rest/1.0/accounts/{64135f6a-3978-4297-99b1-21827e0faf0b}/repositories/{b304e403-4841-4ebe-9d4e-432025a507d2}/pipelines/{76e9c380-bedf-48f8-ad11-9b4a60307dd6},0,"{""ConnectionId"":1,""Owner"":""thenicetgp"",""Repo"":""ptest""}",_raw_bitbucket_api_pipelines,47,
+1,{844365c2-2d8c-4b67-9e27-21c2fcda7bd7},IN_PROGRESS,PAUSED,main,http://bitbucket-pipelines.prod.public.atl-paas.net//rest/1.0/accounts/{64135f6a-3978-4297-99b1-21827e0faf0b}/repositories/{b304e403-4841-4ebe-9d4e-432025a507d2}/pipelines/{844365c2-2d8c-4b67-9e27-21c2fcda7bd7},10,"{""ConnectionId"":1,""Owner"":""thenicetgp"",""Repo"":""ptest""}",_raw_bitbucket_api_pipelines,42,
+1,{a57ab3dc-2afd-4e23-acd3-7acf1bb0cf28},COMPLETED,SUCCESSFUL,main,http://bitbucket-pipelines.prod.public.atl-paas.net//rest/1.0/accounts/{64135f6a-3978-4297-99b1-21827e0faf0b}/repositories/{b304e403-4841-4ebe-9d4e-432025a507d2}/pipelines/{a57ab3dc-2afd-4e23-acd3-7acf1bb0cf28},14,"{""ConnectionId"":1,""Owner"":""thenicetgp"",""Repo"":""ptest""}",_raw_bitbucket_api_pipelines,41,
+1,{accb6177-eea1-4d13-9806-037645ca3f67},COMPLETED,FAILED,,http://bitbucket-pipelines.prod.public.atl-paas.net//rest/1.0/accounts/{64135f6a-3978-4297-99b1-21827e0faf0b}/repositories/{b304e403-4841-4ebe-9d4e-432025a507d2}/pipelines/{accb6177-eea1-4d13-9806-037645ca3f67},0,"{""ConnectionId"":1,""Owner"":""thenicetgp"",""Repo"":""ptest""}",_raw_bitbucket_api_pipelines,50,
+1,{d676e969-7294-4ca2-9173-4fba9b419fe9},COMPLETED,FAILED,pipeline,http://bitbucket-pipelines.prod.public.atl-paas.net//rest/1.0/accounts/{64135f6a-3978-4297-99b1-21827e0faf0b}/repositories/{b304e403-4841-4ebe-9d4e-432025a507d2}/pipelines/{d676e969-7294-4ca2-9173-4fba9b419fe9},0,"{""ConnectionId"":1,""Owner"":""thenicetgp"",""Repo"":""ptest""}",_raw_bitbucket_api_pipelines,49,
+1,{fc8cfdbd-2e0f-4789-9abb-19bf326f704b},IN_PROGRESS,PAUSED,feature/pipelinetest,http://bitbucket-pipelines.prod.public.atl-paas.net//rest/1.0/accounts/{64135f6a-3978-4297-99b1-21827e0faf0b}/repositories/{b304e403-4841-4ebe-9d4e-432025a507d2}/pipelines/{fc8cfdbd-2e0f-4789-9abb-19bf326f704b},12,"{""ConnectionId"":1,""Owner"":""thenicetgp"",""Repo"":""ptest""}",_raw_bitbucket_api_pipelines,44,
diff --git a/plugins/bitbucket/e2e/snapshot_tables/_tool_bitbucket_repos.csv b/plugins/bitbucket/e2e/snapshot_tables/_tool_bitbucket_repos.csv
index 554457e65..50d7b9bb9 100644
--- a/plugins/bitbucket/e2e/snapshot_tables/_tool_bitbucket_repos.csv
+++ b/plugins/bitbucket/e2e/snapshot_tables/_tool_bitbucket_repos.csv
@@ -1,2 +1,2 @@
 connection_id,bitbucket_id,name,html_url,description,owner_id,language,_raw_data_params,_raw_data_table,_raw_data_id,_raw_data_remark
-1,panjf2000/ants,panjf2000/ants,https://bitbucket.org/panjf2000/ants,,,,"{""ConnectionId"":1,""Owner"":""panjf2000"",""Repo"":""ants""}",_raw_bitbucket_api_repositories,2,
+1,panjf2000/ants,panjf2000/ants,https://bitbucket.org/panjf2000/ants,,,,"{""ConnectionId"":1,""Owner"":""panjf2000"",""Repo"":""ants""}",_raw_bitbucket_api_repositories,2,
\ No newline at end of file
diff --git a/plugins/bitbucket/e2e/snapshot_tables/cicd_pipelines.csv b/plugins/bitbucket/e2e/snapshot_tables/cicd_pipelines.csv
new file mode 100644
index 000000000..dc8812a69
--- /dev/null
+++ b/plugins/bitbucket/e2e/snapshot_tables/cicd_pipelines.csv
@@ -0,0 +1,11 @@
+id,name,result,status,type,duration_sec,created_date,finished_date,environment
+bitbucket:BitbucketPipeline:1:{0af285e5-c07d-48eb-b0e9-b579f63f6f54},bitbucket:BitbucketPipeline:1:main,MANUAL,IN_PROGRESS,CI/CD,10,2022-09-14T04:35:41.306+00:00,,
+bitbucket:BitbucketPipeline:1:{0b0986ff-87ab-4c61-8244-72ee93270992},bitbucket:BitbucketPipeline:1:main,MANUAL,IN_PROGRESS,CI/CD,10,2022-09-20T12:40:10.785+00:00,,
+bitbucket:BitbucketPipeline:1:{105b3616-0140-4f17-993e-65d8836cbfd4},bitbucket:BitbucketPipeline:1:pipeline,MANUAL,IN_PROGRESS,CI/CD,9,2022-09-20T12:41:07.095+00:00,,
+bitbucket:BitbucketPipeline:1:{60bd9ab0-57d7-4da6-bf39-3b04e8133223},bitbucket:BitbucketPipeline:1:feature/pipelinetest,FAILURE,DONE,CI/CD,0,2022-09-20T12:44:05.761+00:00,2022-09-20T12:44:05.745+00:00,
+bitbucket:BitbucketPipeline:1:{76e9c380-bedf-48f8-ad11-9b4a60307dd6},bitbucket:BitbucketPipeline:1:pipeline,ABORT,DONE,CI/CD,0,2022-09-20T12:42:14.300+00:00,2022-09-20T12:42:23.084+00:00,
+bitbucket:BitbucketPipeline:1:{844365c2-2d8c-4b67-9e27-21c2fcda7bd7},bitbucket:BitbucketPipeline:1:main,MANUAL,IN_PROGRESS,CI/CD,10,2022-09-14T04:35:17.076+00:00,,
+bitbucket:BitbucketPipeline:1:{a57ab3dc-2afd-4e23-acd3-7acf1bb0cf28},bitbucket:BitbucketPipeline:1:main,SUCCESS,DONE,CI/CD,14,2022-09-13T14:10:22.042+00:00,2022-09-13T14:14:03.870+00:00,
+bitbucket:BitbucketPipeline:1:{accb6177-eea1-4d13-9806-037645ca3f67},bitbucket:BitbucketPipeline:1:,FAILURE,DONE,CI/CD,0,2022-09-20T12:45:52.175+00:00,2022-09-20T12:45:52.155+00:00,
+bitbucket:BitbucketPipeline:1:{d676e969-7294-4ca2-9173-4fba9b419fe9},bitbucket:BitbucketPipeline:1:pipeline,FAILURE,DONE,CI/CD,0,2022-09-20T12:45:51.130+00:00,2022-09-20T12:45:51.117+00:00,
+bitbucket:BitbucketPipeline:1:{fc8cfdbd-2e0f-4789-9abb-19bf326f704b},bitbucket:BitbucketPipeline:1:feature/pipelinetest,MANUAL,IN_PROGRESS,CI/CD,12,2022-09-20T12:34:39.893+00:00,,
diff --git a/plugins/bitbucket/tasks/pipeline_extractor.go b/plugins/bitbucket/tasks/pipeline_extractor.go
index 8cb12f6bd..67d69c413 100644
--- a/plugins/bitbucket/tasks/pipeline_extractor.go
+++ b/plugins/bitbucket/tasks/pipeline_extractor.go
@@ -23,7 +23,6 @@ import (
 	"github.com/apache/incubator-devlake/plugins/bitbucket/models"
 	"github.com/apache/incubator-devlake/plugins/core"
 	"github.com/apache/incubator-devlake/plugins/helper"
-	"time"
 )
 
 type bitbucketApiCommit struct {
@@ -72,14 +71,14 @@ type BitbucketApiPipeline struct {
 		Name string `json:"name"`
 		Type string `json:"type"`
 	} `json:"trigger"`
-	CreatedOn         *time.Time `json:"created_on"`
-	CompletedOn       *time.Time `json:"completed_on"`
-	RunNumber         int        `json:"run_number"`
-	DurationInSeconds uint64     `json:"duration_in_seconds"`
-	BuildSecondsUsed  int        `json:"build_seconds_used"`
-	FirstSuccessful   bool       `json:"first_successful"`
-	Expired           bool       `json:"expired"`
-	HasVariables      bool       `json:"has_variables"`
+	CreatedOn         *helper.Iso8601Time `json:"created_on"`
+	CompletedOn       *helper.Iso8601Time `json:"completed_on"`
+	RunNumber         int                 `json:"run_number"`
+	DurationInSeconds uint64              `json:"duration_in_seconds"`
+	BuildSecondsUsed  int                 `json:"build_seconds_used"`
+	FirstSuccessful   bool                `json:"first_successful"`
+	Expired           bool                `json:"expired"`
+	HasVariables      bool                `json:"has_variables"`
 	Links             struct {
 		Self struct {
 			Href string `json:"href"`
@@ -120,8 +119,8 @@ func ExtractApiPipelines(taskCtx core.SubTaskContext) errors.Error {
 				CommitSha:           bitbucketApiPipeline.Target.Commit.Hash,
 				RepoId:              bitbucketApiPipeline.Repo.FullName,
 				DurationInSeconds:   bitbucketApiPipeline.DurationInSeconds,
-				BitbucketCreatedOn:  bitbucketApiPipeline.CreatedOn,
-				BitbucketCompleteOn: bitbucketApiPipeline.CompletedOn,
+				BitbucketCreatedOn:  helper.Iso8601TimeToTime(bitbucketApiPipeline.CreatedOn),
+				BitbucketCompleteOn: helper.Iso8601TimeToTime(bitbucketApiPipeline.CompletedOn),
 			}
 			if err != nil {
 				return nil, err