Skip to content

Commit a054e8d

Browse files
authored
Get rid of skaffold, use docker compose to build and pure helm to deploy (#96)
* add compose build * get rid off skaffold * debug just for sure * input bool * update input label * test dynamic version * ready to merge * push latest
1 parent 68954f5 commit a054e8d

File tree

5 files changed

+199
-186
lines changed

5 files changed

+199
-186
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: "Build and Push Docker Images"
2+
description: "Build Docker images using docker compose and optionally push to registry"
3+
inputs:
4+
push:
5+
description: "Whether to push images to registry"
6+
required: false
7+
default: "false"
8+
tag:
9+
description: "Tag for all Docker images"
10+
required: true
11+
push-latest:
12+
description: "Whether to also push images with 'latest' tag"
13+
required: false
14+
default: "false"
15+
registry:
16+
description: "Docker registry URL"
17+
required: false
18+
default: "europe-docker.pkg.dev/dynatrace-demoability/docker/easytrade"
19+
compose-file:
20+
description: "Path to docker compose file"
21+
required: false
22+
default: "compose.build.yaml"
23+
24+
outputs:
25+
images:
26+
description: "List of built images"
27+
value: ${{ steps.build.outputs.images }}
28+
29+
runs:
30+
using: composite
31+
steps:
32+
- name: Set up Docker Buildx
33+
uses: docker/setup-buildx-action@v3
34+
35+
- name: Build Docker images
36+
id: build
37+
shell: bash
38+
env:
39+
REGISTRY: ${{ inputs.registry }}
40+
TAG: ${{ inputs.tag }}
41+
run: |
42+
echo "Building images with tag: $TAG"
43+
docker compose -f ${{ inputs.compose-file }} build
44+
45+
# List built images
46+
IMAGES=$(docker compose -f ${{ inputs.compose-file }} config --services | tr '\n' ',' | sed 's/,$//')
47+
echo "images=$IMAGES" >> $GITHUB_OUTPUT
48+
echo "Built images: $IMAGES"
49+
50+
- name: Push Docker images
51+
if: inputs.push == 'true'
52+
shell: bash
53+
env:
54+
REGISTRY: ${{ inputs.registry }}
55+
TAG: ${{ inputs.tag }}
56+
run: |
57+
echo "Pushing images to registry..."
58+
docker compose -f ${{ inputs.compose-file }} push
59+
echo "Successfully pushed all images with tag: $TAG"
60+
61+
- name: Push Docker images with latest tag
62+
if: inputs.push == 'true' && inputs.push-latest == 'true'
63+
shell: bash
64+
env:
65+
REGISTRY: ${{ inputs.registry }}
66+
TAG: latest
67+
run: |
68+
echo "Pushing images to registry..."
69+
docker compose -f ${{ inputs.compose-file }} push
70+
echo "Successfully pushed all images with tag: $TAG"

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ on:
1919
required: true
2020

2121
env:
22-
SKAFFOLD_DEFAULT_REPO: europe-docker.pkg.dev/dynatrace-demoability/docker/easytrade
23-
SKAFFOLD_VERSION: 2.13.2
22+
CONTAINER_REGISTRY: europe-docker.pkg.dev/dynatrace-demoability/docker/easytrade
2423
HELM_CHART_PATH: helm/easytrade
2524

2625
jobs:
@@ -37,14 +36,14 @@ jobs:
3736
runs-on: ubuntu-24.04
3837
steps:
3938
- name: Checkout repository
40-
uses: actions/checkout@v4
39+
uses: actions/checkout@v6
4140

4241
- name: Build easytrade without pushing to docker repository
43-
uses: hiberbee/github[email protected]
42+
uses: ./.github/actions/build-push-images
4443
with:
45-
command: build
4644
push: false
47-
skaffold-version: ${{ env.SKAFFOLD_VERSION }}
45+
tag: dev
46+
registry: ${{ env.CONTAINER_REGISTRY }}
4847

4948
build-helm-chart:
5049
runs-on: ubuntu-24.04

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

Lines changed: 29 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ on:
1010
- src/**
1111
- helm/**
1212
workflow_dispatch:
13+
inputs:
14+
run-tests:
15+
description: "Run integration tests after deployment?"
16+
required: false
17+
type: boolean
18+
default: true
1319

1420
workflow_call:
1521
secrets:
@@ -33,9 +39,10 @@ on:
3339
env:
3440
GAR_ADDRESS: europe-docker.pkg.dev
3541
NAMESPACE: easytrade
36-
SKAFFOLD_DEFAULT_REPO: europe-docker.pkg.dev/dynatrace-demoability/docker/easytrade
37-
SKAFFOLD_VERSION: 2.13.2
42+
CONTAINER_REGISTRY: europe-docker.pkg.dev/dynatrace-demoability/docker/easytrade
43+
HELM_REGISTRY: oci://europe-docker.pkg.dev/dynatrace-demoability/helm
3844
HELM_CHART_PATH: helm/easytrade
45+
VERSION: 1.2.${{ github.run_number }}
3946

4047
jobs:
4148
snyk:
@@ -51,7 +58,7 @@ jobs:
5158
runs-on: ubuntu-24.04
5259
steps:
5360
- name: Checkout repository
54-
uses: actions/checkout@v4
61+
uses: actions/checkout@v6
5562

5663
- name: Retrieve gar credentials
5764
run: |
@@ -60,72 +67,59 @@ jobs:
6067
- name: Set application version
6168
uses: ./.github/actions/set-version
6269
with:
63-
version: 1.2.${{ github.run_number }}
70+
version: ${{ env.VERSION }}
6471

65-
- name: "Build easytrade and push it to Docker registry with commit tag"
66-
uses: hiberbee/github[email protected]
72+
- name: Build and push easytrade to docker repository
73+
uses: ./.github/actions/build-push-images
6774
with:
68-
command: build
6975
push: true
70-
skaffold-version: ${{ env.SKAFFOLD_VERSION }}
71-
72-
- name: "Build easytrade and push it to Docker registry with latest tag"
73-
uses: hiberbee/[email protected]
74-
with:
75-
command: build
76-
tag: latest
77-
push: true
78-
skaffold-version: ${{ env.SKAFFOLD_VERSION }}
76+
push-latest: true
77+
tag: ${{ env.VERSION }}
78+
registry: ${{ env.CONTAINER_REGISTRY }}
7979

8080
- name: Build and push Helm chart
8181
uses: ./.github/actions/build-push-helm
8282
with:
8383
chart-path: ${{ env.HELM_CHART_PATH }}
8484
push: true
8585
registry-url: oci://europe-docker.pkg.dev/dynatrace-demoability/helm
86-
version: 1.2.${{ github.run_number }}
86+
version: ${{ env.VERSION }}
8787
credentials: ${{ secrets.GAR_CREDENTIALS }}
8888

8989
deploy-easytrade:
9090
runs-on: ubuntu-24.04
9191
needs: build-easytrade
9292
steps:
93-
- name: Checkout repository
94-
uses: actions/checkout@v4
95-
with:
96-
path: easytrade
97-
9893
- name: Retrieve kubeconfig
9994
run: |
10095
mkdir ~/.kube
10196
echo "${{ secrets.KUBECONFIG }}" > ~/.kube/config
10297
10398
- name: Checkout infrastructure repo
104-
uses: actions/checkout@v4
99+
uses: actions/checkout@v6
105100
with:
106101
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
107102
repository: dynatrace/easytrade-infrastructure
108103
path: easytrade-infrastructure
109104

110-
- name: Export short commit SHA
111-
run: echo "COMMIT_SHA_SHORT=$(echo $GITHUB_SHA | cut -c 1-7)" >> $GITHUB_ENV
112-
113105
- name: Deploy easytrade
114-
uses: hiberbee/[email protected]
115-
with:
116-
command: deploy
117-
tag: ${{ env.COMMIT_SHA_SHORT }}
118-
namespace: ${{ env.NAMESPACE }}
119-
profile: aws-staging
120-
121-
working-directory: ${{ github.workspace }}/easytrade
106+
shell: bash
107+
env:
108+
HELM_CHART_VERSION: ${{ env.VERSION }}
109+
BASE_VALUES_FILE: "./helm-values/aws-base.yaml"
110+
OVERRIDES_VALUES_FILE: "./helm-values/aws-staging.yaml"
111+
DRY_RUN: "false"
112+
DEBUG_MODE: "false"
113+
run: ./deploy.sh
114+
working-directory: ${{ github.workspace }}/easytrade-infrastructure
122115

123116
run-tests:
117+
if: ${{ inputs.run-tests == 'true' }}
124118
runs-on: ubuntu-24.04
125119
needs: deploy-easytrade
126120
steps:
127121
- name: Checkout repository
128-
uses: actions/checkout@v4
122+
uses: actions/checkout@v6
129123

130124
- name: Retrieve kubeconfig
131125
run: |

compose.build.yaml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
services:
2+
accountservice:
3+
image: ${REGISTRY}/accountservice:${TAG}
4+
build:
5+
context: src/accountservice
6+
7+
aggregator-service:
8+
image: ${REGISTRY}/aggregator-service:${TAG}
9+
build:
10+
context: src/aggregator-service
11+
12+
broker-service:
13+
image: ${REGISTRY}/broker-service:${TAG}
14+
build:
15+
context: src/broker-service
16+
17+
calculationservice:
18+
image: ${REGISTRY}/calculationservice:${TAG}
19+
build:
20+
context: src/calculationservice
21+
22+
contentcreator:
23+
image: ${REGISTRY}/contentcreator:${TAG}
24+
build:
25+
context: src/contentcreator
26+
27+
credit-card-order-service:
28+
image: ${REGISTRY}/credit-card-order-service:${TAG}
29+
build:
30+
context: src/credit-card-order-service
31+
32+
db:
33+
image: ${REGISTRY}/db:${TAG}
34+
build:
35+
context: src/db
36+
37+
engine:
38+
image: ${REGISTRY}/engine:${TAG}
39+
build:
40+
context: src/engine
41+
42+
feature-flag-service:
43+
image: ${REGISTRY}/feature-flag-service:${TAG}
44+
build:
45+
context: src/feature-flag-service
46+
47+
frontend:
48+
image: ${REGISTRY}/frontend:${TAG}
49+
build:
50+
context: src/frontend
51+
52+
frontendreverseproxy:
53+
image: ${REGISTRY}/frontendreverseproxy:${TAG}
54+
build:
55+
context: src/frontendreverseproxy
56+
57+
loadgen:
58+
image: ${REGISTRY}/loadgen:${TAG}
59+
build:
60+
context: src/loadgen
61+
62+
loginservice:
63+
image: ${REGISTRY}/loginservice:${TAG}
64+
build:
65+
context: src/loginservice
66+
67+
manager:
68+
image: ${REGISTRY}/manager:${TAG}
69+
build:
70+
context: src/manager/easyTradeManager
71+
72+
offerservice:
73+
image: ${REGISTRY}/offerservice:${TAG}
74+
build:
75+
context: src/offerservice
76+
77+
pricing-service:
78+
image: ${REGISTRY}/pricing-service:${TAG}
79+
build:
80+
context: src/pricing-service
81+
82+
problem-operator:
83+
image: ${REGISTRY}/problem-operator:${TAG}
84+
build:
85+
context: src/problem-operator
86+
87+
rabbitmq:
88+
image: ${REGISTRY}/rabbitmq:${TAG}
89+
build:
90+
context: src/rabbitmq
91+
92+
third-party-service:
93+
image: ${REGISTRY}/third-party-service:${TAG}
94+
build:
95+
context: src/third-party-service

0 commit comments

Comments
 (0)