Skip to content

fix(ci): harden GitLab deploy pipeline - #106

Open
DavidHLP wants to merge 1 commit into
mainfrom
fix/gitlab-ci-deploy-safety
Open

fix(ci): harden GitLab deploy pipeline#106
DavidHLP wants to merge 1 commit into
mainfrom
fix/gitlab-ci-deploy-safety

Conversation

@DavidHLP

@DavidHLP DavidHLP commented Jul 5, 2026

Copy link
Copy Markdown
Owner
  • only: [main] (was [main, feat/gitlab-cicd]) — test branch no longer triggers prod deploy
  • DEPLOY_DIR variable (default /opt/ulticode) + refuse to deploy if .env missing
  • git fetch --prune --tags + git checkout -B replaces bare reset --hard on a developer working tree
  • docker compose up -d --wait gates deploy success on healthcheck passage

Closes #100

- 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

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 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".

Comment thread .gitlab-ci.yml
- deploy

variables:
DEPLOY_DIR: ${DEPLOY_DIR:-/opt/ulticode}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

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.

fix: .gitlab-ci.yml 部署安全(only 收敛 + 专用 DEPLOY_DIR + up -d --wait)

1 participant