Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
78785df
fix: Align rollback.yml with packages-deploy.yml best practices
IvanildoBarauna Mar 4, 2026
367a668
fix: Correct YAML syntax error in rollback PR body
IvanildoBarauna Mar 4, 2026
58ab277
fix: Correct YAML syntax in rollback PR creation
IvanildoBarauna Mar 4, 2026
8ef86cc
fix: Remove multiline heredoc from run block to fix YAML syntax error
IvanildoBarauna Mar 4, 2026
b62b1d5
Merge pull request #93 from ivanildobarauna-dev/fix/rollback-workflow…
IvanildoBarauna Mar 4, 2026
92ce830
fix: Add workflows write permission to allow branch creation from tags
IvanildoBarauna Mar 4, 2026
5c6e45f
Merge pull request #94 from ivanildobarauna-dev/fix/rollback-workflow…
IvanildoBarauna Mar 4, 2026
b723b22
fix: Remove invalid workflows permission and use PAT for branch push
IvanildoBarauna Mar 4, 2026
ec27b9b
Merge pull request #95 from ivanildobarauna-dev/fix/rollback-workflow…
IvanildoBarauna Mar 4, 2026
68188d9
fix: Pass GH_PAT to checkout action to allow pushing workflow files
IvanildoBarauna Mar 4, 2026
b2a0a10
Merge pull request #96 from ivanildobarauna-dev/fix/rollback-checkout…
IvanildoBarauna Mar 4, 2026
163e924
fix: Use GH_PAT for gh pr create in rollback PR step
IvanildoBarauna Mar 4, 2026
6f8d89d
Merge pull request #97 from ivanildobarauna-dev/fix/rollback-pr-creat…
IvanildoBarauna Mar 4, 2026
88011a9
feat: Add connection string log before engine build
IvanildoBarauna Mar 4, 2026
cc3a8c7
Merge pull request #98 from ivanildobarauna-dev/feature/add-db-connec…
IvanildoBarauna Mar 4, 2026
79caafe
fix: Add fetch-tags to checkout so rollback branch is created from co…
IvanildoBarauna Mar 4, 2026
ff4a1c8
Merge pull request #99 from ivanildobarauna-dev/fix/rollback-fetch-tags
IvanildoBarauna Mar 4, 2026
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
42 changes: 19 additions & 23 deletions .github/workflows/rollback.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,16 @@ jobs:
contents: write
packages: read
pull-requests: write
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
token: ${{ secrets.GH_PAT }}

- name: Determine rollback version
run: |
if [ -n "${{ github.event.inputs.version }}" ]; then
Expand Down Expand Up @@ -119,16 +127,22 @@ jobs:
start_period: 60s
EOF

- name: Sync rollback compose to VPS
- name: Create temporary .env file
run: |
rsync -avz \
docker-compose.rollback.yaml \
echo "DD_API_KEY=${{ secrets.DATADOG_API_KEY }}" > .env

- name: Sync rollback compose and env to VPS
run: |
rsync -avz --delete \
docker-compose.rollback.yaml .env \
${{ secrets.VPS_SSH_USER }}@${{ secrets.VPS_SSH_HOST }}:/home/ubuntu/app/site/

- name: Deploy rollback version on VPS
run: |
ssh ${{ secrets.VPS_SSH_USER }}@${{ secrets.VPS_SSH_HOST }} << 'EOF'
cd /home/ubuntu/app/site
rm -f .env
echo "DD_API_KEY=${{ secrets.DATADOG_API_KEY }}" >> .env
docker compose -f docker-compose.rollback.yaml pull
docker compose -f docker-compose.rollback.yaml up -d --remove-orphans
docker system prune -f
Expand All @@ -149,11 +163,6 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Create rollback PR
run: |
ROLLBACK_TAG="v${ROLLBACK_VERSION}"
Expand Down Expand Up @@ -181,25 +190,12 @@ jobs:
--base main \
--head ${PR_BRANCH} \
--title "Rollback: Revert to v${ROLLBACK_VERSION}" \
--body "🚨 **Automatic Rollback PR**

This PR reverts the codebase to version \`v${ROLLBACK_VERSION}\` to match the environment rollback.

**What changed:**
- Environment was rolled back to version \`v${ROLLBACK_VERSION}\`
- This PR synchronizes the source code to match

**Instructions:**
1. Review the changes carefully
2. Merge this PR to update main with the previous stable version

---
*This PR was automatically created by the Rollback workflow*"
--body "Automatic Rollback PR - This PR reverts the codebase to v${ROLLBACK_VERSION} to match the environment rollback. Review the changes carefully and merge to update main with the previous stable version. This PR was automatically created by the Rollback workflow."
else
echo "PR #${EXISTING_PR} already exists for this rollback"
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GH_PAT }}

environment:
name: Production
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@ def build_connection_string(self) -> str:

def build_engine(self, retry_interval: int = 5):
attempt = 0

logger.info(f"Conectando ao banco de dados: {self._obfuscated_connection_string()}")

while True:
attempt += 1
try:
engine = create_engine(self.connection_string,
engine = create_engine(self.connection_string,
echo=False,
pool_size=5,
max_overflow=10,
Expand Down
Loading