Skip to content

Commit 037cf11

Browse files
committed
merge with main
2 parents d415162 + 68954f5 commit 037cf11

File tree

30 files changed

+1913
-217
lines changed

30 files changed

+1913
-217
lines changed
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Build and Push Helm Chart
2+
description: Lint, build, and optionally push Helm chart to Google Artifact Registry
3+
inputs:
4+
chart-path:
5+
description: Path to the Helm chart directory
6+
required: true
7+
push:
8+
description: Whether to push the chart to registry
9+
required: false
10+
default: 'false'
11+
registry-login-url:
12+
description: Google Registry login URL (e.g., oci://europe-docker.pkg.dev/project/helm-charts)
13+
required: false
14+
default: "europe-docker.pkg.dev"
15+
registry-url:
16+
description: Google Artifact Registry URL (e.g., oci://europe-docker.pkg.dev/project/helm-charts)
17+
required: false
18+
credentials:
19+
description: Base64 encoded Google service account JSON credentials
20+
required: false
21+
version:
22+
description: Chart version (defaults to 0.0.0-{sha})
23+
required: false
24+
app-version:
25+
description: App version (defaults to git sha)
26+
required: false
27+
28+
outputs:
29+
chart-name:
30+
description: Name of the packaged chart file
31+
value: ${{ steps.package.outputs.chart-name }}
32+
chart-version:
33+
description: Version of the packaged chart
34+
value: ${{ steps.set-version.outputs.version }}
35+
36+
runs:
37+
using: composite
38+
steps:
39+
- name: Set up Helm
40+
uses: azure/setup-helm@v4
41+
with:
42+
version: v4.0.1
43+
44+
- name: Set version
45+
id: set-version
46+
shell: bash
47+
run: |
48+
if [ -n "${{ inputs.version }}" ]; then
49+
VERSION="${{ inputs.version }}"
50+
else
51+
VERSION="0.0.0-${GITHUB_SHA::8}"
52+
fi
53+
# Set default image.tag version in values.yaml
54+
cd ${{ inputs.chart-path }}
55+
yq -i ".global.image.tag = \"$VERSION\"" values.yaml
56+
echo "version=$VERSION" >> $GITHUB_OUTPUT
57+
58+
- name: Update Helm dependencies
59+
shell: bash
60+
run: helm dependency update ${{ inputs.chart-path }}
61+
62+
- name: Lint Helm chart
63+
shell: bash
64+
run: helm lint ${{ inputs.chart-path }}
65+
66+
- name: Package Helm chart
67+
id: package
68+
shell: bash
69+
run: |
70+
helm package ${{ inputs.chart-path }} \
71+
--version ${{ steps.set-version.outputs.version }} \
72+
--app-version ${{ steps.set-version.outputs.version }}
73+
74+
CHART_NAME=$(ls -1 *.tgz | head -n1)
75+
echo "chart-name=$CHART_NAME" >> $GITHUB_OUTPUT
76+
77+
- name: Authenticate to Google Artifact Registry
78+
if: inputs.push == 'true'
79+
shell: bash
80+
run: |
81+
echo "${{ inputs.credentials }}" | \
82+
helm registry login -u _json_key_base64 \
83+
--password-stdin ${{ inputs.registry-login-url }}
84+
85+
- name: Push Helm chart
86+
if: inputs.push == 'true'
87+
shell: bash
88+
run: |
89+
helm push ${{ steps.package.outputs.chart-name }} ${{ inputs.registry-url }}
90+
91+
- name: Cleanup credentials
92+
if: always() && inputs.push == 'true'
93+
shell: bash
94+
run: |
95+
rm -f /tmp/gcloud-key.json

.github/actions/check-credit-card-order/action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ runs:
2222
shell: bash
2323
run: |
2424
RESPONSE=$(./.github/actions/scripts/curl-on-cluster.sh ${{ inputs.namespace }} \
25-
-sLX GET 'credit-card-order-service:8080/v1/orders/${{ inputs.user_id }}/status/latest' \
25+
-sLX GET 'easytrade-credit-card-order-service:8080/v1/orders/${{ inputs.user_id }}/status/latest' \
2626
-H 'accept: application/json')
2727
echo "Response: [${RESPONSE}]"
2828

.github/actions/order-credit-card/action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ runs:
2424
}'
2525
2626
RESPONSE=$(./.github/actions/scripts/curl-on-cluster.sh ${{ inputs.namespace }} \
27-
-sLX POST 'credit-card-order-service:8080/v1/orders' \
27+
-sLX POST 'easytrade-credit-card-order-service:8080/v1/orders' \
2828
-H 'accept: application/json' \
2929
-H 'Content-Type: application/json' \
3030
-d "${BODY}")

.github/workflows/build-on-branch.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
- kubernetes-manifests/**
1010
- skaffold.yaml
1111
- src/**
12+
- helm/**
1213

1314
workflow_call:
1415
secrets:
@@ -17,6 +18,7 @@ on:
1718

1819
env:
1920
CONTAINER_REGISTRY: europe-docker.pkg.dev/dynatrace-demoability/docker/easytrade
21+
HELM_CHART_PATH: helm/easytrade
2022

2123
jobs:
2224
snyk:
@@ -44,3 +46,16 @@ jobs:
4446
push: ${{ needs.calc-version.outputs.is-release}}
4547
tag: ${{ needs.calc-version.outputs.version }}
4648
registry: ${{ env.CONTAINER_REGISTRY }}
49+
command: build
50+
51+
build-helm-chart:
52+
runs-on: ubuntu-24.04
53+
steps:
54+
- name: Checkout repository
55+
uses: actions/checkout@v4
56+
57+
- name: Build Helm chart
58+
uses: ./.github/actions/build-push-helm
59+
with:
60+
chart-path: ${{ env.HELM_CHART_PATH }}
61+
push: false

.github/workflows/build-on-main.yaml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
- kubernetes-manifests/**
99
- skaffold.yaml
1010
- src/**
11+
- helm/**
1112
workflow_dispatch:
1213

1314
workflow_call:
@@ -33,6 +34,8 @@ env:
3334
GAR_ADDRESS: europe-docker.pkg.dev
3435
NAMESPACE: easytrade
3536
CONTAINER_REGISTRY: europe-docker.pkg.dev/dynatrace-demoability/docker/easytrade
37+
HELM_REGISTRY: oci://europe-docker.pkg.dev/dynatrace-demoability/helm
38+
HELM_CHART_PATH: helm/easytrade
3639

3740
jobs:
3841
snyk:
@@ -66,10 +69,19 @@ jobs:
6669
- name: Build easytrade without pushing to docker repository
6770
uses: ./.github/actions/build-push-images
6871
with:
69-
push: ${{ needs.calc-version.outputs.is-release}}
72+
push: ${{ needs.calc-version.outputs.is-release }}
7073
tag: ${{ needs.calc-version.outputs.version }}
7174
registry: ${{ env.CONTAINER_REGISTRY }}
7275

76+
- name: Build and push Helm chart
77+
uses: ./.github/actions/build-push-helm
78+
with:
79+
chart-path: ${{ env.HELM_CHART_PATH }}
80+
push: ${{ needs.calc-version.outputs.is-release }}
81+
registry-url: ${{ env.HELM_REGISTRY }}
82+
version: ${{ needs.calc-version.outputs.version }}
83+
credentials: ${{ secrets.GAR_CREDENTIALS }}
84+
7385
deploy-easytrade:
7486
runs-on: ubuntu-24.04
7587
needs: build-easytrade
@@ -89,12 +101,8 @@ jobs:
89101
with:
90102
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
91103
repository: dynatrace/easytrade-infrastructure
92-
sparse-checkout: kubernetes-manifests
93104
path: easytrade-infrastructure
94105

95-
- name: Export short commit SHA
96-
run: echo "COMMIT_SHA_SHORT=$(echo $GITHUB_SHA | cut -c 1-7)" >> $GITHUB_ENV
97-
98106
# Deploy todo
99107

100108
run-tests:
@@ -111,8 +119,8 @@ jobs:
111119
112120
- name: Enable test environment
113121
run: |
114-
kubectl -n ${{ env.NAMESPACE }} set env deployment/credit-card-order-service WORK_DELAY=10 WORK_RATE=10
115-
kubectl -n ${{ env.NAMESPACE }} set env deployment/third-party-service COURIER_DELAY=10 COURIER_RATE=10 MANUFACTURE_DELAY=10 MANUFACTURE_RATE=10
122+
kubectl -n ${{ env.NAMESPACE }} set env deployment/easytrade-credit-card-order-service WORK_DELAY=10 WORK_RATE=10
123+
kubectl -n ${{ env.NAMESPACE }} set env deployment/easytrade-third-party-service COURIER_DELAY=10 COURIER_RATE=10 MANUFACTURE_DELAY=10 MANUFACTURE_RATE=10
116124
117125
- name: Wait 3 minutes
118126
run: sleep 3m
@@ -140,4 +148,4 @@ jobs:
140148

141149
- name: Disable test environment
142150
run: |
143-
kubectl -n ${{ env.NAMESPACE }} rollout undo deployment/credit-card-order-service deployment/third-party-service
151+
kubectl -n ${{ env.NAMESPACE }} rollout undo deployment/easytrade-credit-card-order-service deployment/easytrade-third-party-service

helm/easytrade/.helmignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

helm/easytrade/Chart.yaml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
apiVersion: v2
2+
name: easytrade
3+
description: A Helm chart for Kubernetes.
4+
type: application
5+
version: 0.1.0
6+
appVersion: "1.16.0"
7+
8+
dependencies:
9+
- name: app
10+
alias: accountservice
11+
repository: "file://./charts/app"
12+
version: "0.1.0"
13+
condition: accountservice.enabled
14+
- name: app
15+
alias: aggregator-service
16+
repository: "file://./charts/app"
17+
version: "0.1.0"
18+
condition: aggregator-service.enabled
19+
- name: app
20+
alias: broker-service
21+
repository: "file://./charts/app"
22+
version: "0.1.0"
23+
condition: broker-service.enabled
24+
- name: app
25+
alias: calculationservice
26+
repository: "file://./charts/app"
27+
version: "0.1.0"
28+
condition: calculationservice.enabled
29+
- name: app
30+
alias: contentcreator
31+
repository: "file://./charts/app"
32+
version: "0.1.0"
33+
condition: contentcreator.enabled
34+
- name: app
35+
alias: credit-card-order-service
36+
repository: "file://./charts/app"
37+
version: "0.1.0"
38+
condition: credit-card-order-service.enabled
39+
- name: app
40+
alias: db
41+
repository: "file://./charts/app"
42+
version: "0.1.0"
43+
condition: db.enabled
44+
- name: app
45+
alias: engine
46+
repository: "file://./charts/app"
47+
version: "0.1.0"
48+
condition: engine.enabled
49+
- name: app
50+
alias: feature-flag-service
51+
repository: "file://./charts/app"
52+
version: "0.1.0"
53+
condition: feature-flag-service.enabled
54+
- name: app
55+
alias: frontend
56+
repository: "file://./charts/app"
57+
version: "0.1.0"
58+
condition: frontend.enabled
59+
- name: app
60+
alias: frontendreverseproxy
61+
repository: "file://./charts/app"
62+
version: "0.1.0"
63+
condition: frontendreverseproxy.enabled
64+
- name: app
65+
alias: loadgen
66+
repository: "file://./charts/app"
67+
version: "0.1.0"
68+
condition: loadgen.enabled
69+
- name: app
70+
alias: loginservice
71+
repository: "file://./charts/app"
72+
version: "0.1.0"
73+
condition: loginservice.enabled
74+
- name: app
75+
alias: manager
76+
repository: "file://./charts/app"
77+
version: "0.1.0"
78+
condition: manager.enabled
79+
- name: app
80+
alias: offerservice
81+
repository: "file://./charts/app"
82+
version: "0.1.0"
83+
condition: offerservice.enabled
84+
- name: app
85+
alias: pricing-service
86+
repository: "file://./charts/app"
87+
version: "0.1.0"
88+
condition: pricing-service.enabled
89+
- name: app
90+
alias: problem-operator
91+
repository: "file://./charts/app"
92+
version: "0.1.0"
93+
condition: problem-operator.enabled
94+
- name: app
95+
alias: rabbitmq
96+
repository: "file://./charts/app"
97+
version: "0.1.0"
98+
condition: rabbitmq.enabled
99+
- name: app
100+
alias: third-party-service
101+
repository: "file://./charts/app"
102+
version: "0.1.0"
103+
condition: third-party-service.enabled

0 commit comments

Comments
 (0)