Skip to content

ci: build por PR (:pr-N) pro ambiente de review (EVO-1998)#3

Merged
gomessguii merged 2 commits into
developfrom
guilhermegomes/evo-1998-pr-build
Jul 3, 2026
Merged

ci: build por PR (:pr-N) pro ambiente de review (EVO-1998)#3
gomessguii merged 2 commits into
developfrom
guilhermegomes/evo-1998-pr-build

Conversation

@gomessguii

@gomessguii gomessguii commented Jul 3, 2026

Copy link
Copy Markdown
Member

O que

Adiciona build por PR à CI deste serviço: no pull_request (main/develop), builda a imagem amd64 e publica :pr-<N> (mutável, pro revisor) + :sha-<sha7> (imutável, do head do PR). Os builds de branch/tag (multi-arch → :latest/:develop/:vX) passam a ser guardados por if: github.event_name != 'pull_request'.

Por que

Habilita o ambiente de review por PR (EVO-1998): o review.sh (no umbrella evo-crm-community) sobe a stack com cada serviço na imagem do seu PR (:pr-N). Sem o :pr-N, o revisor não consegue testar um PR aberto rodando. Espelha o padrão já em produção no evo-flow-community.

Detalhes

  • build-pr: single-arch amd64 (o ambiente de review é uma máquina só; ~metade do custo do multi-arch). context/Dockerfile/build-args idênticos ao job de build existente deste serviço.
  • concurrency: cancela builds de PR superseded (retest reflete o último commit); nunca cancela push em main/develop.
  • Nada mais alteradoIMAGE_NAME, lógica de tags de branch/tag e matriz multi-arch intactos.

Ref: EVO-1998.

Summary by Sourcery

Add pull_request-triggered Docker image builds for PR review environments while preserving existing branch/tag multi-arch builds.

New Features:

  • Build and publish single-arch amd64 Docker images for pull requests with PR-specific and commit-specific tags.

Enhancements:

  • Configure workflow concurrency to cancel superseded pull_request builds without affecting main/develop push builds.

CI:

  • Extend docker-publish GitHub Actions workflow to run on pull_request events to main/develop and to skip existing build/merge jobs for pull_request events.

Gatilho pull_request (main/develop) + job build-pr (amd64) publicando
:pr-<N> + :sha-<sha7>. Builds de branch/tag (multi-arch) guardados com
if: github.event_name != 'pull_request'. Espelha o evo-flow.
@sourcery-ai

sourcery-ai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds a PR-specific Docker image build to the CI, including concurrency control and tag scheme changes, while gating existing multi-arch branch/tag builds and merge-manifest job to non-PR events.

File-Level Changes

Change Details Files
Introduce PR-only single-arch Docker image build and adjust CI control flow for pull_request vs push events.
  • Trigger workflow also on pull_request events targeting main/develop.
  • Add workflow-level concurrency group keyed by PR number or ref and cancel only in-progress pull_request workflows.
  • Add build-pr job that builds and pushes a single-arch linux/amd64 image for pull requests, tagging it with mutable :pr- and immutable :sha- tags using IMAGE_NAME and the PR head SHA.
  • Configure build job to run only for non-pull_request events and keep its existing multi-arch matrix configuration intact.
  • Gate merge job to non-pull_request events so manifest merging and multi-arch tagging continue only on branch/tag pushes.
.github/workflows/docker-publish.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The build-pr job will currently run for PRs from forks but is likely to fail at the docker/login-action step due to unavailable DOCKERHUB_* secrets; consider guarding the job with a condition like if: github.event.pull_request.head.repo.full_name == github.repository or similar to skip forked PRs gracefully.
  • Using the same GHA cache scope (scope=linux/amd64) for both PR and main/develop builds may cause cache churn between CI contexts; if you want to keep PR builds isolated, consider adding the event name or PR number to the cache scope for build-pr.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `build-pr` job will currently run for PRs from forks but is likely to fail at the `docker/login-action` step due to unavailable `DOCKERHUB_*` secrets; consider guarding the job with a condition like `if: github.event.pull_request.head.repo.full_name == github.repository` or similar to skip forked PRs gracefully.
- Using the same GHA cache scope (`scope=linux/amd64`) for both PR and main/develop builds may cause cache churn between CI contexts; if you want to keep PR builds isolated, consider adding the event name or PR number to the cache scope for `build-pr`.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@gomessguii
gomessguii merged commit 7a66df8 into develop Jul 3, 2026
4 checks passed
@gomessguii
gomessguii deleted the guilhermegomes/evo-1998-pr-build branch July 3, 2026 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant