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
54 changes: 52 additions & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,10 @@ jobs:
tags: |
${{ secrets.DOCKER_REGISTRY_URL }}/stars-backend:${{ needs.check_version_update.outputs.backend_version }}
${{ secrets.DOCKER_REGISTRY_URL }}/stars-backend:latest
cache-from: type=gha
cache-to: type=gha,mode=max
cache-from: type=registry,ref=${{ secrets.DOCKER_REGISTRY_URL }}/stars-backend:cache
cache-to: type=registry,ref=${{ secrets.DOCKER_REGISTRY_URL }}/stars-backend:cache,mode=max
# Use docker registry cache not to exceed GitHub Actions storage limits
# Builds will be slower but won't fail due to storage limits
Comment on lines +115 to +118
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cache configuration change from GitHub Actions cache to registry cache is good for avoiding storage limits. However, consider adding error handling and fallback mechanisms to ensure builds don't fail if the registry cache is unavailable.

cache-from: |
  type=registry,ref=${{ secrets.DOCKER_REGISTRY_URL }}/stars-backend:cache
  type=gha
cache-to: |
  type=registry,ref=${{ secrets.DOCKER_REGISTRY_URL }}/stars-backend:cache,mode=max
  type=gha,mode=max


- name: Backend Build Summary
run: |
Expand Down Expand Up @@ -203,3 +205,51 @@ jobs:
echo "⏭️ (SKIP) Frontend: No version change detected"
fi
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"

deploy-backend:
name: Restart Backend Deployment
if: github.event.pull_request.merged && needs.build-backend.result == 'success'
needs: [check_version_update, build-backend]
runs-on: ubuntu-latest
steps:
- name: Set up kubectl
uses: azure/setup-kubectl@v3
with:
version: 'latest'
Comment thread
marcorosa marked this conversation as resolved.

- name: Configure kubectl for SAP BTP Kyma
run: |
mkdir -p ~/.kube
echo "${{ secrets.KUBECONFIG }}" | base64 -d > ~/.kube/config
chmod 600 ~/.kube/config
Comment on lines +220 to +224
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The kubectl configuration step has potential security improvements. Consider using a temporary file with proper cleanup and more restrictive permissions.

- name: Configure kubectl for SAP BTP Kyma
  run: |
    KUBECONFIG_FILE=$(mktemp)
    echo "${{ secrets.KUBECONFIG }}" | base64 -d > "$KUBECONFIG_FILE"
    chmod 400 "$KUBECONFIG_FILE"
    export KUBECONFIG="$KUBECONFIG_FILE"
    # Your kubectl commands here
    rm -f "$KUBECONFIG_FILE"


- name: Restart Backend Deployment
run: |
echo "🔄 Restarting backend deployment to pull latest image..."
kubectl rollout restart deployment/stars-backend -n stars
kubectl rollout status deployment/stars-backend -n stars --timeout=10m
echo "✅ Backend deployment restarted successfully"

deploy-frontend:
name: Restart Frontend Deployment
if: github.event.pull_request.merged && needs.build-frontend.result == 'success'
needs: [check_version_update, build-frontend]
runs-on: ubuntu-latest
steps:
- name: Set up kubectl
uses: azure/setup-kubectl@v3
with:
version: 'latest'

- name: Configure kubectl for SAP BTP Kyma
run: |
mkdir -p ~/.kube
echo "${{ secrets.KUBECONFIG }}" | base64 -d > ~/.kube/config
chmod 600 ~/.kube/config

- name: Restart Frontend Deployment
run: |
echo "🔄 Restarting frontend deployment to pull latest image..."
kubectl rollout restart deployment/stars-frontend -n stars
kubectl rollout status deployment/stars-frontend -n stars --timeout=10m
echo "✅ Frontend deployment restarted successfully"
Comment on lines +209 to +255
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The deployment jobs have significant code duplication. Consider extracting the common kubectl configuration into a reusable composite action or using a matrix strategy to reduce maintenance overhead.

deploy:
  name: Restart Deployments
  if: github.event.pull_request.merged && (needs.build-backend.result == 'success' || needs.build-frontend.result == 'success')
  needs: [check_version_update, build-backend, build-frontend]
  runs-on: ubuntu-latest
  strategy:
    matrix:
      service: 
        - { name: backend, condition: "needs.build-backend.result == 'success'" }
        - { name: frontend, condition: "needs.build-frontend.result == 'success'" }
  steps:
    - name: Set up kubectl
      uses: azure/setup-kubectl@v3
      with:
        version: 'latest'
    
    - name: Configure kubectl for SAP BTP Kyma
      run: |
        mkdir -p ~/.kube
        echo "${{ secrets.KUBECONFIG }}" | base64 -d > ~/.kube/config
        chmod 600 ~/.kube/config
    
    - name: Restart ${{ matrix.service.name }} Deployment
      if: ${{ matrix.service.condition }}
      run: |
        echo "🔄 Restarting ${{ matrix.service.name }} deployment to pull latest image..."
        kubectl rollout restart deployment/stars-${{ matrix.service.name }} -n stars
        kubectl rollout status deployment/stars-${{ matrix.service.name }} -n stars --timeout=10m
        echo "✅ ${{ matrix.service.name }} deployment restarted successfully"

26 changes: 23 additions & 3 deletions backend-agent/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Caches
**/__pycache__
cache
**/.cache
**/.mypy_cache

# Libraries
venv*
Expand All @@ -13,10 +15,28 @@ logger.log
result_gptfuzz.txt
prompt_success.txt

# Non-relevant files and folders
README.md
*.md
docs/
examples/
build/
dist/
*.egg-info/

# Sensitive data
.env
.env*
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .env* pattern is good for excluding environment files, but consider being more explicit about which environment files to exclude to avoid accidentally excluding legitimate files.

# Environment files
.env
.env.local
.env.development
.env.test
.env.production
.env.*.local


# Development files
# Development files and folders
.vscode
.gitignore
README.md
.git
**/*.pyc
**/*.pyo
**/*.pyd
**/.pytest_cache
**/test*
**/Test*
**/.coverage
**/htmlcov
**/.tox
Comment on lines +35 to +42
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good improvements to the .dockerignore file! However, the test exclusion patterns might be too broad and could exclude legitimate files. Consider being more specific with test patterns.

# Test files (more specific patterns)
**/tests/
**/*_test.py
**/test_*.py
**/*Test*.py
**/.pytest_cache
**/.coverage
**/htmlcov
**/.tox

8 changes: 5 additions & 3 deletions backend-agent/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
FROM astral/uv:python3.11-trixie AS builder
FROM astral/uv:python3.11-trixie-slim AS builder

# Install build dependencies including Rust for packages that need it
RUN apt-get update && apt-get install -y \
build-essential \
git \
curl \
pkg-config \
libssl-dev \
Comment thread
marcorosa marked this conversation as resolved.
Expand Down Expand Up @@ -32,13 +33,14 @@ RUN . ~/.cargo/env && \

# ----------------------------------------

FROM python:3.11-slim-trixie
FROM python:3.11-slim-trixie AS runtime

# Install only runtime dependencies
RUN apt-get update && apt-get install -y \
libssl3 \
libffi8 \
&& rm -rf /var/lib/apt/lists/*
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
Comment thread
marcorosa marked this conversation as resolved.

WORKDIR /app

Expand Down