Repository navigation
feature: deploy em staging a cada merge na master, com smoke, e2e e helm rollback automático (s4.2) - #20
Merged
Conversation
…automatic helm rollback (s4.2) Co-Authored-By: Matthew Guerra <matthew.guerra@cognition.ai>
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
…ed check can always roll back; report the deploy result Co-Authored-By: Matthew Guerra <matthew.guerra@cognition.ai>
…or never deployed Co-Authored-By: Matthew Guerra <matthew.guerra@cognition.ai>
…ds, so it does not race them after data-initializer Co-Authored-By: Matthew Guerra <matthew.guerra@cognition.ai>
Author
|
Answers to the two Devin Review flags not posted inline (head 7bd0f04):
Also fixed in 7bd0f04 (found while rerunning the proof): |
… unreachable cluster still reports rollback-failed Co-Authored-By: Matthew Guerra <matthew.guerra@cognition.ai>
…ed; otherwise state unknown Co-Authored-By: Matthew Guerra <matthew.guerra@cognition.ai>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contexto
Plano s4.2 (Replace cf push with a GKE delivery pipeline): cada merge em
masterpassa a implantar em staging. Depois que o jobpublishdeci.yml(s4.1) envia as imagens ao Artifact Registry, o novo jobdeploy-stagingchama o workflow reutilizável.github/workflows/deploy-staging.yml, que faz:GCP_WORKLOAD_IDENTITY_PROVIDER,GCP_CI_SERVICE_ACCOUNT,GCP_ARTIFACT_REGISTRY(as mesmas depublish) eGKE_CLUSTER(projects/<p>/locations/<gke_cluster_location>/clusters/<gke_cluster_name>) o job emite::notice::+ resumo e sai verde. Com o gate ligado, exige tambémSTAGING_CLOUDSQL_INSTANCE_CONNECTION_NAME,STAGING_CLOUDSQL_PSA_CIDReSTAGING_URL(falha com::error::se faltar). Hoje nenhuma está definida, então o merge não implanta nada.google-github-actions/auth+get-gke-credentials, SAci-deployercomroles/container.developer). Nenhuma chave JSON, nenhum segredo no repositório.engineURL/appURLdo e2e sãokubectl port-forwardpara os Services;uiURLéSTAGING_URL. A rota pública é checada à parte (/api/command/api)._passed_ :white_check_mark:/<!here> *FAILED* :x:) via secretSLACK_WEBHOOK_URL; sem o secret, apenas um notice.image.digestpor serviço; quando definido,axon-common.imagerenderiza<registry>/<repo>@sha256:...no lugar da tag.publishenvia$REGISTRY/<svc>, enquanto o chart usa por padrãoesarch/<svc>, então o deploy define<svc>.image.repository=<svc>.Recreate(decisão d-engine-replicas); a prova verifica isso.ci/deploy/helm-deploy.shé o mesmo script em GKE e em kind;ci/kind/verify-deploy-rollback.shé a prova offline (reaproveitaci/kind/setup.sh, de ondekind_backingfoi extraída).Ainda pendente: a execução real em staging (não existe projeto GCP; nada foi aplicado em GCP nem em TAS). A prova de rollback é local em kind, não uma execução do GitHub Actions. Em kind as imagens são referenciadas por tag (imagens locais não têm digest de registry); a renderização por digest foi verificada com
helm template(abaixo).Como testar
Saída:
bash ci/kind/verify-deploy-rollback.sh(kind v0.29.0, node v1.33.1, helm v3.16.4; 5m45s no commit inicial, repetida no head final com as correções da revisão: 5m57s,EXIT 0; trechos)1. Imagens boas: upgrade + rollout + smoke + e2e verdes (revisão 1)
2. Imagem quebrada de
trader-app(JVM com opção inválida, CrashLoopBackOff): rollout falha e rollback automático para a revisão 13. Imagem quebrada de
trader-ui(sem index.html): rollout passa, e2e falha (UI 404) e rollback automático para a revisão 34. Depois dos rollbacks: imagens boas, trading-engine com 1 réplica, smoke + e2e verdes
Digests no values de staging (
helm template ... -f values-staging.yaml+ overrides do workflow)deploy/helm/scripts/validate.sh,shellcheck,actionlintCorreções da revisão (Devin Review)
helm-deploy.shlê o histórico do release antes do upgrade; sórelease: not foundconta como primeira instalação. Qualquer outro erro aborta antes do upgrade (result=not-deployed), então um check que falhar sempre tem revisão para o rollback. Uma falha nohelm historyapós o rollout não interrompe mais o fluxo antes do smoke/rollback.result=em$GITHUB_OUTPUT(deployed,rolled-back-to-N,rollback-failed,no-rollback,not-deployed) e o alerta de falha no Slack diz o estado real (revertido para N, rollback falhou, nada a reverter, ou falhou antes do upgrade).result=é gravado antes de qualquerhelm history, e essas leituras não abortam mais o script; o Slack só diz "staging unchanged" quando o passo de deploy nem começou (skipped) ou parou antes do upgrade (not-deployed); umresultvazio com o deploy iniciado vira "staging state unknown".smoke.shespera as projeções que a coleção Postman lê (order book da primeira empresa, portfolio do primeiro usuário) depois dodata-initializer; uma repetição da prova falhou com 404 emGet OrderBooks for Companypor essa corrida.Devin-Org: engineering
Link to Devin session: https://devin-gtm.devinenterprise.com/sessions/9c3900f4aa0640c8b5ee49ba07a3705c
Open in Devin Desktop: https://devin-gtm.devinenterprise.com/desktop/session/9c3900f4aa0640c8b5ee49ba07a3705c?variant=devin
Requested by: @matthewguerra-cog
Devin Review