martes, 7 de enero de 2025

Azure DevOps without docker permissions

 If you are trying to run azure devops and run a container. Maybe you can find this issue:

permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock

This is an error based on the user that is running the agent service. For this reason, you should check which user is running the service.

$ ps aux |grep agent

admin     2736  0.0  0.0   7340  2048 ?        Ss   Jan06   0:00 /bin/bash /home/admin/azagent/runsvc.sh

admin     2747  0.0  3.9 274117020 81476 ?     Sl   Jan06   0:16 /home/admin/azagent/bin/Agent.Listener run --startuptype service

admin     8840  0.0  0.0   6544  2048 pts/0    S+   17:03   0:00 grep --color=auto agent


Check the user of that pid

$ ps -u -p 2736
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND admin     2736  0.0  0.0   7340  2048 ?        Ss   Jan06   0:00 /bin/bash /home/admin/azagent/runsvc.sh


Add the group docker, just in case.

$ sudo groupadd docker
groupadd: group 'docker' already exists

 

Add the user to that group
$ sudo usermod -aG docker admin


$ reboot


Try again after the reboot.

lunes, 6 de enero de 2025

Can't use Predefined variables under environment tags in YAML azure devops pipelines

We should use the syntax ${{}} for compile time in the tag of the environment.

tags: ${{variables['Build.SourceVersion']}}

 

However, we cannot use $(Build.BuildId), $(Build.BuildURL), and $(Build.BuildNumber), because their values aren't set at the time expressions are evaluated.