This guide provides the standard procedure for setting up a new GitLab project for a client. Following these steps ensures a consistent structure for managing deployment pipelines.
1. Create the GitLab Project
Each client gets their own dedicated repository to manage their specific CI/CD pipeline.
- Navigate to your GitLab group (e.g.,
enlivensupport-group). - Click New project and select Create blank project.
- Fill in the project details:
- Project name: Use the convention
client-name-deploy(e.g.,hamkerr-deploy). - Visibility Level: Set to Private.
- Project name: Use the convention
- Click Create project.
2. Clone the Repository Locally
Before you can set up the folder structure, you need a local copy of the repository. Make sure your SSH key is already added to your GitLab account.
-
Navigate to your local workspace directory.Bash
cd ~/Desktop/Enliven\\ Work -
Clone the new repository using its SSH URL.Bash
git clone git@gitlab.com:enlivensupport-group/hamkerr-deploy.git -
Change into the new project directory.Bash
cd hamkerr-deploy
3. Create the Standard Folder Structure
A consistent folder structure is essential for our automated pipelines.
-
Here is the target structure for each project:
hamkerr-deploy/├── .gitlab-ci.yml # Main pipeline definition file
├── config/│
└── pipeline_config.xlsx # Excel file with site/DB details
├── scripts/
├── backup_dev.sh # Backs up the development site
├── restore_to_uat.sh # Restores the backup to UAT
│── post_deploy_fixes.sql # Optional SQL for post-deployment fixes
└── README.md
-
Create these directories and placeholder script files with the following commands:Bash
Create the config and scripts directories
mkdir -p config scripts
Create empty script files to be edited later
touch .gitlab-ci.yml scripts/backup_dev.sh scripts/restore_to_uat.sh scripts/post_deploy_fixes.sql
(Optional) Move your downloaded config file into place
cp ~/Downloads/pipeline_config.xlsx config/`
4. Commit and Push the Structure
Finally, save this initial structure to the GitLab repository.
-
Add all the new files and directories to the staging area.Bash
git add . -
Commit the changes with a descriptive message.Bash
git commit -m "chore: initial project setup with folder structure" -
Push the commit to the
mainbranch on GitLab.Bashgit push origin main
Your new client project is now set up and ready for you to build the automation logic within the script files.