I am trying to provision and configure some Azure infrastructure using terraform which will be orchestrated via a GitLab CI/CD pipeline running off a GitLab Runner hosted on an Azure Linux VM. The Azure Linux VM which has been manually provisioned, has a named Admin called azureuser
.
I'd like to install and configure the GitLab Runner (including its dependencies) using a dedicated GitLab CI/CD pipeline and as a result, run all the required Linux commands interactively on the aforementioned Azure Linux VM. How can I achieve this?
I've been following the steps outlined in this GitLab documentation https://docs.gitlab.com/ee/ci/ssh_keys/ and as part of an initial dry-run, I manually installed the GitLab Runner on my Azure Linux VM using the Root account.
On the other hand, I did create the required Private and Public Keys in the home directory of the azureuser
account as depicted in the screenshot below. I manually run all the checks to confirm that the GitLab Runner and Docker Executor were both up and running, as well as other dependencies.
Then from my .gitlab-ci.yml
file, I tried to execute some very basic Linux commands - sudo yum -y update
and sudo gitlab-runner status
- but then received the following error message:
/bin/sh: eval: line 146: sudo: not found
What could I be doing wrong when trying to run those commands interactively on my Azure Linux VM GitLab Runner?
Was it okay for me to install the Runner and also generate the SSH keys with two different accounts as described above?