Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
e14e5ec
"Update commit message in kustomize-ci workflow to include 'latest' i…
sugesh-cloudops Aug 6, 2025
b96be6f
`Update GitHub Actions workflow to set GITHUB_TOKEN and modify git re…
sugesh-cloudops Aug 6, 2025
49d6012
`Update GitHub workflow to use GH_PAT and IMAGE_TAG instead of GIT_PAT`
sugesh-cloudops Aug 6, 2025
625a8ad
`Refactor kustomize-ci.yaml to remove update-kustomize job and merge …
sugesh-cloudops Aug 6, 2025
9d8abdb
`Update GitHub Actions workflow to use GH_PAT secret instead of TOKEN`
sugesh-cloudops Aug 6, 2025
f85bc07
`Update git config and remote URL in kustomize-ci workflow`
sugesh-cloudops Aug 6, 2025
68be98b
`Refactor GitHub Actions workflow for updating Kustomize overlay`
sugesh-cloudops Aug 6, 2025
01ed870
"Removed Build and Push Docker Image steps in kustomize-ci workflow"
sugesh-cloudops Aug 6, 2025
e5b906f
`Update kustomize-ci workflow to configure git credentials and update…
sugesh-cloudops Aug 6, 2025
db31909
`Update .github/workflows/kustomize-ci.yaml to include feature/develo…
sugesh-cloudops Aug 6, 2025
0347a31
"Added git pull and rebase to kustomize-ci workflow and added newline…
sugesh-cloudops Aug 6, 2025
138ab6f
`Update CI workflow to use git rebase and force-push to auto/kustomiz…
sugesh-cloudops Aug 6, 2025
759bbf8
`Refactor GitHub Actions workflow for kustomize-ci.yaml`
sugesh-cloudops Aug 6, 2025
d7ec36a
"Added git pull and rebase to kustomize-ci workflow"
sugesh-cloudops Aug 6, 2025
32a479a
"Removed development branch from push event and removed git pull comm…
sugesh-cloudops Aug 6, 2025
241803a
`Update image tag and push to branch in kustomize-ci workflow`
sugesh-cloudops Aug 6, 2025
4505d27
`Added concurrency control and minor formatting changes to kustomize-…
sugesh-cloudops Aug 6, 2025
a6ba9a3
`Refactor GitHub Actions workflow for Helm CI: Update Docker image ta…
sugesh-cloudops Aug 6, 2025
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
164 changes: 82 additions & 82 deletions .github/workflows/helm-ci.yaml
Original file line number Diff line number Diff line change
@@ -1,82 +1,82 @@
# name: Helm CI - Build and Update Values.yaml

# on:
# push:
# branches:
# - main

# jobs:
# build-and-push:
# name: Build and Push Docker Image
# runs-on: ubuntu-latest

# outputs:
# image-tag: ${{ steps.meta.outputs.image-tag }}

# env:
# IMAGE_NAME: ${{ secrets.DOCKERHUB_USERNAME }}/springboot-postgres

# steps:
# - name: Checkout code
# uses: actions/checkout@v4

# - name: Set up JDK 17
# uses: actions/setup-java@v4
# with:
# distribution: 'temurin'
# java-version: '17'

# - name: Build Spring Boot App
# working-directory: ./app
# run: ./mvnw clean package -DskipTests

# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3

# - name: Login to DockerHub
# uses: docker/login-action@v3
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}

# - name: Build and Push Docker Image
# id: meta
# run: |
# COMMIT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
# IMAGE_TAG="main-${COMMIT_SHA}"

# echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV
# echo "::set-output name=image-tag::$IMAGE_TAG"

# docker build -t $IMAGE_NAME:$IMAGE_TAG ./app
# docker push $IMAGE_NAME:$IMAGE_TAG

# update-helm-values:
# name: Update Helm Values
# needs: build-and-push
# runs-on: ubuntu-latest

# env:
# IMAGE_TAG: ${{ needs.build-and-push.outputs.image-tag }}
# IMAGE_NAME: ${{ secrets.DOCKERHUB_USERNAME }}/springboot-postgres

# steps:
# - name: Checkout code
# uses: actions/checkout@v4

# - name: Update image.tag in values.yaml
# run: |
# FILE="helm/springboot-postgres-prod/values.yaml"
# echo "Updating $FILE with image tag $IMAGE_TAG"

# # Replace the image tag line
# sed -i.bak -E "s|tag:.*|tag: \"$IMAGE_TAG\"|" "$FILE"

# - name: Commit and Push changes
# run: |
# git config --global user.name "github-actions"
# git config --global user.email "github-actions@github.com"

# git add helm/springboot-postgres-prod/values.yaml
# git commit -m "Update Helm image tag to $IMAGE_TAG"
# git push
name: Helm CI - Build and Push

on:
push:
branches:
- main

jobs:
build-and-push:
name: Build and Push Docker Image
runs-on: ubuntu-latest

outputs:
image-tag: ${{ steps.set-tag.outputs.tag }}

env:
IMAGE_NAME: ${{ secrets.DOCKERHUB_USERNAME }}/springboot-postgres

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- name: Build Spring Boot App
working-directory: ./app
run: ./mvnw clean package -DskipTests

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set Image Tag
id: set-tag
run: |
COMMIT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
TAG="main-${COMMIT_SHA}"
echo "tag=$TAG" >> $GITHUB_OUTPUT

- name: Build and Push Docker Image
run: |
docker build -t $IMAGE_NAME:${{ steps.set-tag.outputs.tag }} ./app
docker push $IMAGE_NAME:${{ steps.set-tag.outputs.tag }}

update-values:
name: Update Helm values.yaml
needs: build-and-push
runs-on: ubuntu-latest

env:
IMAGE_NAME: ${{ secrets.DOCKERHUB_USERNAME }}/springboot-postgres
IMAGE_TAG: ${{ needs.build-and-push.outputs.image-tag }}
FILE: helm/springboot-postgres-prod/values.yaml

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Configure Git
run: |
git config --global user.name "${{ secrets.GIT_USER_NAME }}"
git config --global user.email "${{ secrets.GIT_USER_EMAIL }}"

- name: Update values.yaml
run: |
echo "Updating $FILE with image: $IMAGE_NAME:$IMAGE_TAG"
sed -i.bak -E "s|image:.*|image: ${IMAGE_NAME}:${IMAGE_TAG}|" "$FILE"

git add "$FILE"
git commit -m "Update image tag to $IMAGE_TAG in Helm values.yaml"

git pull origin auto/helm-update --rebase || true
git push origin HEAD:auto/helm-update-prod --force-with-lease
68 changes: 42 additions & 26 deletions .github/workflows/kustomize-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@ name: Kustomize CI - Build and Push
on:
push:
branches:
- feature/**
- feature/development
- development

concurrency:
group: kustomize-update
cancel-in-progress: true

jobs:
build-and-push:
name: Build and Push Docker Image
runs-on: ubuntu-latest

outputs:
image-tag: ${{ steps.set-tag.outputs.tag }}

env:
IMAGE_NAME: ${{ secrets.DOCKERHUB_USERNAME }}/springboot-postgres

Expand All @@ -37,41 +44,50 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and Push Docker Image
- name: Set image tag
id: set-tag
run: |
COMMIT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
BRANCH=$(echo "${GITHUB_REF#refs/heads/}" | tr '/' '-')
TAG="${BRANCH}-${COMMIT_SHA}"

docker build -t $IMAGE_NAME:$TAG ./app
docker push $IMAGE_NAME:$TAG
echo "tag=$TAG" >> "$GITHUB_OUTPUT"

- name: Build and push Docker image
run: |
docker build -t $IMAGE_NAME:${{ steps.set-tag.outputs.tag }} ./app
docker push $IMAGE_NAME:${{ steps.set-tag.outputs.tag }}

update-kustomize:
name: Update Kustomize Overlay
needs: build-and-push
runs-on: ubuntu-latest
name: Update Kustomize Overlay
needs: build-and-push
runs-on: ubuntu-latest

env:
IMAGE_NAME: ${{ secrets.DOCKERHUB_USERNAME }}/springboot-postgres
IMAGE_TAG: ${{ needs.build-and-push.outputs.image-tag }}

env:
IMAGE_NAME: ${{ secrets.DOCKERHUB_USERNAME }}/springboot-postgres
IMAGE_TAG: ${{ needs.build-and-push.outputs.image-tag }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Configure git
run: |
git config --global user.name "${{ secrets.GIT_USER_NAME }}"
git config --global user.email "${{ secrets.GIT_USER_EMAIL }}"

- name: Update image tag and push to branch
run: |
FILE="kustomize/overlays/dev/patch-deployment-image.yaml"

steps:
- name: Checkout code
uses: actions/checkout@v4
echo "Updating $FILE with image: $IMAGE_NAME:$IMAGE_TAG"

- name: Update image tag in dev overlay
run: |
FILE="kustomize/overlays/dev/patch-deployment-image.yaml"
sed -i.bak -E "s|image:.*|image: ${IMAGE_NAME}:${IMAGE_TAG}|" "$FILE"

echo "Updating $FILE with image: $IMAGE_NAME:$IMAGE_TAG"
git checkout -B auto/kustomize-update
git add "$FILE"
git commit -m "Update image tag to $IMAGE_TAG" || echo "No changes to commit"

sed -i.bak -E "s|image:.*|image: ${IMAGE_NAME}:${IMAGE_TAG}|" "$FILE"
git push origin auto/kustomize-update --force

- name: Commit and push changes
run: |
git config --global user.name ${{ secrets.GIT_USER_EMAIL }}
git config --global user.email ${{ secrets.GIT_USER_NAME }}

git add kustomize/overlays/dev/patch-deployment-image.yaml
git commit -m "Update image tag to $IMAGE_TAG"
git push