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 :


# 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 - File(s) name(s): ${state_path_name}\
        \n - Pipeline ID: ${CI_JOB_ID}\
        \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

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 ?



OK, as usual the error was between the keyboard and the screen... I did use the "try again" button on the jobs list, which, of course was making use of the same commit, and therefore the changed made to the script were not taken into account ...

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.