Skip to content
Merged
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
34 changes: 17 additions & 17 deletions .github/workflows/app-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ name: Backend CI
on:
pull_request:
branches:
- main
- develop
paths:
- "app/backend/**"
- ".github/workflows/app-backend.yml"

push:
branches:
- main
- develop
paths:
- "app/backend/**"
- ".github/workflows/app-backend.yml"
Expand Down Expand Up @@ -113,7 +113,7 @@ jobs:
name: Publish image
runs-on: ubuntu-24.04
needs: security-scan
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
if: github.event_name == 'push' && github.ref == 'refs/heads/develop'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository_owner }}/app-backend
Expand Down Expand Up @@ -157,8 +157,8 @@ jobs:
digest="$(oras resolve "$REGISTRY/$IMAGE_NAME:$GITHUB_SHA")"
echo "digest=$digest" >> "$GITHUB_OUTPUT"

update-dev-chart:
name: Update dev configuration
update-image-reference:
name: Update image reference
runs-on: ubuntu-24.04
needs: publish
env:
Expand All @@ -175,23 +175,23 @@ jobs:
with:
ref: ${{ github.sha }}

- name: Update dev image
- name: Update image reference
run: |
sed -i "s|^ tag:.*| tag: \"$GITHUB_SHA\"|" kubernetes/helm/values-dev.yaml
sed -i "s|^ digest:.*| digest: \"$IMAGE_DIGEST\"|" kubernetes/helm/values-dev.yaml
sed -i "s|^ tag:.*| tag: \"$GITHUB_SHA\"|" kubernetes/helm/values.yaml
sed -i "s|^ digest:.*| digest: \"$IMAGE_DIGEST\"|" kubernetes/helm/values.yaml

- name: Create dev update pull request
id: dev_pr
- name: Create image update pull request
id: image_pr
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
with:
branch: automation/update-dev
base: main
add-paths: kubernetes/helm/values-dev.yaml
commit-message: "change: update dev image"
title: "change: update dev image"
branch: automation/update-image
base: develop
add-paths: kubernetes/helm/values.yaml
commit-message: "change: update application image"
title: "change: update application image"

- name: Run Helm CI
if: steps.dev_pr.outputs.pull-request-operation == 'created' || steps.dev_pr.outputs.pull-request-operation == 'updated'
if: steps.image_pr.outputs.pull-request-operation == 'created' || steps.image_pr.outputs.pull-request-operation == 'updated'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh workflow run helm.yml --ref automation/update-dev
run: gh workflow run helm.yml --ref automation/update-image
18 changes: 5 additions & 13 deletions .github/workflows/helm.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
name: Helm CI

on:
push:
branches:
- main
paths:
- "kubernetes/helm/**"
- "kubernetes/cluster/kind.yaml"
- ".github/workflows/helm.yml"

pull_request:
branches:
- main
- develop
paths:
- "kubernetes/helm/**"
- "kubernetes/cluster/kind.yaml"
Expand Down Expand Up @@ -84,15 +76,15 @@ jobs:
severity: HIGH,CRITICAL
exit-code: "1"

merge-dev-update:
merge-image-update:
needs: validate
if: github.event_name == 'workflow_dispatch' && github.ref_name == 'automation/update-dev'
if: github.event_name == 'workflow_dispatch' && github.ref_name == 'automation/update-image'
runs-on: ubuntu-24.04
permissions:
contents: write
pull-requests: write
steps:
- name: Merge dev update
- name: Merge image update
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh pr merge automation/update-dev --repo "$GITHUB_REPOSITORY" --squash --delete-branch --match-head-commit "$GITHUB_SHA"
run: gh pr merge automation/update-image --repo "$GITHUB_REPOSITORY" --squash --delete-branch --match-head-commit "$GITHUB_SHA"
5 changes: 4 additions & 1 deletion argocd/application-sets/homelab-backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,19 @@ spec:
- environment: dev
namespace: homelab-dev
valuesFile: values-dev.yaml
targetRevision: develop
autoSync: true

- environment: stage
namespace: homelab-stage
valuesFile: values-stage.yaml
targetRevision: develop
autoSync: false

- environment: prod
namespace: homelab-prod
valuesFile: values-prod.yaml
targetRevision: main
autoSync: false

template:
Expand All @@ -34,7 +37,7 @@ spec:

source:
repoURL: https://github.com/sotchenkov/devops-prac.git
targetRevision: main
targetRevision: '{{ .targetRevision }}'
path: kubernetes/helm
helm:
releaseName: homelab-backend
Expand Down
6 changes: 0 additions & 6 deletions kubernetes/helm/values-dev.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
replicaCount: 3

image:
repository: ghcr.io/sotchenkov/app-backend
tag: "5c06d8ee250535169804a8839aebeaf502bfb817"
digest: "sha256:18727c716f9dc38ec60810c6afabc4acd8c5df23f5c0f6916dc8f95e73f7759a"
pullPolicy: IfNotPresent

config:
environment: dev
logLevel: info
Expand Down
6 changes: 0 additions & 6 deletions kubernetes/helm/values-prod.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
replicaCount: 3

image:
repository: ghcr.io/sotchenkov/app-backend
tag: 5edb397fa066a0695b61e635b8d7be930112efd5
digest: sha256:bb12fc4a58ed37a6ebd4d51317c8c5bb5798fa413ab2270d0553d68ff414f406
pullPolicy: IfNotPresent

config:
environment: prod
logLevel: warn
Expand Down
6 changes: 0 additions & 6 deletions kubernetes/helm/values-stage.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
replicaCount: 2

image:
repository: ghcr.io/sotchenkov/app-backend
tag: 5edb397fa066a0695b61e635b8d7be930112efd5
digest: sha256:bb12fc4a58ed37a6ebd4d51317c8c5bb5798fa413ab2270d0553d68ff414f406
pullPolicy: IfNotPresent

config:
environment: stage
logLevel: warn
Expand Down
8 changes: 4 additions & 4 deletions kubernetes/helm/values.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
replicaCount: 2

image:
repository: app-backend
tag: v1.1
digest: ""
pullPolicy: Never
repository: ghcr.io/sotchenkov/app-backend
tag: "5c06d8ee250535169804a8839aebeaf502bfb817"
digest: "sha256:18727c716f9dc38ec60810c6afabc4acd8c5df23f5c0f6916dc8f95e73f7759a"
pullPolicy: IfNotPresent

config:
environment: local
Expand Down