master
1#***************************************************************************
2# _ _ ____ _
3# Project ___| | | | _ \| |
4# / __| | | | |_) | |
5# | (__| |_| | _ <| |___
6# \___|\___/|_| \_\_____|
7#
8# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9# Copyright (C) Marc Hoersken, <info@marc-hoersken.de>
10#
11# This software is licensed as described in the file COPYING, which
12# you should have received as part of this distribution. The terms
13# are also available at https://curl.se/docs/copyright.html.
14#
15# You may opt to use, copy, modify, merge, publish, distribute and/or sell
16# copies of the Software, and permit persons to whom the Software is
17# furnished to do so, under the terms of the COPYING file.
18#
19# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20# KIND, either express or implied.
21#
22# SPDX-License-Identifier: curl
23#
24###########################################################################
26package azure;
28use strict;
29use warnings;
31BEGIN {
32 use base qw(Exporter);
34 our @EXPORT = qw(
35 azure_check_environment
36 azure_create_test_run
37 azure_create_test_result
38 azure_update_test_result
39 azure_update_test_run
40 );
41}
43use POSIX qw(strftime);
45sub azure_check_environment {
46 if(defined $ENV{'AZURE_ACCESS_TOKEN'} && $ENV{'AZURE_ACCESS_TOKEN'} &&
47 defined $ENV{'AGENT_JOBNAME'} && $ENV{'BUILD_BUILDID'} &&
48 defined $ENV{'SYSTEM_TEAMFOUNDATIONCOLLECTIONURI'} &&
49 defined $ENV{'SYSTEM_TEAMPROJECTID'}) {
50 return 1;
51 }
52 return 0;
53}
55sub azure_create_test_run {
56 my ($curl) = @_;
57 local $ENV{CURL_MEMDEBUG};
58 delete $ENV{CURL_MEMDEBUG};
59 my $azure_baseurl = "$ENV{'SYSTEM_TEAMFOUNDATIONCOLLECTIONURI'}$ENV{'SYSTEM_TEAMPROJECTID'}";
60 my $azure_run = qx($curl --silent --noproxy "*" \\
61 --header "Authorization: Bearer $ENV{'AZURE_ACCESS_TOKEN'}" \\
62 --header "Content-Type: application/json" \\
63 --data "
64 {
65 'name': '$ENV{'AGENT_JOBNAME'}',
66 'automated': true,
67 'build': {'id': '$ENV{'BUILD_BUILDID'}'}
68 }
69 " \\
70 "$azure_baseurl/_apis/test/runs?api-version=5.1");
71 if($azure_run =~ /"id":(\d+)/) {
72 return $1;
73 }
74 return "";
75}
77sub azure_create_test_result {
78 my ($curl, $azure_run_id, $testnum, $testname) = @_;
79 $testname =~ s/\\/\\\\/g;
80 $testname =~ s/\"/\\\"/g;
81 $testname =~ s/\'/'"'"'/g;
82 local $ENV{CURL_MEMDEBUG};
83 delete $ENV{CURL_MEMDEBUG};
84 my $title_testnum = sprintf("%04d", $testnum);
85 my $azure_baseurl = "$ENV{'SYSTEM_TEAMFOUNDATIONCOLLECTIONURI'}$ENV{'SYSTEM_TEAMPROJECTID'}";
86 my $azure_result = qx($curl --silent --noproxy '*' \\
87 --header "Authorization: Bearer $ENV{'AZURE_ACCESS_TOKEN'}" \\
88 --header 'Content-Type: application/json' \\
89 --data '
90 [
91 {
92 "build": {"id": "$ENV{'BUILD_BUILDID'}"},
93 "testCase": {"id": $testnum},
94 "testCaseTitle": "$title_testnum: $testname",
95 "testCaseRevision": 2,
96 "automatedTestName": "curl.tests.$testnum",
97 "outcome": "InProgress"
98 }
99 ]
100 ' \\
101 '$azure_baseurl/_apis/test/runs/$azure_run_id/results?api-version=5.1');
102 if($azure_result =~ /\[\{"id":(\d+)/) {
103 return $1;
104 }
105 return "";
106}
108sub azure_update_test_result {
109 my ($curl, $azure_run_id, $azure_result_id, $testnum, $error, $start, $stop) = @_;
110 if(!defined $stop) {
111 $stop = $start;
112 }
113 my $azure_start = strftime "%Y-%m-%dT%H:%M:%SZ", gmtime $start;
114 my $azure_complete = strftime "%Y-%m-%dT%H:%M:%SZ", gmtime $stop;
115 my $azure_duration = sprintf("%.0f", ($stop - $start) * 1000);
116 my $azure_outcome;
117 if($error == 2) {
118 $azure_outcome = 'NotApplicable';
119 }
120 elsif($error < 0) {
121 $azure_outcome = 'NotExecuted';
122 }
123 elsif(!$error) {
124 $azure_outcome = 'Passed';
125 }
126 else {
127 $azure_outcome = 'Failed';
128 }
129 local $ENV{CURL_MEMDEBUG};
130 delete $ENV{CURL_MEMDEBUG};
131 my $azure_baseurl = "$ENV{'SYSTEM_TEAMFOUNDATIONCOLLECTIONURI'}$ENV{'SYSTEM_TEAMPROJECTID'}";
132 my $azure_result = qx($curl --silent --noproxy '*' --request PATCH \\
133 --header "Authorization: Bearer $ENV{'AZURE_ACCESS_TOKEN'}" \\
134 --header "Content-Type: application/json" \\
135 --data '
136 [
137 {
138 "id": $azure_result_id,
139 "outcome": "$azure_outcome",
140 "startedDate": "$azure_start",
141 "completedDate": "$azure_complete",
142 "durationInMs": $azure_duration
143 }
144 ]
145 ' \\
146 '$azure_baseurl/_apis/test/runs/$azure_run_id/results?api-version=5.1');
147 if($azure_result =~ /\[\{"id":(\d+)/) {
148 return $1;
149 }
150 return "";
151}
153sub azure_update_test_run {
154 my ($curl, $azure_run_id) = @_;
155 local $ENV{CURL_MEMDEBUG};
156 delete $ENV{CURL_MEMDEBUG};
157 my $azure_baseurl = "$ENV{'SYSTEM_TEAMFOUNDATIONCOLLECTIONURI'}$ENV{'SYSTEM_TEAMPROJECTID'}";
158 my $azure_run = qx($curl --silent --noproxy '*' --request PATCH \\
159 --header "Authorization: Bearer $ENV{'AZURE_ACCESS_TOKEN'}" \\
160 --header 'Content-Type: application/json' \\
161 --data '
162 {
163 "state": "Completed"
164 }
165 ' \\
166 '$azure_baseurl/_apis/test/runs/$azure_run_id?api-version=5.1');
167 if($azure_run =~ /"id":(\d+)/) {
168 return $1;
169 }
170 return "";
171}
1731;
Diagnostics4 git calls · 483 ms
CallStatusSizeTime0483 ms
discover200152 B3 ms
git.upload-pack discover http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=3 git.response.bytes=152 git.server.agent=gitty/1.0 git.server.object_format=sha1 git.server.caps=agent ls-refs fetch object-format git.server.fetch=shallow filter sideband-all git.protocol.version=2 git.pkt.frames=8 git.pkt.data=6 git.pkt.flush=2 git.pkt.delim=0 git.pkt.bytes=152 git.pkt.payload.max=34
ls-refs200149 B · hit3 ms
git.upload-pack ls-refs http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=3 git.response.bytes=149 git.response.cache=HIT git.response.duration_ms=3 git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=149 git.pkt.payload.max=78 git.ls_refs.count=2 git.ls_refs.head=refs/heads/master
fetchblob:none · deepen 10200287 KiB · hit19 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=3 git.response.bytes=293470 git.response.cache=HIT git.response.duration_ms=19 git.fetch.filter=blob:none git.fetch.filter.requested=tree:0 git.fetch.filter.fallback=blob:none git.fetch.filter.learned=false git.fetch.wants=31c911efe5652725e930f4d2e60c9060e5f6646d git.fetch.haves.count=0 git.fetch.deepen=10 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=10 git.pkt.data=8 git.pkt.flush=1 git.pkt.delim=1 git.pkt.bytes=293470 git.pkt.payload.max=65516 git.sideband.band1.bytes=293354 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=87 git.pack.bytes=293354 git.pack.ofs_delta=0 git.pack.ref_delta=1 git.pack.chain.max=1 git.pack.trailer=6a646bcda6740bab42e321b51998b52ea15146c0 git.pack.full=86Open pack map
fetch2001.7 KiB461 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=461 git.response.bytes=1705 git.response.cache=MISS git.response.duration_ms=461 git.fetch.wants=7bb7946c965c324448a54600c073ba644bfe4f6d git.fetch.haves.count=0 git.fetch.deepen=0 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=1705 git.pkt.payload.max=1684 git.sideband.band1.bytes=1683 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0
Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.
- Remote
- https://5ad2236b39de4c8bd8f6270ea63f3ea9.artifacts.cloudflare.net/git/public-v0/curl.git
- Ref
- refs/heads/master
- Commit
- 31c911efe5652725e930f4d2e60c9060e5f6646d
- cf-ray
- a5e1c362ee2336cd
- Request
- e24883e3…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format