🔨 Add the Messager to the service grid
This commit is contained in:
176
.github/workflows/docker-build.yml
vendored
176
.github/workflows/docker-build.yml
vendored
@@ -1,103 +1,103 @@
|
|||||||
name: Build and Push Microservices
|
name: Build and Push Microservices
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
determine-changes:
|
determine-changes:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
matrix: ${{ steps.changes.outputs.matrix }}
|
matrix: ${{ steps.changes.outputs.matrix }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Get changed files
|
- name: Get changed files
|
||||||
id: changed-files
|
id: changed-files
|
||||||
run: |
|
run: |
|
||||||
echo "files=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | xargs)" >> $GITHUB_OUTPUT
|
echo "files=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | xargs)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Determine changed services
|
- name: Determine changed services
|
||||||
id: changes
|
id: changes
|
||||||
run: |
|
run: |
|
||||||
files="${{ steps.changed-files.outputs.files }}"
|
files="${{ steps.changed-files.outputs.files }}"
|
||||||
matrix="{\"include\":[]}"
|
matrix="{\"include\":[]}"
|
||||||
services=("Sphere" "Pass" "Ring" "Drive" "Develop" "Gateway" "Insight" "Zone")
|
services=("Sphere" "Pass" "Ring" "Drive" "Develop" "Gateway" "Insight" "Zone", "Messager")
|
||||||
images=("sphere" "pass" "ring" "drive" "develop" "gateway" "insight" "zone")
|
images=("sphere" "pass" "ring" "drive" "develop" "gateway" "insight" "zone", "messager")
|
||||||
changed_services=()
|
changed_services=()
|
||||||
|
|
||||||
for file in $files; do
|
for file in $files; do
|
||||||
if [[ "$file" == DysonNetwork.Shared/* ]]; then
|
if [[ "$file" == DysonNetwork.Shared/* ]]; then
|
||||||
changed_services=("${services[@]}")
|
changed_services=("${services[@]}")
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
for i in "${!services[@]}"; do
|
for i in "${!services[@]}"; do
|
||||||
if [[ "$file" == DysonNetwork.${services[$i]}/* ]]; then
|
if [[ "$file" == DysonNetwork.${services[$i]}/* ]]; then
|
||||||
# check if service is already in changed_services
|
# check if service is already in changed_services
|
||||||
if [[ ! " ${changed_services[@]} " =~ " ${services[$i]} " ]]; then
|
if [[ ! " ${changed_services[@]} " =~ " ${services[$i]} " ]]; then
|
||||||
changed_services+=("${services[$i]}")
|
changed_services+=("${services[$i]}")
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ ${#changed_services[@]} -gt 0 ]; then
|
if [ ${#changed_services[@]} -gt 0 ]; then
|
||||||
json_objects=""
|
json_objects=""
|
||||||
for service in "${changed_services[@]}"; do
|
for service in "${changed_services[@]}"; do
|
||||||
for i in "${!services[@]}"; do
|
for i in "${!services[@]}"; do
|
||||||
if [[ "${services[$i]}" == "$service" ]]; then
|
if [[ "${services[$i]}" == "$service" ]]; then
|
||||||
image="${images[$i]}"
|
image="${images[$i]}"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
json_objects+="{\"service\":\"$service\",\"image\":\"$image\"},"
|
json_objects+="{\"service\":\"$service\",\"image\":\"$image\"},"
|
||||||
done
|
done
|
||||||
matrix="{\"include\":[${json_objects%,}]}"
|
matrix="{\"include\":[${json_objects%,}]}"
|
||||||
fi
|
fi
|
||||||
echo "matrix=$matrix" >> $GITHUB_OUTPUT
|
echo "matrix=$matrix" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
build-and-push:
|
build-and-push:
|
||||||
needs: determine-changes
|
needs: determine-changes
|
||||||
if: ${{ needs.determine-changes.outputs.matrix != '{"include":[]}' }}
|
if: ${{ needs.determine-changes.outputs.matrix != '{"include":[]}' }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
packages: write
|
packages: write
|
||||||
strategy:
|
strategy:
|
||||||
matrix: ${{ fromJson(needs.determine-changes.outputs.matrix) }}
|
matrix: ${{ fromJson(needs.determine-changes.outputs.matrix) }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Setup NBGV
|
- name: Setup NBGV
|
||||||
uses: dotnet/nbgv@master
|
uses: dotnet/nbgv@master
|
||||||
id: nbgv
|
id: nbgv
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Log in to GitHub Container Registry
|
- name: Log in to GitHub Container Registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Build and push Docker image for ${{ matrix.service }}
|
- name: Build and push Docker image for ${{ matrix.service }}
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: DysonNetwork.${{ matrix.service }}/Dockerfile
|
file: DysonNetwork.${{ matrix.service }}/Dockerfile
|
||||||
push: true
|
push: true
|
||||||
tags: |
|
tags: |
|
||||||
ghcr.io/${{ vars.PACKAGE_OWNER }}/dyson-${{ matrix.image }}:${{ steps.nbgv.outputs.SimpleVersion }}
|
ghcr.io/${{ vars.PACKAGE_OWNER }}/dyson-${{ matrix.image }}:${{ steps.nbgv.outputs.SimpleVersion }}
|
||||||
ghcr.io/${{ vars.PACKAGE_OWNER }}/dyson-${{ matrix.image }}:latest
|
ghcr.io/${{ vars.PACKAGE_OWNER }}/dyson-${{ matrix.image }}:latest
|
||||||
platforms: linux/amd64
|
platforms: linux/amd64
|
||||||
|
|||||||
@@ -32,11 +32,25 @@ var zoneService = builder.AddProject<Projects.DysonNetwork_Zone>("zone")
|
|||||||
.WithReference(sphereService)
|
.WithReference(sphereService)
|
||||||
.WithReference(developService)
|
.WithReference(developService)
|
||||||
.WithReference(insightService);
|
.WithReference(insightService);
|
||||||
|
var messagerService = builder.AddProject<Projects.DysonNetwork_Messager>("messager")
|
||||||
|
.WithReference(passService)
|
||||||
|
.WithReference(ringService)
|
||||||
|
.WithReference(sphereService)
|
||||||
|
.WithReference(developService);
|
||||||
|
|
||||||
passService.WithReference(developService).WithReference(driveService);
|
passService.WithReference(developService).WithReference(driveService);
|
||||||
|
|
||||||
List<IResourceBuilder<ProjectResource>> services =
|
List<IResourceBuilder<ProjectResource>> services =
|
||||||
[ringService, passService, driveService, sphereService, developService, insightService, zoneService];
|
[
|
||||||
|
ringService,
|
||||||
|
passService,
|
||||||
|
driveService,
|
||||||
|
sphereService,
|
||||||
|
developService,
|
||||||
|
insightService,
|
||||||
|
zoneService,
|
||||||
|
messagerService
|
||||||
|
];
|
||||||
|
|
||||||
for (var idx = 0; idx < services.Count; idx++)
|
for (var idx = 0; idx < services.Count; idx++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -25,5 +25,6 @@
|
|||||||
<ProjectReference Include="..\DysonNetwork.Gateway\DysonNetwork.Gateway.csproj"/>
|
<ProjectReference Include="..\DysonNetwork.Gateway\DysonNetwork.Gateway.csproj"/>
|
||||||
<ProjectReference Include="..\DysonNetwork.Insight\DysonNetwork.Insight.csproj"/>
|
<ProjectReference Include="..\DysonNetwork.Insight\DysonNetwork.Insight.csproj"/>
|
||||||
<ProjectReference Include="..\DysonNetwork.Zone\DysonNetwork.Zone.csproj"/>
|
<ProjectReference Include="..\DysonNetwork.Zone\DysonNetwork.Zone.csproj"/>
|
||||||
|
<ProjectReference Include="..\DysonNetwork.Messager\DysonNetwork.Messager.csproj"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -2,8 +2,24 @@ namespace DysonNetwork.Gateway.Health;
|
|||||||
|
|
||||||
public abstract class GatewayConstant
|
public abstract class GatewayConstant
|
||||||
{
|
{
|
||||||
public static readonly string[] ServiceNames = ["ring", "pass", "drive", "sphere", "develop", "insight", "zone"];
|
public static readonly string[] ServiceNames =
|
||||||
|
[
|
||||||
|
"ring",
|
||||||
|
"pass",
|
||||||
|
"drive",
|
||||||
|
"sphere",
|
||||||
|
"develop",
|
||||||
|
"insight",
|
||||||
|
"zone",
|
||||||
|
"messager"
|
||||||
|
];
|
||||||
|
|
||||||
// Core services stands with w/o these services the functional of entire app will broke.
|
// Core services stands with w/o these services the functional of entire app will broke.
|
||||||
public static readonly string[] CoreServiceNames = ["ring", "pass", "drive", "sphere"];
|
public static readonly string[] CoreServiceNames =
|
||||||
|
[
|
||||||
|
"ring",
|
||||||
|
"pass",
|
||||||
|
"drive",
|
||||||
|
"sphere"
|
||||||
|
];
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user