Azure-pipelines-agent: Offline agent stays in the pool after it's --once run

Created on 18 Apr 2019  路  5Comments  路  Source: microsoft/azure-pipelines-agent

Agent Version and Platform

Version of your agent? 2.149.2

OS of the machine running the agent? Linux

Azure DevOps Type and Version

dev.azure.com (formerly visualstudio.com)

What's not working?

With the latest agent release I am looking into using the run once flag (--once) to tear down our agent containers after they have completed a job. This is working correctly in terms of running but after the container has been stopped the offline agent still remains in the pool. I expected that it would execute it's normal stop procedure which involves removing itself from the agent pool. Is this by design or is it perhaps a bug in the run once functionality?

Most helpful comment

cool, i am going to close this issue, please reopen if you need more help. :)

All 5 comments

@EwanNoble remove agent from pool (Unconfigure) requires admin privilege. the behavior you saw is by designed since --once don't have any credential from you. :)

Hi @TingluoHuang, thanks for the response. The admin credentials would be available to the service at this point as they are used for configuration, would there be scope for a feature to provide the 'run once' agent to access those credentials if available?

@EwanNoble we don't have feature for that yet, but i think you can do it yourself.

Dockerfile:
CMD "config.sh && run.sh --once && config.sh remove"

@TingluoHuang that makes a lot of sense and it worked perfectly! Thanks for your help. 馃槉

cool, i am going to close this issue, please reopen if you need more help. :)

Was this page helpful?
0 / 5 - 0 ratings