How to handle deployment for 100 websites in single job?

I have requirement to maintain single codebase and to deploy on 100 different websites. So I have 2 repos, 1 for codebase and 2nd for the deployment logic and site metadata like path to deploy and its name maintain in 100 different txt files.

Currently I can deploy at once on all 100 website which is perfectly fine, but issue comes when there new addition of website e.g 101th site, I don’t want to run deployment cycle for all 100 website, I just want to deploy code on 101th new site.

So what is the best option to handle this kind of scenarios.

Thanks in advance.

I’d love to know more about what is this requirement of a single codebase to deploy to 100 different websites?

Are they all the same website? Ideally, you should really have a separate code base for each website and if they have some common template/css/javascript files, have another project that contains that which can be pulled into the others.

If you absolutely must have a single codebase, I recommend looking at the gitlab-ci rules:changes. If your project is well organized where there is a directory per website, you can limit your CI to only run when you see changes to that specific directory automatically, and default to a manual deployment else-wise. The major downside to this is that you will have 100 jobs in a single stage (which will be quite messy) and will probably require a refactor of your deployment script to handle taking in a single website name to update.

Say you have a project structure of

|- website1/
|    |- main.php
|- website2/
|    |- main.php

You’re could look like

    stage: deploy
       - changes:
          - $CI_JOB_NAME
          when: always
       - when: manual
         - Your deployment script using $CI_JOB_NAME

# This job's name must match the directory name in your project
    extends: .deploy_template
    extends: .deploy_template

You could also look into dynamic child pipelines