???? GitLab Repo Setup Guide for Client Pipelines Print

  • 0

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.

  1. Navigate to your GitLab group (e.g., enlivensupport-group).
  2. Click New project and select Create blank project.
  3. Fill in the project details:
    • Project name: Use the convention client-name-deploy (e.g., hamkerr-deploy).
    • Visibility Level: Set to Private.
  4. 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.

  1. Navigate to your local workspace directory.Bash

    cd ~/Desktop/Enliven\\ Work

  2. Clone the new repository using its SSH URL.Bash

    git clone git@gitlab.com:enlivensupport-group/hamkerr-deploy.git

  3. 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.

  1. 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

  1. 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.

  1. Add all the new files and directories to the staging area.Bash

    git add .

  2. Commit the changes with a descriptive message.Bash

    git commit -m "chore: initial project setup with folder structure"

  3. Push the commit to the main branch on GitLab.Bash

    git push origin main

Your new client project is now set up and ready for you to build the automation logic within the script files.


Was this answer helpful?

« Back