Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ jobs:

- name: Create Version Artifact
run: |
echo ${{ inputs.version }} > docker-version.txt
echo ${{ inputs.version }} > image-tag.txt

- name: Upload Docker Image Tag
uses: actions/upload-artifact@v3
with:
name: docker-version
path: docker-version.txt
name: image-tag
path: image-tag.txt
54 changes: 41 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
branches:
- main
- develop
- hotfix/*
permissions:
id-token: write
Expand All @@ -15,47 +16,74 @@ jobs:
version: 61.${{ github.run_number }}.${{ github.run_attempt }}
java_version: 21
java_distribution: "corretto"

build-docker:
name: Build Docker
uses: ./.github/workflows/build-docker.yml
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/hotfix/')
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' ||startsWith(github.ref, 'refs/heads/hotfix/')
with:
version: 61.${{ github.run_number }}.${{ github.run_attempt }}
image_name: "truemark/helloworld-java"
secrets:
aws_assume_role: ${{ secrets.AWS_ASSUME_ROLE }}
docker_hub_username: ${{ secrets.DOCKER_HUB_USERNAME }}
docker_hub_password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
needs: [build-maven]
diff-stage:
needs: [ build-maven ]

cdk-diff-stage:
if: github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/hotfix/')
name: CDK diff to Stage
uses: ./.github/workflows/cdk-diff.yml
with:
environment: "stage"
secrets:
aws_assume_role: ${{ secrets.AWS_ASSUME_ROLE }}
needs: [ build-maven ]
deploy-stage:
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/hotfix/')
name: Deploy to Stage
uses: ./.github/workflows/deploy.yml
needs: [ build-maven, build-docker ]

cdk-deploy-stage:
if: github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/hotfix/')
name: CDK deploy to Stage
uses: ./.github/workflows/cdk-deploy.yml
with:
environment: "stage"
secrets:
aws_assume_role: ${{ secrets.AWS_ASSUME_ROLE }}
needs: [ cdk-diff-stage ]

eks-deploy-stage:
if: github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/hotfix/')
name: EKS deploy to Stage
uses: ./.github/workflows/eks-deploy.yml
with:
environment: "stage"
needs: [diff-stage, build-docker]
needs: [ cdk-deploy-stage ]

cdk-diff-prod:
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/hotfix/')
name: CDK diff to Prod
uses: ./.github/workflows/cdk-diff.yml
with:
environment: "prod"
secrets:
aws_assume_role: ${{ secrets.AWS_ASSUME_ROLE }}
needs: [ build-maven, build-docker ]

cdk-deploy-prod:
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/hotfix/')
name: CDK deploy to Prod
uses: ./.github/workflows/cdk-deploy.yml
with:
environment: "prod"
secrets:
aws_assume_role: ${{ secrets.AWS_ASSUME_ROLE }}
needs: [diff-stage, build-docker]
needs: [ cdk-diff-prod ]

eks-deploy-prod:
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/hotfix/')
name: Deploy to Prod
uses: ./.github/workflows/deploy.yml
name: EKS deploy to Prod
uses: ./.github/workflows/eks-deploy.yml
with:
environment: "prod"
needs: [cdk-deploy-prod]
secrets:
aws_assume_role: ${{ secrets.AWS_ASSUME_ROLE }}
needs: [ cdk-deploy-prod ]
1 change: 1 addition & 0 deletions .github/workflows/cdk-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
runs-on: ubuntu-latest
container: # Replace with GitHub action in the future
image: public.ecr.aws/truemark/aws-cdk:ubuntu
environment: ${{ inputs.environment }}
steps:
- uses: actions/checkout@v4

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
name: docker-version
name: image-tag

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
Expand All @@ -44,7 +44,7 @@ jobs:
- name: Get Docker Image Tag
shell: bash
run: |
echo "IMAGE_TAG=$(cat docker-version.txt)" >> $GITHUB_ENV
echo "IMAGE_TAG=$(cat image-tag.txt)" >> $GITHUB_ENV

- name: Setup Cluster Access
run: |
Expand All @@ -60,4 +60,4 @@ jobs:
env:
KUBE_CONFIG_DATA: ${{ env.KUBE_CONFIG_DATA }}
with:
command: helm upgrade --install --wait --atomic --set image.tag=$IMAGE_TAG -f helm-chart/hello-world/values.yaml hello-world helm-chart/hello-world
command: helm upgrade --install -n hello-world --create-namespace --wait --atomic --set image.tag=$IMAGE_TAG -f helm-chart/hello-world/values.yaml hello-world helm-chart/hello-world
4 changes: 4 additions & 0 deletions helm-chart/hello-world/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ spec:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
{{- if .Values.env }}
env:
{{- toYaml .Values.env | nindent 10 }}
{{- end }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
Expand Down
2 changes: 1 addition & 1 deletion helm-chart/hello-world/templates/istio.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ metadata:
name: {{ include "truemark.fullname" . }}
spec:
hosts:
- "*"
- "hello.stage.truemark.io"
gateways:
- {{ include "truemark.fullname" . }}
http:
Expand Down
7 changes: 5 additions & 2 deletions helm-chart/hello-world/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

replicaCount: 1

env:
- name: MESSAGE
value: "Hello, World from the Helm!"

image:
repository: public.ecr.aws/truemark/helloworld-java
Expand Down Expand Up @@ -76,11 +79,11 @@ istio:
tls:
httpsRedirect: true
hosts:
- "*"
- "hello.stage.truemark.io"
- port:
number: 443
name: https
protocol: HTTP
hosts:
- "*"
- "hello.stage.truemark.io"