I have a problem I can't get my head around in gitlab-ci: I have a monorepo where I store some infra code (IaC), in this repo I have a script which allow me to lint the saltstack states code, as :
#!/bin/bash
# Std var
_hostname=$(hostname -f)
for file in $( find . -iname "*.sls" ! \( -path '*/files/orchestration_states/*' -or -path '*/files/reactor_states/*' -or -name "top.sls" \) ); do
state_path_name=$( echo ${file%.*}| tr -d "."| tr "/" ".")
if ! sudo salt-call --file-root=. --pillar-root=/home/gitlab-runner/salt_pillars/testBed/ --local --retcode-passthrough state.show_sls ${state_path_name} pillar='{"tgt_client_name": "dummy-dummy.domain}' ; then
echo -e "> Error found while validating state file: please fix it!\
\n
\nDetails:\
\n - File(s) name(s): ${state_path_name}\
\n - Pipeline ID: ${CI_JOB_ID}\
\n
\n - Job link: ${CI_JOB_URL}"\
|mail -s "${CI_PROJECT_NAME} | Pipeline #${CI_JOB_ID} has failed" -aFrom:${_hostname}@spie.com "mail@domain.com"
exit 1
fi
done
In this script I need to update the --pillar-root=/home/gitlab-runner/salt_pillars/testBed/
to replace the testBed
string by something lese, let's say toto
.
But when I update the string inside the repo the runner keeps using the old version of this script (which failed because the path is not correct).
I can see the correct version of the script inside the repo, but the runner does not update this script when fetching the branch to lint the states.
Any ideas about why the runner does not update the script ?
Thanks