Skip to content

Commit b56233f

Browse files
committed
chore: pin container images to version 2.0.0 and enhance health checks
- Updated container images in Kubernetes manifests, Helm charts, and Kustomize overlays to version 2.0.0 for all services. - Improved health checks (liveness, readiness, and startup probes) for RabbitMQ and other services to ensure better reliability. - Modified Dockerfile for makeline-service to use a specific Alpine version (3.22) instead of latest. - Enhanced GitHub Actions workflow to include a new job for updating manifests with the new version after publishing container images.
1 parent f9a019d commit b56233f

31 files changed

Lines changed: 429 additions & 82 deletions

.github/workflows/release-container-images.yaml

Lines changed: 159 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,22 @@ permissions:
1010

1111
jobs:
1212
publish-container-image:
13-
1413
runs-on: ubuntu-latest
1514

1615
strategy:
1716
fail-fast: false
1817
matrix:
19-
apps: [
20-
ai-service,
21-
makeline-service,
22-
order-service,
23-
product-service,
24-
store-admin,
25-
store-front,
26-
virtual-customer,
27-
virtual-worker
28-
]
18+
apps:
19+
[
20+
ai-service,
21+
makeline-service,
22+
order-service,
23+
product-service,
24+
store-admin,
25+
store-front,
26+
virtual-customer,
27+
virtual-worker,
28+
]
2929

3030
steps:
3131
- name: Set environment variables
@@ -45,20 +45,20 @@ jobs:
4545
echo ${{ steps.set-variables.outputs.CREATED }}
4646
4747
- name: Checkout code
48-
uses: actions/checkout@v2
48+
uses: actions/checkout@v4
4949

5050
- name: Set up Docker Buildx
51-
uses: docker/setup-buildx-action@v2
51+
uses: docker/setup-buildx-action@v3
5252

5353
- name: Login to GitHub Container Registry
54-
uses: docker/login-action@v1
54+
uses: docker/login-action@v3
5555
with:
5656
registry: ghcr.io
5757
username: ${{ github.actor }}
5858
password: ${{ github.token }}
5959

