DevOps by Patrik

Downloading CI Scripts at Runtime

You can fetch scripts during the CI job using curl or wget. This allows you to avoid submodules or includes, especially when you just need to run a script without checking it into your repo.

Example:

variables:
  CI_SCRIPTS_BASE_URL: "https://gitlab.com/your-group/ci-templates/-/raw/main/CI"

before_script:
  - mkdir -p CI
  - curl -sSL -o CI/setup.ps1 "$CI_SCRIPTS_BASE_URL/setup.ps1"
  - curl -sSL -o CI/config.xml "$CI_SCRIPTS_BASE_URL/config.xml"

Advantages:

  • Simple and flexible
  • Works even if the shared files are in a private repo (with token)

When to use: If you want a lightweight setup without managing submodules.

Comments