Add External Secrets Operator config for Vault-backed DB credentials #40
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: REST-API-CI-Pipeline | |
| on: | |
| push: | |
| branches: | |
| - dev | |
| - main | |
| paths: | |
| - 'app/**' | |
| pull_request: | |
| branches: | |
| - dev | |
| - main | |
| paths: | |
| - 'app/**' | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: self-hosted | |
| outputs: | |
| image_tag: ${{ steps.build-image.outputs.image_tag }} | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Install Dependencies | |
| run: | | |
| cd app | |
| python3 -m venv venv | |
| source venv/bin/activate | |
| pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Run Tests with SQLite | |
| run: | | |
| source app/venv/bin/activate | |
| pytest -v tests/unit | |
| - name: Build Docker Image | |
| id: build-image | |
| run: | | |
| cd app | |
| IMAGE_TAG=${GITHUB_SHA::7} | |
| echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV | |
| echo "image_tag=$IMAGE_TAG" >> $GITHUB_OUTPUT | |
| docker build -t flask-app:$IMAGE_TAG . | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
| - name: Push Docker Image to Docker Hub | |
| run: | | |
| docker tag flask-app:$IMAGE_TAG ${{ secrets.DOCKER_HUB_USERNAME }}/flask-app:$IMAGE_TAG | |
| docker push ${{ secrets.DOCKER_HUB_USERNAME }}/flask-app:$IMAGE_TAG | |
| - name: Cleanup Local Docker Images | |
| run: | | |
| docker rmi flask-app:$IMAGE_TAG || true | |
| docker rmi ${{ secrets.DOCKER_HUB_USERNAME }}/flask-app:$IMAGE_TAG || true | |
| update-helm: | |
| needs: build | |
| runs-on: self-hosted | |
| steps: | |
| - name: Checkout main branch | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| fetch-depth: 0 | |
| token: ${{ secrets.GH_PAT }} | |
| - name: Configure Git | |
| run: | | |
| git config user.name "akhil27051999" | |
| git config user.email "thyadiakhil@gmail.com" | |
| - name: Update image tag in Helm values | |
| run: | | |
| echo "Updating image tag to $IMAGE_TAG..." | |
| sed -i.bak "s|^\([[:space:]]*tag:[[:space:]]*\).*|\1$IMAGE_TAG|" helm/application/values.yaml | |
| rm -f helm/application/values.yaml.bak | |
| echo "Updated Helm values.yaml:" | |
| cat helm/application/values.yaml | |
| env: | |
| IMAGE_TAG: ${{ needs.build.outputs.image_tag }} | |
| - name: Commit and push | |
| run: | | |
| git add helm/application/values.yaml | |
| git diff --cached --quiet && echo "No changes to commit" && exit 0 | |
| git commit -m "ci: update flask-app image tag to $IMAGE_TAG [skip ci]" | |
| git push origin main | |
| env: | |
| IMAGE_TAG: ${{ needs.build.outputs.image_tag }} |