i am new to Azure and having basic question.
How do we know self hosted agent is windows machine or mac or Linux? while configuring this, we are not choosing what should be the OS of my agent. In Microsoft hosted agent where we have dropdown list to see and choose. But in self hosted agent configuration, we will choose only from which machine (windows/MaC/Linux) we are going to configure agent but not what agent OS is.
Please help
To check the operating system of a self-hosted agent in Azure DevOps, you can follow these steps:
Log in to the Azure DevOps organization where the agent is registered.
Navigate to the "Agents" section under "Pipelines."
Find the self-hosted agent you want to check the operating system of and
click on it.
On the agent's details page, you will see the "Operating System" section, which displays the name and version of the operating system.
You can print out the Agent OS within your job
steps:
- script: |
echo Agent OS is: $AGENT_OS
displayName: Agent OS
env:
AGENT_OS: $(agent.os)
Related
is it possible to change the agent.name? without to delete the agent and reinstall?
linux system
picture
I try to vim the config.sh and I didn't find that variable
I am afraid that there is no such method can directly change the agent name without re-installing the self-hosted agent.
The agent name is a primary key in the backend. We need to re-install the self-hosted agent, then you can change the self-hosted agent name.
Refer to the doc about the steps to re-install the self-hosted agent.
I can fully understand your requirement. You can create a suggestion ticket in Developer Community to report your requirement.
In Azure DevOps we have a Pipeline and Release created and working. In the release, we have the Azure Self-hosted Windows agent running and publishing to the off-site server without any issues.
Once the agent has completed deployment of the website, we would like to run a script on the Self-hosted server. (example POST HOOK COMMAND > C:\srvscripts\azure-post-hook.ps1)
Where can configure the agent to run a script once the website is published?
Where can configure the agent to run a script once the website is published?
If you want to run a script once the website is published on the on the Self-hosted server, you could add a powershell task after the task your deployment the website:
Since you are running the script on the Self-hosted server, we could directly specify the path C:\srvscripts\azure-post-hook.ps1 where the script is located in the scripts path option:
Is it possible to clone or copy an Azure Pipeline Hosted Agent for use as a Self-Hosted Agent?
I'd like to reuse one of the Hosted Agents simply to enable me recreate and reuse all of its
capabilities, saving me the headache. Is this possible and if so I'd really appreciate some help.
Thanks
This is not possible, but you can try to reuse what is already available here https://github.com/actions/virtual-environments
This repository contains the source used to create the virtual environments for GitHub Actions hosted runners, as well as the VM images of Microsoft-hosted agents used for Azure Pipelines. To file bug reports, or request that tools be added/updated, please open an issue using the appropriate template. To build a VM machine from this repo's source, see the instructions.
So you can use the same scripts which are used to create Microsoft Hosted agents.
There is no such build-in feature.
Azure DevOps provides free hosted agents that have a predefined set
of tools installed and configured for building and releasing your
apps.
There is another option where you set up and manage your own agents.
This can be done by simply downloading the agent package, and run it
either on your local machine or any other computing platform even on
Docker container. It also gives you more freedom to install specific
dependencies for your build and release.
If you want to build your own agent during the pipeline. I would suggest you use Docker container to handle the process.
Microsoft has already created pre-configured container images on Docker Hub for everybody to use. But they’re Linux based and don’t contain any additional applications and/or packages so you’d probably still need to add those every time you run your build.
This repository contains images for the Visual Studio Team Services
(VSTS) agent that runs tasks as part of a build or release.
VSTS agent images are tagged according to the base OS, an optional
Team Foundation Server (TFS) version, and tools that are installed.
When used with VSTS, the agent version is automatically determined and
downloaded at container startup based on the account to which the
agent is connecting.
More detail step, you could refer this article: Build your own Azure DevOps agents with pipelines
Currently, we use Azure DevOps for build and release pipelines but host repos on GitHub. We would like to make use of GitHub actions to replace this and bring everything into one location.
We use a self hosted Azure DevOps release pipeline which allows us to download and configure our app on our own server.
However the article here implies that GitHub Actions self hosted runners utilise a sandbox.
Could they be used without a sandbox to copy our program to a path on our server and then run the program?
There is nothing in that article that implies anything about self-hosted runners being sandboxed from an internal network perspective.
Self-hosted runners offer more control of hardware, operating system,
and software tools than GitHub-hosted runners provide. With
self-hosted runners, you can choose to create a custom hardware
configuration with more processing power or memory to run larger jobs,
install software available on your local network, and choose an
operating system not offered by GitHub-hosted runners. Self-hosted
runners can be physical, virtual, container, on-premises, or in a
cloud.
GitHub Actions runs under the nt authority\network service account.
According to https://learn.microsoft.com/en-us/windows/win32/services/networkservice-account:
It has minimum privileges on the local computer and acts as the computer on the network.
Therefore the "machine's runner sandbox" referred to in the article is likely referencing this account's inability to perform any privileged tasks.
It doesn't look like this is possible but is there a way to use VSTS Continuous Delivery and deploy to a server outside Azure?
Sure. VSTS Continuous Delivery can deploy to anything that can run the VSTS agent or anything that can be targetted from a VSTS agent. Basically you have two options:
Let the VSTS (hosted) agent communicate directly to your deployment target. Out of the box tasks can use MsDeploy or WinRM. There are also tasks for Octopus Deploy, AWS and other systems available through the Marketplace. Powershell has options to connect directly to other systems and you can use many different protocols from a powershell script.
Install the VSTS agent on your target machine (or network). The VSTS agent can be downloaded and installed onto the target server. That way you have full local access to the target machine and can simply copy the files to the target folder straight from the Release Management artefacts. By installing a VSTS agent in you local network, you can use the options listed under 1 to bypass firewalls that might be blocking the hosted agent.