fix(ci): harden GitLab deploy pipeline - #106
Conversation
- only: [main] (was [main, feat/gitlab-cicd]) — test branch no longer triggers production deploy (BLOCKER 1) - DEPLOY_DIR variable (default /opt/ulticode) replaces hardcoded /home/yw/UltiCode; refuse to deploy if .env missing under DEPLOY_DIR (BLOCKER 2 + MEDIUM 8) - git fetch --prune --tags + git checkout -B replaces bare reset --hard so a dedicated deploy checkout is used, never a developer working tree (MEDIUM 12) - docker compose up -d --wait gates deploy success on healthcheck passage (MEDIUM 10) Fixes #100
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3e49907384
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| - deploy | ||
|
|
||
| variables: | ||
| DEPLOY_DIR: ${DEPLOY_DIR:-/opt/ulticode} |
There was a problem hiding this comment.
Default DEPLOY_DIR before exporting it to GitLab
GitLab CI variables are expanded by GitLab/Runner, not by the job shell; the GitLab docs say Runner expansion handles only $variable/${variable} via Go os.Expand(), so the Bash default operator in ${DEPLOY_DIR:-/opt/ulticode} is not evaluated here. In a main deploy without a project/group DEPLOY_DIR override, the script tests a literal or empty value instead of /opt/ulticode, causing the deploy job to fail before checkout despite the documented default; use a plain YAML value or apply the default inside script.
Useful? React with 👍 / 👎.
only: [main](was[main, feat/gitlab-cicd]) — test branch no longer triggers prod deployDEPLOY_DIRvariable (default/opt/ulticode) + refuse to deploy if.envmissinggit fetch --prune --tags+git checkout -Breplaces barereset --hardon a developer working treedocker compose up -d --waitgates deploy success on healthcheck passageCloses #100