Skip to content

Commit fccf045

Browse files
authored
Merge pull request #17 from keboola/pepa_SOX-328_branchId
SOX-328 Add `branch.id` to job events
2 parents 48f173c + 32bdf96 commit fccf045

20 files changed

Lines changed: 121 additions & 12 deletions

Dockerfile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@ COPY docker/php.ini /usr/local/etc/php/php.ini
1313

1414
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin/ --filename=composer
1515

16-
RUN pecl channel-update pecl.php.net \
17-
&& pecl config-set php_ini /usr/local/etc/php.ini \
18-
&& yes | pecl install xdebug \
19-
&& docker-php-ext-enable xdebug
16+
RUN pecl install xdebug-3.1.6 \
17+
&& docker-php-ext-enable xdebug
2018

2119
COPY composer.* ./
2220
RUN composer install $COMPOSER_FLAGS --no-scripts --no-autoloader

src/Requests/PostEvent/JobFailedEventData.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,20 @@ class JobFailedEventData implements EventDataInterface
1010
{
1111
private string $projectId;
1212
private string $projectName;
13+
private string $branchId;
1314
private string $errorMessage;
1415
private JobData $jobData;
1516

16-
public function __construct(string $projectId, string $projectName, string $errorMessage, JobData $jobData)
17-
{
17+
public function __construct(
18+
string $projectId,
19+
string $projectName,
20+
string $branchId,
21+
string $errorMessage,
22+
JobData $jobData
23+
) {
1824
$this->projectId = $projectId;
1925
$this->projectName = $projectName;
26+
$this->branchId = $branchId;
2027
$this->errorMessage = $errorMessage;
2128
$this->jobData = $jobData;
2229
}
@@ -30,6 +37,9 @@ public function jsonSerialize(): array
3037
'id' => $this->projectId,
3138
'name' => $this->projectName,
3239
],
40+
'branch' => [
41+
'id' => $this->branchId,
42+
],
3343
];
3444
}
3545

src/Requests/PostEvent/JobProcessingLongEventData.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class JobProcessingLongEventData implements EventDataInterface
1010
{
1111
private string $projectId;
1212
private string $projectName;
13+
private string $branchId;
1314
private float $durationOvertimePercentage;
1415
private float $averageDuration;
1516
private float $currentDuration;
@@ -18,13 +19,15 @@ class JobProcessingLongEventData implements EventDataInterface
1819
public function __construct(
1920
string $projectId,
2021
string $projectName,
22+
string $branchId,
2123
float $durationOvertimePercentage,
2224
float $averageDuration,
2325
float $currentDuration,
2426
JobData $jobData
2527
) {
2628
$this->projectId = $projectId;
2729
$this->projectName = $projectName;
30+
$this->branchId = $branchId;
2831
$this->durationOvertimePercentage = $durationOvertimePercentage;
2932
$this->jobData = $jobData;
3033
$this->averageDuration = $averageDuration;
@@ -42,6 +45,9 @@ public function jsonSerialize(): array
4245
'id' => $this->projectId,
4346
'name' => $this->projectName,
4447
],
48+
'branch' => [
49+
'id' => $this->branchId,
50+
],
4551
'uniqueId' => $this->jobData->getJobId(),
4652
];
4753
}

src/Requests/PostEvent/JobSucceededEventData.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,18 @@ class JobSucceededEventData implements EventDataInterface
1010
{
1111
private string $projectId;
1212
private string $projectName;
13+
private string $branchId;
1314
private JobData $jobData;
1415

15-
public function __construct(string $projectId, string $projectName, JobData $jobData)
16-
{
16+
public function __construct(
17+
string $projectId,
18+
string $projectName,
19+
string $branchId,
20+
JobData $jobData
21+
) {
1722
$this->projectId = $projectId;
1823
$this->projectName = $projectName;
24+
$this->branchId = $branchId;
1925
$this->jobData = $jobData;
2026
}
2127

@@ -27,6 +33,9 @@ public function jsonSerialize(): array
2733
'id' => $this->projectId,
2834
'name' => $this->projectName,
2935
],
36+
'branch' => [
37+
'id' => $this->branchId,
38+
],
3039
];
3140
}
3241

src/Requests/PostEvent/JobSucceededWithWarningEventData.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,20 @@ class JobSucceededWithWarningEventData implements EventDataInterface
1010
{
1111
private string $projectId;
1212
private string $projectName;
13+
private string $branchId;
1314
private string $errorMessage;
1415
private JobData $jobData;
1516

16-
public function __construct(string $projectId, string $projectName, string $errorMessage, JobData $jobData)
17-
{
17+
public function __construct(
18+
string $projectId,
19+
string $projectName,
20+
string $branchId,
21+
string $errorMessage,
22+
JobData $jobData
23+
) {
1824
$this->projectId = $projectId;
1925
$this->projectName = $projectName;
26+
$this->branchId = $branchId;
2027
$this->errorMessage = $errorMessage;
2128
$this->jobData = $jobData;
2229
}
@@ -30,6 +37,9 @@ public function jsonSerialize(): array
3037
'id' => $this->projectId,
3138
'name' => $this->projectName,
3239
],
40+
'branch' => [
41+
'id' => $this->branchId,
42+
],
3343
];
3444
}
3545

