I set up a gitlab ssh runner in an Azure VM, here is my Config.toml file for the runner:
concurrent = 1
check_interval = 0
shutdown_timeout = 0
[session_server]
session_timeout = 1800
[[runners]]
name = "tfcicd"
url = ";
id = 45901682
token = "glrt-..."
token_obtained_at =
token_expires_at = 0001-01-01T00:00:00Z
executor = "ssh"
shell = "bash"
[runners.cache]
MaxUploadedArchiveSize = 0
[runners.cache.s3]
[runners.cache.gcs]
[runners.cache.azure]
[runners.ssh]
user = "ubuntu"
host = ""
port = "22"
identity_file = "/home/azureuser/.ssh/gitlab_rsa"
When I commit code to my gitlab repository, pipeline is successfully connect with runner, however, runner is failed to prepare environment to run my deployment script.
This is command I used to run the runner:
gitlab-runner --debug run
the command output blow logs:
Processing chain
chain-leaf=[0xc000c4d088 0xc000c4d608 0xc0010b5088} context=certificate-chain-build resolve-full-chain=false
Added job to processing list
builds=1 job=9086966281 max_builds=1 project=20783185 repo_url=<.gittime_in_queue_seconds=0
Failed to requeue the runner
builds=1 max_builds=1 runner=t3_gBmi3F
Running with gitlab-runner 17.8.3 (690ce25c)
job=9086966281 project=20783185 runner=t3_gBmi3F
on tfcicd t3_gBmi3F, system ID: s_413c2e0d9770
job=9086966281 project=20783185 runner=t3_gBmi3F
Preparing the "ssh" executor
job=9086966281 project=20783185 runner=t3_gBmi3F
Shell configuration: command: bash
arguments:
\-l
cmdline: bash -l
dockercommand: sh -c
"if [ -x /usr/local/bin/bash }; then\n\texec /usr/local/bin/bash -l\nelif [ -x /usr/bin/bash
}; then\n\texec /usr/bin/bash -l\nelif [ -x /bin/bash }; then\n\texec /bin/bash
\-l\nelif [ -x /usr/local/bin/sh }; then\n\texec /usr/local/bin/sh -l\nelif [ -x
/usr/bin/sh }; then\n\texec /usr/bin/sh -l\nelif [ -x /bin/sh }; then\n\texec /bin/sh
\-l\nelif [ -x /busybox/sh }; then\n\texec /busybox/sh -l\nelse\n\techo shell not
found\n\texit 1\nfi\n\n"
passfile: false
extension: ""
job=9086966281 project=20783185 runner=t3_gBmi3F
Using SSH executor... job=9086966281 project=20783185 runner=t3_gBmi3F
Starting SSH command... job=9086966281 project=20783185 runner=t3_gBmi3F
Connecting to SSH server... job=9086966281 project=20783185 runner=t3_gBmi3F
Waiting for signals...
job=9086966281 project=20783185 runner=t3_gBmi3F
No referees configured job=9086966281 project=20783185 runner=t3_gBmi3F
Executing build stage build_stage=prepare_script job=9086966281 project=20783185 runner=t3_gBmi3F
Preparing environment
job=9086966281 project=20783185 runner=t3_gBmi3F
WARNING: Job failed: prepare environment: Process exited with status
1\. Check <.html#shell-profile-loadingfor more information
duration_s=0.455632007 job=9086966281 project=20783185 runner=t3_gBmi3F
Appending trace to coordinator...ok
code=202 job=9086966281 job-log=0-645 job-status=running runner=t3_gBmi3F sent-log=0-644 status=202 Accepted update-interval=1m0s
Updating job...
bytesize=645 checksum=crc32:ed2bc38a job=9086966281 runner=t3_gBmi3F
Submitting job to coordinator...accepted, but not yet completed
bytesize=645 checksum=crc32:ed2bc38a code=202 job=9086966281 job-status=running runner=t3_gBmi3F update-interval=1s
Updating job...
bytesize=645 checksum=crc32:ed2bc38a job=9086966281 runner=t3_gBmi3F
Feeding runners to channel
builds=1 max_builds=1
Feeding runner to channel
builds=1 max_builds=1 runner=t3_gBmi3F
WARNING: Submitting job to coordinator... job failed
bytesize=645 checksum=crc32:ed2bc38a code=200 job=9086966281 job-status=failed runner=t3_gBmi3F status=200 OK update-interval=0s
Removed job from processing list
builds=0 job=9086966281 max_builds=1 project=20783185 repo_url=ht
What have I done to debug:
I used the ssh command to connect to remote machine and run bash -l in the remote machine, all works.
I saw from document that this file could be root cuase: /home/gitlab-runner/.bash_logout, but for me I do not have this file in my VM.