Clone to a workspace folder on the host first
Some checks failed
Some checks failed
This commit is contained in:
parent
a0c5bca0ae
commit
58b862debe
2 changed files with 35 additions and 6 deletions
|
@ -66,16 +66,15 @@ jobs:
|
|||
|
||||
- name: Checkout code to workspace
|
||||
run: |
|
||||
# Create workspace directory
|
||||
mkdir -p /workspace
|
||||
# Use the pre-configured workspace directory (created in CI guide Step 7.3)
|
||||
|
||||
# Clone the repository to workspace
|
||||
git clone "${{ env.GITEA_SERVER_URL }}/${{ env.GITEA_REPOSITORY }}" /workspace
|
||||
cd /workspace
|
||||
git clone "${{ env.GITEA_SERVER_URL }}/${{ env.GITEA_REPOSITORY }}" /tmp/ci-workspace
|
||||
cd /tmp/ci-workspace
|
||||
git checkout "${{ env.GITEA_SHA }}"
|
||||
|
||||
# Copy workspace to DinD container
|
||||
docker cp /workspace/. ci-dind:/workspace/
|
||||
docker cp /tmp/ci-workspace/. ci-dind:/workspace/
|
||||
|
||||
# Start testing environment using dedicated compose file inside DinD
|
||||
docker exec ci-dind docker compose -f /workspace/docker-compose.test.yml up -d
|
||||
|
|
|
@ -1037,7 +1037,37 @@ docker exec ci-dind docker tag alpine:latest YOUR_CI_CD_IP/APP_NAME/test:latest
|
|||
docker exec ci-dind docker push YOUR_CI_CD_IP/APP_NAME/test:latest
|
||||
|
||||
# Clean up test image
|
||||
docker exec ci-dind docker rmi YOUR_CI_CD_IP/APP_NAME/test:latest
|
||||
docker exec ci-dind docker rmi YOUR_CI_CD_IP/APP_NAME/test:latest
|
||||
|
||||
#### 7.3 Set Up Workspace Directory
|
||||
|
||||
**Important**: The CI workflow needs a workspace directory for code checkout. This directory will be used by the Forgejo Actions runner.
|
||||
|
||||
```bash
|
||||
# Switch to CI_DEPLOY_USER (who has sudo privileges)
|
||||
sudo su - CI_DEPLOY_USER
|
||||
|
||||
# Create workspace directory in /tmp with proper permissions
|
||||
sudo mkdir -p /tmp/ci-workspace
|
||||
sudo chown CI_SERVICE_USER:CI_SERVICE_USER /tmp/ci-workspace
|
||||
sudo chmod 755 /tmp/ci-workspace
|
||||
|
||||
# Verify the setup
|
||||
ls -la /tmp/ci-workspace
|
||||
```
|
||||
|
||||
**What this does**:
|
||||
- **Creates workspace**: Provides a dedicated directory for CI operations
|
||||
- **Proper ownership**: CI_SERVICE_USER owns the directory for write access
|
||||
- **Appropriate permissions**: 755 allows read/write for owner, read for others
|
||||
- **Temporary location**: Uses /tmp for easy cleanup and no persistence needed
|
||||
|
||||
**Alternative locations** (if you prefer):
|
||||
- `/opt/ci-workspace` - More permanent location
|
||||
- `/home/CI_SERVICE_USER/workspace` - User's home directory
|
||||
- `/var/lib/ci-workspace` - System-managed location
|
||||
|
||||
**Note**: The CI workflow will use this directory for code checkout and then copy the contents to the DinD container.
|
||||
```
|
||||
|
||||
**What this does**:
|
||||
|
|
Loading…
Add table
Reference in a new issue