src/Requests/PostEvent/PhaseJobFailedEventData.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class PhaseJobFailedEventData implements EventDataInterface
1010
{
1111
private string $projectId;
1212
private string $projectName;
13+
private string $branchId;
1314
private string $errorMessage;
1415
private JobData $jobData;
1516
private string $phaseName;
@@ -18,13 +19,15 @@ class PhaseJobFailedEventData implements EventDataInterface
1819
public function __construct(
1920
string $projectId,
2021
string $projectName,
22+
string $branchId,
2123
string $phaseName,
2224
string $phaseId,
2325
string $errorMessage,
2426
JobData $jobData
2527
) {
2628
$this->projectId = $projectId;
2729
$this->projectName = $projectName;
30+
$this->branchId = $branchId;
2831
$this->errorMessage = $errorMessage;
2932
$this->jobData = $jobData;
3033
$this->phaseName = $phaseName;
@@ -44,6 +47,9 @@ public function jsonSerialize(): array
4447
'id' => $this->projectId,
4548
'name' => $this->projectName,
4649
],
50+
'branch' => [
51+
'id' => $this->branchId,
52+
],
4753
];
4854
}
4955

src/Requests/PostEvent/PhaseJobProcessingLongEventData.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class PhaseJobProcessingLongEventData implements EventDataInterface
1010
{
1111
private string $projectId;
1212
private string $projectName;
13+
private string $branchId;
1314
private float $durationOvertimePercentage;
1415
private float $averageDuration;
1516
private float $currentDuration;
@@ -20,6 +21,7 @@ class PhaseJobProcessingLongEventData implements EventDataInterface
2021
public function __construct(
2122
string $projectId,
2223
string $projectName,
24+
string $branchId,
2325
string $phaseName,
2426
string $phaseId,
2527
float $durationOvertimePercentage,
@@ -29,6 +31,7 @@ public function __construct(
2931
) {
3032
$this->projectId = $projectId;
3133
$this->projectName = $projectName;
34+
$this->branchId = $branchId;
3235
$this->durationOvertimePercentage = $durationOvertimePercentage;
3336
$this->jobData = $jobData;
3437
$this->averageDuration = $averageDuration;
@@ -52,6 +55,9 @@ public function jsonSerialize(): array
5255
'id' => $this->projectId,
5356
'name' => $this->projectName,
5457
],
58+
'branch' => [
59+
'id' => $this->branchId,
60+
],
5561
'uniqueId' => $this->jobData->getJobId(),
5662
];
5763
}

src/Requests/PostEvent/PhaseJobSucceededEventData.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,22 @@ class PhaseJobSucceededEventData implements EventDataInterface
1010
{
1111
private string $projectId;
1212
private string $projectName;
13+
private string $branchId;
1314
private JobData $jobData;
1415
private string $phaseName;
1516
private string $phaseId;
1617

1718
public function __construct(
1819
string $projectId,
1920
string $projectName,
21+
string $branchId,
2022
string $phaseName,
2123
string $phaseId,
2224
JobData $jobData
2325
) {
2426
$this->projectId = $projectId;
2527
$this->projectName = $projectName;
28+
$this->branchId = $branchId;
2629
$this->jobData = $jobData;
2730
$this->phaseName = $phaseName;
2831
$this->phaseId = $phaseId;
@@ -40,6 +43,9 @@ public function jsonSerialize(): array
4043
'id' => $this->projectId,
4144
'name' => $this->projectName,
4245
],
46+
'branch' => [
47+
'id' => $this->branchId,
48+
],
4349
];
4450
}
4551

src/Requests/PostEvent/PhaseJobSucceededWithWarningEventData.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class PhaseJobSucceededWithWarningEventData implements EventDataInterface
1010
{
1111
private string $projectId;
1212
private string $projectName;
13+
private string $branchId;
1314
private string $errorMessage;
1415
private JobData $jobData;
1516
private string $phaseName;
@@ -18,13 +19,15 @@ class PhaseJobSucceededWithWarningEventData implements EventDataInterface
1819
public function __construct(
1920
string $projectId,
2021
string $projectName,
22+
string $branchId,
2123
string $phaseName,
2224
string $phaseId,
2325
string $errorMessage,
2426
JobData $jobData
2527
) {
2628
$this->projectId = $projectId;
2729
$this->projectName = $projectName;
30+
$this->branchId = $branchId;
2831
$this->errorMessage = $errorMessage;
2932
$this->jobData = $jobData;
3033
$this->phaseName = $phaseName;
@@ -44,6 +47,9 @@ public function jsonSerialize(): array
4447
'id' => $this->projectId,
4548
'name' => $this->projectName,
4649
],
50+
'branch' => [
51+
'id' => $this->branchId,
52+
],
4753
];
4854
}
4955

tests/ClientTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ private function getPostEventData(): Event
116116
new JobFailedEventData(
117117
'1234',
118118
'My project',
119+
'branch-id',
119120
'Some Error',
120121
new JobData(
121122
'23456',

0 commit comments

Comments
 (0)