UPDATE: adjustments #219
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy to Rancher Test (PR branches) | |
| on: | |
| push: | |
| branches: | |
| - "**" | |
| env: | |
| REPO_OWNER: aet-devops25 | |
| CLIENT_IMAGE: ghcr.io/aet-devops25/team-oopsops/client | |
| DOCUMENT_IMAGE: ghcr.io/aet-devops25/team-oopsops/server/document-service | |
| ANONYMIZATION_IMAGE: ghcr.io/aet-devops25/team-oopsops/server/anonymization-service | |
| AUTHENTICATION_IMAGE: ghcr.io/aet-devops25/team-oopsops/server/authentication-service | |
| GENAI_IMAGE: ghcr.io/aet-devops25/team-oopsops/genai-service | |
| CLIENT_DIR: ./client | |
| DOCUMENT_DIR: ./server/document-service | |
| ANONYMIZATION_DIR: ./server/anonymization-service | |
| AUTHENTICATION_DIR: ./server/authentication-service | |
| GENAI_DIR: ./genai-service | |
| jobs: | |
| test-genai-service: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python 3.11 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Cache pip dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('genai-service/requirements.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Install dependencies | |
| working-directory: ./genai-service | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Run tests with coverage | |
| working-directory: ./genai-service | |
| env: | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| ANONYMIZATION_SERVICE_URL: "http://mock-service" | |
| run: | | |
| chmod +x run_tests.sh | |
| ./run_tests.sh | |
| build-and-push: | |
| needs: [test-genai-service] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set image tag | |
| run: echo "TAG=${{ github.sha }}" >> $GITHUB_ENV | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and Push Client Image | |
| run: | | |
| docker build -t ${{ env.CLIENT_IMAGE }}:$TAG -t ${{ env.CLIENT_IMAGE }}:latest ${{ env.CLIENT_DIR }} | |
| docker push ${{ env.CLIENT_IMAGE }}:$TAG | |
| docker push ${{ env.CLIENT_IMAGE }}:latest | |
| - name: Build and Push Document Service Image | |
| run: | | |
| docker build -t ${{ env.DOCUMENT_IMAGE }}:$TAG -t ${{ env.DOCUMENT_IMAGE }}:latest -f ${{ env.DOCUMENT_DIR }}/Dockerfile ./server | |
| docker push ${{ env.DOCUMENT_IMAGE }}:$TAG | |
| docker push ${{ env.DOCUMENT_IMAGE }}:latest | |
| - name: Build and Push Anonymization Service Image | |
| run: | | |
| docker build -t ${{ env.ANONYMIZATION_IMAGE }}:$TAG -t ${{ env.ANONYMIZATION_IMAGE }}:latest -f ${{ env.ANONYMIZATION_DIR }}/Dockerfile ./server | |
| docker push ${{ env.ANONYMIZATION_IMAGE }}:$TAG | |
| docker push ${{ env.ANONYMIZATION_IMAGE }}:latest | |
| - name: Build and Push Authentication Service Image | |
| run: | | |
| docker build -t ${{ env.AUTHENTICATION_IMAGE }}:$TAG -t ${{ env.AUTHENTICATION_IMAGE }}:latest -f ${{ env.AUTHENTICATION_DIR }}/Dockerfile ./server | |
| docker push ${{ env.AUTHENTICATION_IMAGE }}:$TAG | |
| docker push ${{ env.AUTHENTICATION_IMAGE }}:latest | |
| - name: Build and Push GenAI Service Image | |
| run: | | |
| docker build -t ${{ env.GENAI_IMAGE }}:$TAG -t ${{ env.GENAI_IMAGE }}:latest -f ${{ env.GENAI_DIR }}/Dockerfile ${{ env.GENAI_DIR }} | |
| docker push ${{ env.GENAI_IMAGE }}:$TAG | |
| docker push ${{ env.GENAI_IMAGE }}:latest | |
| # deploy-helm: | |
| # name: Deploy to Helm cluster | |
| # needs: build-and-push | |
| # runs-on: ubuntu-latest | |
| # steps: | |
| # - name: Checkout code | |
| # uses: actions/checkout@v4 | |
| # - name: Set up kubeconfig | |
| # run: | | |
| # mkdir -p ~/.kube | |
| # echo "${{ secrets.KUBECONFIG }}" > ~/.kube/config | |
| # chmod 600 ~/.kube/config | |
| # - name: Set up kubectl | |
| # uses: azure/setup-kubectl@v3 | |
| # with: | |
| # version: v1.30.1 | |
| # - name: Install Helm | |
| # run: | | |
| # curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash | |
| # - name: Deploy via Helm | |
| # run: | | |
| # helm repo update | |
| # helm upgrade --install oopsops-app \ | |
| # ./helm/oopsops \ | |
| # --namespace oopsops-test \ | |
| # --create-namespace \ | |
| # --set client.image.tag=${{ env.TAG }} \ | |
| # --set document-service.image.tag=${{ env.TAG }} \ | |
| # --set anonymization-service.image.tag=${{ env.TAG }} \ | |
| # --set authentication-service.image.tag=${{ env.TAG }} \ | |
| # --set genai-service.image.tag=${{ env.TAG }} \ | |
| # - name: Verify rollout | |
| # run: | | |
| # kubectl rollout status deployment/authentication-service -n oopsops-test | |
| # kubectl rollout status deployment/document-service -n oopsops-test | |
| # kubectl rollout status deployment/anonymization-service -n oopsops-test | |
| # kubectl rollout status deployment/genai-service -n oopsops-test | |
| # kubectl rollout status deployment/client -n oopsops-test |