fix(ci): use workflow sha and shorten frontend install
Some checks failed
Tests / TSDoc Lint Check (pull_request) Has been skipped
Tests / No Docstring Types Check (pull_request) Has been skipped
Tests / ESLint Check (pull_request) Has been skipped
Tests / Prettier Format Check (pull_request) Has been skipped
Tests / Backend Tests (pull_request) Has been skipped
Tests / TypeScript Type Check (pull_request) Has been skipped
Tests / End-to-End Tests (pull_request) Has been skipped
Tests / Frontend Tests (pull_request) Has been skipped
Tests / Backend Doctests (pull_request) Has been skipped
Tests / Integration Tests (pull_request) Has been skipped
Tests / Registry Push Preflight (pull_request) Failing after 7s
Tests / Build and Push CICD Base Image (pull_request) Has been skipped
Tests / Build and Push CICD Complete Image (pull_request) Has been skipped
Tests / Trailing Whitespace Check (pull_request) Has been skipped
Tests / End of File Check (pull_request) Has been skipped
Tests / YAML Syntax Check (pull_request) Has been skipped
Tests / TOML Syntax Check (pull_request) Has been skipped
Tests / Mixed Line Ending Check (pull_request) Has been skipped
Tests / TOML Formatting Check (pull_request) Has been skipped
Tests / Ruff Linting (pull_request) Has been skipped
Tests / Ruff Format Check (pull_request) Has been skipped
Tests / Pyright Type Check (pull_request) Has been skipped
Tests / Darglint Docstring Check (pull_request) Has been skipped
Some checks failed
Tests / TSDoc Lint Check (pull_request) Has been skipped
Tests / No Docstring Types Check (pull_request) Has been skipped
Tests / ESLint Check (pull_request) Has been skipped
Tests / Prettier Format Check (pull_request) Has been skipped
Tests / Backend Tests (pull_request) Has been skipped
Tests / TypeScript Type Check (pull_request) Has been skipped
Tests / End-to-End Tests (pull_request) Has been skipped
Tests / Frontend Tests (pull_request) Has been skipped
Tests / Backend Doctests (pull_request) Has been skipped
Tests / Integration Tests (pull_request) Has been skipped
Tests / Registry Push Preflight (pull_request) Failing after 7s
Tests / Build and Push CICD Base Image (pull_request) Has been skipped
Tests / Build and Push CICD Complete Image (pull_request) Has been skipped
Tests / Trailing Whitespace Check (pull_request) Has been skipped
Tests / End of File Check (pull_request) Has been skipped
Tests / YAML Syntax Check (pull_request) Has been skipped
Tests / TOML Syntax Check (pull_request) Has been skipped
Tests / Mixed Line Ending Check (pull_request) Has been skipped
Tests / TOML Formatting Check (pull_request) Has been skipped
Tests / Ruff Linting (pull_request) Has been skipped
Tests / Ruff Format Check (pull_request) Has been skipped
Tests / Pyright Type Check (pull_request) Has been skipped
Tests / Darglint Docstring Check (pull_request) Has been skipped
This commit is contained in:
@@ -70,6 +70,7 @@ jobs:
|
||||
- name: Minimal checkout for base Dockerfile
|
||||
env:
|
||||
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
GITHUB_SHA: ${{ github.sha }}
|
||||
run: |
|
||||
umask 077
|
||||
trap 'rm -f ~/.ssh/id_rsa' EXIT
|
||||
@@ -96,8 +97,16 @@ jobs:
|
||||
git clone --depth 1 --no-checkout \
|
||||
"${GITEA_REPO_SSH_URL}" .
|
||||
|
||||
# Checkout only the base Dockerfile and dockerignore
|
||||
git checkout HEAD -- Dockerfile.cicd-base .dockerignore
|
||||
# Checkout from the exact workflow commit SHA when available.
|
||||
if [ -n "${GITHUB_SHA}" ] && \
|
||||
GIT_SSH_COMMAND="ssh -i ~/.ssh/id_rsa -o IdentitiesOnly=yes -o StrictHostKeyChecking=no" \
|
||||
git fetch --depth 1 origin "${GITHUB_SHA}" >/dev/null 2>&1; then
|
||||
git checkout FETCH_HEAD -- Dockerfile.cicd-base .dockerignore
|
||||
echo "✓ Checked out Dockerfile.cicd-base from commit ${GITHUB_SHA}"
|
||||
else
|
||||
git checkout HEAD -- Dockerfile.cicd-base .dockerignore
|
||||
echo "⚠ Falling back to default branch HEAD for Dockerfile checkout"
|
||||
fi
|
||||
|
||||
# Clean up SSH key for security
|
||||
rm -f ~/.ssh/id_rsa
|
||||
@@ -256,6 +265,7 @@ jobs:
|
||||
- name: Minimal checkout for Dockerfile
|
||||
env:
|
||||
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
GITHUB_SHA: ${{ github.sha }}
|
||||
run: |
|
||||
umask 077
|
||||
trap 'rm -f ~/.ssh/id_rsa' EXIT
|
||||
@@ -282,8 +292,16 @@ jobs:
|
||||
git clone --depth 1 --no-checkout \
|
||||
"${GITEA_REPO_SSH_URL}" .
|
||||
|
||||
# Checkout Dockerfiles and dockerignore (include base for fallback)
|
||||
git checkout HEAD -- Dockerfile.cicd Dockerfile.cicd-base .dockerignore
|
||||
# Checkout from the exact workflow commit SHA when available.
|
||||
if [ -n "${GITHUB_SHA}" ] && \
|
||||
GIT_SSH_COMMAND="ssh -i ~/.ssh/id_rsa -o IdentitiesOnly=yes -o StrictHostKeyChecking=no" \
|
||||
git fetch --depth 1 origin "${GITHUB_SHA}" >/dev/null 2>&1; then
|
||||
git checkout FETCH_HEAD -- Dockerfile.cicd Dockerfile.cicd-base .dockerignore
|
||||
echo "✓ Checked out Dockerfiles from commit ${GITHUB_SHA}"
|
||||
else
|
||||
git checkout HEAD -- Dockerfile.cicd Dockerfile.cicd-base .dockerignore
|
||||
echo "⚠ Falling back to default branch HEAD for Dockerfile checkout"
|
||||
fi
|
||||
|
||||
# Clean up SSH key for security
|
||||
rm -f ~/.ssh/id_rsa
|
||||
|
||||
@@ -89,11 +89,7 @@ WORKDIR /workspace/frontend
|
||||
RUN echo "=== Installing Frontend Dependencies (Phase 2: Optimized Caching) ===" && \
|
||||
echo "Available global tools (installed via npm):" && \
|
||||
npm list -g --depth=0 2>/dev/null | head -10 || echo "Global npm tools available" && \
|
||||
which tsc && which eslint && which prettier || echo "Global tools verified" && \
|
||||
# Create temporary swap file for memory-intensive yarn install
|
||||
dd if=/dev/zero of=/tmp/swapfile bs=1M count=1024 2>/dev/null && \
|
||||
mkswap /tmp/swapfile && \
|
||||
swapon /tmp/swapfile || echo "Swap setup failed, continuing without swap"
|
||||
which tsc && which eslint && which prettier || echo "Global tools verified"
|
||||
|
||||
# Install frontend dependencies from extracted package.json (this layer will cache!)
|
||||
RUN if [ -f "package.json" ]; then \
|
||||
@@ -103,21 +99,16 @@ RUN if [ -f "package.json" ]; then \
|
||||
echo "Memory info before install:" && \
|
||||
free -h || true && \
|
||||
INSTALL_SUCCESS=false && \
|
||||
for i in 1 2 3; do \
|
||||
echo "Attempt $i: Installing project-specific frontend dependencies..." && \
|
||||
echo "(Common dev tools pre-installed globally for performance)" && \
|
||||
timeout 2400 yarn install --immutable --mode=skip-build \
|
||||
&& { INSTALL_SUCCESS=true; break; } || \
|
||||
(echo "Attempt $i failed, cleaning up and retrying..." && \
|
||||
rm -rf node_modules .yarn/cache .yarn/install-state.gz && \
|
||||
yarn cache clean --all 2>/dev/null || true && \
|
||||
sleep 60); \
|
||||
done && \
|
||||
echo "Attempt 1/1: Installing project-specific frontend dependencies..." && \
|
||||
echo "(Common dev tools pre-installed globally for performance)" && \
|
||||
timeout 1200 yarn install --immutable --mode=skip-build \
|
||||
&& INSTALL_SUCCESS=true || \
|
||||
(echo "Attempt failed, cleaning up..." && \
|
||||
rm -rf node_modules .yarn/cache .yarn/install-state.gz && \
|
||||
yarn cache clean --all 2>/dev/null || true) && \
|
||||
rm -rf .yarn/cache && \
|
||||
swapoff /tmp/swapfile 2>/dev/null || true && \
|
||||
rm -f /tmp/swapfile && \
|
||||
if [ "$INSTALL_SUCCESS" = "false" ]; then \
|
||||
echo "WARNING: Frontend dependencies installation failed after 3 attempts"; \
|
||||
echo "WARNING: Frontend dependencies installation failed"; \
|
||||
echo "Continuing without frontend dependencies for CI/CD environment"; \
|
||||
touch .frontend-deps-failed; \
|
||||
else \
|
||||
|
||||
Reference in New Issue
Block a user