Windows shell runner + local application

Hi all

I’ve got project on I need to perform some local actions on my computer using specific application after commit. So i’ve installed windows shell runner, registered and it works as should be. I’ve started with .gitlab-ci.yml file, which is very simple:

    - build

        TEST_DIR: ${CI_PROJECT_DIR}\project.xx
    stage: build
        - my_local_runner
        - echo "Hello world"
        - echo $TEST_DIR
        - echo $CI_PROJECT_DIR
        - my_tool -p '$TEST_DIR'
        - my_tool -p $TEST_DIR
        - my_tool -p %TEST_DIR%
        - my_tool -p ${TEST_DIR}

When i test it locally using such command:
gitlab-runner-windows-amd64.exe exec shell start
everything is working fine, but when i tried to use it online, got error:

Executing "step_script" stage of the job script
$ echo "Hello world"
Hello world
$ echo $TEST_DIR
$ my_tool -p '$TEST_DIR'
Cleaning up file based variables  
ERROR: Job failed: exit status 1

Is there possibility to run my_tool as described in yml file (my_tool -p some_path) online? Maybe there is an error in syntax and such command should be written different way?

Hi @robal
It seems the exist status comes from my_tool. I would run it in debug mode or add some more troubleshooting outputs to figure out why it fails.

Actually my_tool has implemented logging functionality (both for console and file), but no output is produced on both channels. So i wonder if there should be met some particular conditions to get it running.

I don’t know what your tests are, but the command you run first my_tool -p '$TEST_DIR' does not do any variable expansion since you have it in single quotes. Is your tool properly handling if you send ‘$TEST_DIR’ as string to it?

How it looks like using echo alias in Powershell

PS C:\Users\user> $SINGLE="some-string"
PS C:\Users\user> $env:SINGLE=$SINGLE
PS C:\Users\user> echo '$SINGLE'
PS C:\Users\user> echo $SINGLE
PS C:\Users\user> echo %SINGLE%
PS C:\Users\user> echo ${SINGLE}

Seems that this is not problem with application itself. I’m trying to run UI application, which causes crash of runner instance (cannot be closed or stopped). Got set of Windows logs, maybe this could help to find root cause (tested on other computer and it works):

203000x800000000000004255ApplicationXXX-XXXe[0;33mWARNING: Submitting job to coordinator… job failede[0;m e[0;33mcodee[0;m=403 e[0;33mjobe[0;m=1175295122 e[0;33mjob-statuse[0;m=canceled e[0;33mrunnere[0;m=zbYawcoy e[0;33mupdate-intervale[0;m=0s

203000x800000000000004256ApplicationXXX-XXXe[0;33mWARNING: Failed to terminate process: exit status 128e[0;m e[0;33mPIDe[0;m=14564 e[0;33mjobe[0;m=1175295122 e[0;33mprojecte[0;m=25680601 e[0;33mrunnere[0;m=zbYawcoy

203000x800000000000004257ApplicationXXX-XXXe[0;33mWARNING: Failed to force-kill: exit status 128 e[0;m e[0;33mPIDe[0;m=14564 e[0;33mjobe[0;m=1175295122 e[0;33mprojecte[0;m=25680601 e[0;33mrunnere[0;m=zbYawcoy

Got yet another observation - when using online and runner operates as windows service it doesn’t work (doesn’t starts any of my local tool). But when i run runner from command like, e.g (to have full debug):

gitlab-runner-windows-amd64.exe --debug --log-level info --log-format json run

everything is fine and works perfectly well.