6060
- name: Build and push
61-
uses: docker/build-push-action@v2
61+
uses: docker/build-push-action@v6
6262
with:
6363
context: src/${{ matrix.apps }}
6464
file: src/${{ matrix.apps }}/Dockerfile
@@ -72,4 +72,147 @@ jobs:
7272
labels: |
7373
org.opencontainers.image.source=${{ github.repositoryUrl }}
7474
org.opencontainers.image.created=${{ steps.set-variables.outputs.CREATED }}
75-
org.opencontainers.image.revision=${{ steps.set-variables.outputs.VERSION }}
75+
org.opencontainers.image.revision=${{ steps.set-variables.outputs.VERSION }}
76+
77+
update-manifests:
78+
runs-on: ubuntu-latest
79+
needs: publish-container-image
80+
permissions:
81+
contents: write
82+
83+
steps:
84+
- name: Checkout code
85+
uses: actions/checkout@v4
86+
87+
- name: Set version
88+
id: set-version
89+
run: |
90+
echo "VERSION=$(echo ${GITHUB_REF#refs/tags/})" >> "$GITHUB_OUTPUT"
91+
92+
- name: Update all manifests with new version
93+
run: |
94+
VERSION=${{ steps.set-version.outputs.VERSION }}
95+
96+
# =============================================================================
97+
# Configuration
98+
# =============================================================================
99+
100+
# Apps that have container images in ghcr.io/azure-samples/aks-store-demo
101+
APPS=(
102+
"ai-service"
103+
"makeline-service"
104+
"order-service"
105+
"product-service"
106+
"store-admin"
107+
"store-front"
108+
"virtual-customer"
109+
"virtual-worker"
110+
)
111+
112+
# =============================================================================
113+
# Helper function to update image tags
114+
# =============================================================================
115+
116+
update_full_image_ref() {
117+
# Updates: ghcr.io/azure-samples/aks-store-demo/<app>:<old> -> ghcr.io/azure-samples/aks-store-demo/<app>:<new>
118+
local file=$1
119+
local app=$2
120+
local version=$3
121+
if [ -f "$file" ]; then
122+
sed -i "s|ghcr.io/azure-samples/aks-store-demo/${app}:[^\"]*|ghcr.io/azure-samples/aks-store-demo/${app}:${version}|g" "$file"
123+
echo "Updated full image ref for ${app} in ${file}"
124+
fi
125+
}
126+
127+
update_short_image_ref() {
128+
# Updates: image: <app>:<old> -> image: <app>:<new> (no registry prefix)
129+
local file=$1
130+
local app=$2
131+
local version=$3
132+
if [ -f "$file" ]; then
133+
sed -i "s|image: ${app}:[^\"]*|image: ${app}:${version}|g" "$file"
134+
echo "Updated short image ref for ${app} in ${file}"
135+
fi
136+
}
137+
138+
# =============================================================================
139+
# Update Kubernetes manifests (inline image:tag format)
140+
# =============================================================================
141+
142+
echo "Updating root Kubernetes manifests..."
143+
ROOT_MANIFESTS=(
144+
"ai-service.yaml"
145+
"aks-store-all-in-one.yaml"
146+
"aks-store-quickstart.yaml"
147+
"aks-store-ingress-quickstart.yaml"
148+
)
149+
150+
for APP in "${APPS[@]}"; do
151+
for FILE in "${ROOT_MANIFESTS[@]}"; do
152+
update_full_image_ref "$FILE" "$APP" "$VERSION"
153+
done
154+
done
155+
156+
# =============================================================================
157+
# Update sample manifests
158+
# =============================================================================
159+
160+
echo "Updating sample manifests..."
161+
SAMPLE_MANIFESTS=(
162+
"sample-manifests/docs/app-routing/aks-store-deployments-and-services.yaml"
163+
)
164+
165+
for APP in "${APPS[@]}"; do
166+
for FILE in "${SAMPLE_MANIFESTS[@]}"; do
167+
update_full_image_ref "$FILE" "$APP" "$VERSION"
168+
done
169+
done
170+
171+
# =============================================================================
172+
# Update Kustomize base manifests
173+
# =============================================================================
174+
175+
echo "Updating Kustomize base manifests..."
176+
for APP in "${APPS[@]}"; do
177+
update_full_image_ref "kustomize/base/${APP}.yaml" "$APP" "$VERSION"
178+
done
179+
180+
# =============================================================================
181+
# Update Kustomize overlay manifests
182+
# =============================================================================
183+
184+
echo "Updating Kustomize azd overlay manifests..."
185+
# azd overlay uses short image names (no registry prefix) for ACR
186+
for APP in "${APPS[@]}"; do
187+
update_short_image_ref "kustomize/overlays/azd/${APP}/deployment.yaml" "$APP" "$VERSION"
188+
done
189+
190+
echo "Updating Kustomize kaito overlay manifests..."
191+
# kaito overlay uses full ghcr.io path
192+
update_full_image_ref "kustomize/overlays/kaito/ai-service.yaml" "ai-service" "$VERSION"
193+
194+
# =============================================================================
195+
# Update Helm chart values
196+
# =============================================================================
197+
198+
echo "Updating Helm chart values.yaml..."
199+
# Helm values.yaml uses separate 'tag' field: tag: "X.X.X"
200+
if [ -f "charts/aks-store-demo/values.yaml" ]; then
201+
sed -i -E "s|(tag: \")[^\"]+(\")|\1${VERSION}\2|g" "charts/aks-store-demo/values.yaml"
202+
echo "Updated Helm values.yaml"
203+
fi
204+
205+
echo "Manifest updates complete!"
206+
207+
- name: Commit and push changes
208+
run: |
209+
git config --global user.name "github-actions[bot]"
210+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
211+
212+
git add -A
213+
if git diff --staged --quiet; then
214+
echo "No changes to commit"
215+
else
216+
git commit -m "chore: update container image tags to ${{ steps.set-version.outputs.VERSION }}"
217+
git push
218+
fi

Makefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,49 +66,49 @@ provision-azure: ## Provision Azure Resources
6666
@if [ "$(BUILD_ORDER_SERVICE)" = true ]; then \
6767
az acr build -r $(ACR_NAME) -t order-service:$(IMAGE_VERSION) ./src/order-service; \
6868
else \
69-
az acr import -n $(ACR_NAME) --source ghcr.io/azure-samples/aks-store-demo/order-service:latest --image order-service:$(IMAGE_VERSION); \
69+
az acr import -n $(ACR_NAME) --source ghcr.io/azure-samples/aks-store-demo/order-service:2.0.0 --image order-service:$(IMAGE_VERSION); \
7070
fi
7171

