How to manage CD for a shell script repo


I start using Gitlab for my sysadmin repo with “only” shell scripts.
As i’m currently the only real user… i have a local gitlab-ce + gitlab-runner shell locally.
I use shellcheck to validate my script contents in a simple .gitlab-ci.yml

Now, i would to add CD to send my scripts on a staging env to make tests and avoid to :

  • send files to the server in a “testing” subfolder + chown/chmod (1)
  • or create locally on my computer the test data/folders to execute the scripts.

(1) + problems that i need to modify each time my scripts to change parameters like filder to analyse, or output log folder/file to not impact the prod.

does anyone has some ideas or tutorials on how to manage this please ?

  • deploy to a staging env
    (- deploy to prod maybe)
  • adapt scripts if i send them on staging env if possible ?

I can send some examples or discussion (IRC, or many other chat tools if available)


Ex : i have a script that create a data usage report.
Script = /soft/bin/
Output = /soft/log/analyze_$date.log

currently the outpu path is hardcoded in the script (with $date generated at run). but it’s easy to put it in a analyze.cfg if easier.

Now i want to have a test env to try it, without impact production data.
–> /soft/test/bin/ and /soft/test/log/analyze_$date.log for example.

=> i need to :

  • send the files in the xxx/test/xxx folders automatically (+ chmod/chown i think)
  • make the script use the right path for output if staging or prod