Skip to content

Commit 2576c69

Browse files
Raising number of Retries With Exponential Backoff so slower machines don't get a "maxNumber of retries reached" exception..
1 parent 68ad189 commit 2576c69

2 files changed

Lines changed: 102 additions & 1 deletion

File tree

build-bits.ps1

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
$scriptPath = Split-Path $script:MyInvocation.MyCommand.Path
2+
3+
Write-Host "Current script directory is $scriptPath" -ForegroundColor Yellow
4+
5+
$pubFolderToDelete = $scriptPath + "\pub"
6+
remove-item -path $pubFolderToDelete -Force -Recurse -ErrorAction SilentlyContinue
7+
8+
# *** WebMVC image ***
9+
$webPathToJson = $scriptPath + "\src\Web\WebMVC\project.json"
10+
Write-Host "webPathToJson is $webPathToJson" -ForegroundColor Yellow
11+
$webPathToPub = $scriptPath + "\pub\webMVC"
12+
Write-Host "webPathToPub is $webPathToPub" -ForegroundColor Yellow
13+
14+
Write-Host "Restore Dependencies just in case as it is needed to run dotnet publish" -ForegroundColor Blue
15+
dotnet restore $webPathToJson
16+
dotnet build $webPathToJson
17+
dotnet publish $webPathToJson -o $webPathToPub
18+
19+
# *** WebSPA image ***
20+
$webSPAPath = $scriptPath + "\src\Web\WebSPA\eShopOnContainers.WebSPA"
21+
$webSPAPathToJson = $webSPAPath + "\project.json"
22+
Write-Host "webSPAPathToJson is $webSPAPathToJson" -ForegroundColor Yellow
23+
$webSPAPathToPub = $scriptPath + "\pub\webSPA"
24+
Write-Host "webSPAPathToPub is $webSPAPathToPub" -ForegroundColor Yellow
25+
26+
Write-Host "Installing npm dependencies"
27+
Start-Process -WorkingDirectory $webSPAPath -NoNewWindow -Wait npm i
28+
29+
Write-Host "Restore Dependencies just in case as it is needed to run dotnet publish" -ForegroundColor Blue
30+
dotnet restore $webSPAPathToJson
31+
dotnet build $webSPAPathToJson
32+
dotnet publish $webSPAPathToJson -o $webSPAPathToPub
33+
34+
# *** identitySvc image ***
35+
$identitySvcPathToJson = $scriptPath + "\src\Services\Identity\Identity.API\project.json"
36+
Write-Host "identitySvcPathToJson is $identitySvcPathToJson" -ForegroundColor Yellow
37+
$identitySvcPathToPub = $scriptPath + "\pub\identity"
38+
Write-Host "identitySvcPathToPub is $identitySvcPathToPub" -ForegroundColor Yellow
39+
40+
Write-Host "Restore Dependencies just in case as it is needed to run dotnet publish" -ForegroundColor Blue
41+
dotnet restore $identitySvcPathToJson
42+
dotnet build $identitySvcPathToJson
43+
dotnet publish $identitySvcPathToJson -o $identitySvcPathToPub
44+
45+
#*** Catalog service image ***
46+
$catalogPathToJson = $scriptPath + "\src\Services\Catalog\Catalog.API\project.json"
47+
Write-Host "catalogPathToJson is $catalogPathToJson" -ForegroundColor Yellow
48+
$catalogPathToPub = $scriptPath + "\pub\catalog"
49+
Write-Host "catalogPathToPub is $catalogPathToPub" -ForegroundColor Yellow
50+
51+
Write-Host "Restore Dependencies just in case as it is needed to run dotnet publish" -ForegroundColor Blue
52+
dotnet restore $catalogPathToJson
53+
dotnet build $catalogPathToJson
54+
dotnet publish $catalogPathToJson -o $catalogPathToPub
55+
56+
#*** Ordering service image ***
57+
$orderingPath = $scriptPath + "\src\Services\Ordering"
58+
Write-Host "orderingPath is $orderingPath" -ForegroundColor Yellow
59+
$orderingApiPathToJson = $orderingPath + "\Ordering.API\project.json"
60+
Write-Host "orderingApiPathToJson is $orderingApiPathToJson" -ForegroundColor Yellow
61+
$orderingApiPathToPub = $scriptPath + "\pub\ordering"
62+
Write-Host "orderingApiPathToPub is $orderingApiPathToPub" -ForegroundColor Yellow
63+
64+
Write-Host "Restore Dependencies just in case as it is needed to run dotnet publish" -ForegroundColor Blue
65+
dotnet restore $orderingPath
66+
dotnet build $orderingApiPathToJson
67+
dotnet publish $orderingApiPathToJson -o $orderingApiPathToPub
68+
69+
#*** Basket service image ***
70+
$basketPathToJson = $scriptPath + "\src\Services\Basket\Basket.API\project.json"
71+
Write-Host "basketPathToJson is $basketPathToJson" -ForegroundColor Yellow
72+
$basketPathToPub = $scriptPath + "\pub\basket"
73+
Write-Host "basketPathToPub is $basketPathToPub" -ForegroundColor Yellow
74+
75+
Write-Host "Restore Dependencies just in case as it is needed to run dotnet publish" -ForegroundColor Blue
76+
dotnet restore $basketPathToJson
77+
dotnet build $basketPathToJson
78+
dotnet publish $basketPathToJson -o $basketPathToPub
79+
80+
$imagesToDelete = docker images --filter=reference="eshop/*" -q
81+
82+
If (-Not $imagesToDelete) {Write-Host "Not deleting eShop images as there are no eShop images in the current local Docker repo."}
83+
Else
84+
{
85+
# Delete all containers
86+
Write-Host "Deleting all containers in local Docker Host"
87+
docker rm $(docker ps -a -q) -f
88+
89+
# Delete all eshop images
90+
Write-Host "Deleting eShop images in local Docker repo"
91+
Write-Host $imagesToDelete
92+
docker rmi $(docker images --filter=reference="eshop/*" -q) -f
93+
}
94+
95+
#*** build docker images ***
96+
docker build -t eshop/web $webPathToPub
97+
docker build -t eshop/catalog.api $catalogPathToPub
98+
docker build -t eshop/ordering.api $orderingApiPathToPub
99+
docker build -t eshop/basket.api $basketPathToPub
100+
docker build -t eshop/webspa $webSPAPathToPub
101+
docker build -t eshop/identity $identitySvcPathToPub

src/Web/WebMVC/Services/Utilities/RetryWithExponentialBackoff.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public sealed class RetryWithExponentialBackoff
2121
{
2222
private readonly int maxRetries, delayMilliseconds, maxDelayMilliseconds;
2323

24-
public RetryWithExponentialBackoff(int maxRetries = 5, int delayMilliseconds = 200, int maxDelayMilliseconds = 2000)
24+
public RetryWithExponentialBackoff(int maxRetries = 10, int delayMilliseconds = 200, int maxDelayMilliseconds = 2000)
2525
{
2626
this.maxRetries = maxRetries;
2727
this.delayMilliseconds = delayMilliseconds;

0 commit comments

Comments
 (0)