7272
@if [ "$(BUILD_MAKELINE_SERVICE)" = true ]; then \
7373
az acr build -r $(ACR_NAME) -t makeline-service:$(IMAGE_VERSION) ./src/makeline-service; \
7474
else \
75-
az acr import -n $(ACR_NAME) --source ghcr.io/azure-samples/aks-store-demo/makeline-service:latest --image makeline-service:$(IMAGE_VERSION); \
75+
az acr import -n $(ACR_NAME) --source ghcr.io/azure-samples/aks-store-demo/makeline-service:2.0.0 --image makeline-service:$(IMAGE_VERSION); \
7676
fi
7777

7878
@if [ "$(BUILD_PRODUCT_SERVICE)" = true ]; then \
7979
az acr build -r $(ACR_NAME) -t product-service:$(IMAGE_VERSION) ./src/product-service; \
8080
else \
81-
az acr import -n $(ACR_NAME) --source ghcr.io/azure-samples/aks-store-demo/product-service:latest --image product-service:$(IMAGE_VERSION); \
81+
az acr import -n $(ACR_NAME) --source ghcr.io/azure-samples/aks-store-demo/product-service:2.0.0 --image product-service:$(IMAGE_VERSION); \
8282
fi
8383

8484
@if [ "$(BUILD_STORE_FRONT)" = true ]; then \
8585
az acr build -r $(ACR_NAME) -t store-front:$(IMAGE_VERSION) ./src/store-front; \
8686
else \
87-
az acr import -n $(ACR_NAME) --source ghcr.io/azure-samples/aks-store-demo/store-front:latest --image store-front:$(IMAGE_VERSION); \
87+
az acr import -n $(ACR_NAME) --source ghcr.io/azure-samples/aks-store-demo/store-front:2.0.0 --image store-front:$(IMAGE_VERSION); \
8888
fi
8989

9090
@if [ "$(BUILD_STORE_ADMIN)" = true ]; then \
9191
az acr build -r $(ACR_NAME) -t store-admin:$(IMAGE_VERSION) ./src/store-admin; \
9292
else \
93-
az acr import -n $(ACR_NAME) --source ghcr.io/azure-samples/aks-store-demo/store-admin:latest --image store-admin:$(IMAGE_VERSION); \
93+
az acr import -n $(ACR_NAME) --source ghcr.io/azure-samples/aks-store-demo/store-admin:2.0.0 --image store-admin:$(IMAGE_VERSION); \
9494
fi
9595

9696
@if [ "$(BUILD_VIRTUAL_CUSTOMER)" = true ]; then \
9797
az acr build -r $(ACR_NAME) -t virtual-customer:$(IMAGE_VERSION) ./src/virtual-customer; \
9898
else \
99-
az acr import -n $(ACR_NAME) --source ghcr.io/azure-samples/aks-store-demo/virtual-customer:latest --image virtual-customer:$(IMAGE_VERSION); \
99+
az acr import -n $(ACR_NAME) --source ghcr.io/azure-samples/aks-store-demo/virtual-customer:2.0.0 --image virtual-customer:$(IMAGE_VERSION); \
100100
fi
101101

102102
@if [ "$(BUILD_VIRTUAL_WORKER)" = true ]; then \
103103
az acr build -r $(ACR_NAME) -t virtual-worker:$(IMAGE_VERSION) ./src/virtual-worker; \
104104
else \
105-
az acr import -n $(ACR_NAME) --source ghcr.io/azure-samples/aks-store-demo/virtual-worker:latest --image virtual-worker:$(IMAGE_VERSION); \
105+
az acr import -n $(ACR_NAME) --source ghcr.io/azure-samples/aks-store-demo/virtual-worker:2.0.0 --image virtual-worker:$(IMAGE_VERSION); \
106106
fi
107107

108108
@if [ "$(BUILD_AI_SERVICE)" = true ]; then \
109109
az acr build -r $(ACR_NAME) -t ai-service:$(IMAGE_VERSION) ./src/ai-service; \
110110
else \
111-
az acr import -n $(ACR_NAME) --source ghcr.io/azure-samples/aks-store-demo/ai-service:latest --image ai-service:$(IMAGE_VERSION); \
111+
az acr import -n $(ACR_NAME) --source ghcr.io/azure-samples/aks-store-demo/ai-service:2.0.0 --image ai-service:$(IMAGE_VERSION); \
112112
fi
113113

114114
.PHONY: deploy-azure

ai-service.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ spec:
1616
"kubernetes.io/os": linux
1717
containers:
1818
- name: ai-service
19-
image: ghcr.io/azure-samples/aks-store-demo/ai-service:latest
19+
image: ghcr.io/azure-samples/aks-store-demo/ai-service:2.0.0
2020
ports:
2121
- containerPort: 5001
2222
env:

0 commit comments

Comments
 (0)