3d39fca
.
--------------------------------------------------------------------------------
/docs/res/apple_med.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/azure-pipelines-agent/5453c1a1915722b10e6017bbb9f041d620591b25/docs/res/apple_med.png
--------------------------------------------------------------------------------
/docs/res/apple_sm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/azure-pipelines-agent/5453c1a1915722b10e6017bbb9f041d620591b25/docs/res/apple_sm.png
--------------------------------------------------------------------------------
/docs/res/linux_med.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/azure-pipelines-agent/5453c1a1915722b10e6017bbb9f041d620591b25/docs/res/linux_med.png
--------------------------------------------------------------------------------
/docs/res/linux_sm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/azure-pipelines-agent/5453c1a1915722b10e6017bbb9f041d620591b25/docs/res/linux_sm.png
--------------------------------------------------------------------------------
/docs/res/redhat_med.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/azure-pipelines-agent/5453c1a1915722b10e6017bbb9f041d620591b25/docs/res/redhat_med.png
--------------------------------------------------------------------------------
/docs/res/redhat_sm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/azure-pipelines-agent/5453c1a1915722b10e6017bbb9f041d620591b25/docs/res/redhat_sm.png
--------------------------------------------------------------------------------
/docs/res/ubuntu_med.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/azure-pipelines-agent/5453c1a1915722b10e6017bbb9f041d620591b25/docs/res/ubuntu_med.png
--------------------------------------------------------------------------------
/docs/res/ubuntu_sm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/azure-pipelines-agent/5453c1a1915722b10e6017bbb9f041d620591b25/docs/res/ubuntu_sm.png
--------------------------------------------------------------------------------
/docs/res/win_med.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/azure-pipelines-agent/5453c1a1915722b10e6017bbb9f041d620591b25/docs/res/win_med.png
--------------------------------------------------------------------------------
/docs/res/win_sm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/azure-pipelines-agent/5453c1a1915722b10e6017bbb9f041d620591b25/docs/res/win_sm.png
--------------------------------------------------------------------------------
/docs/start/envlinux.md:
--------------------------------------------------------------------------------
1 | # System requirements: Linux
2 |
3 | [This page has moved.](https://docs.microsoft.com/azure/devops/pipelines/agents/v2-linux#check-prerequisites)
4 |
--------------------------------------------------------------------------------
/docs/start/envosx.md:
--------------------------------------------------------------------------------
1 | # System requirements: macOS
2 |
3 | [This page has moved.](https://docs.microsoft.com/azure/devops/pipelines/agents/v2-osx#check-prerequisites)
4 |
--------------------------------------------------------------------------------
/docs/start/envredhat.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | #  Red Hat/CentOS System Prerequisites [2.124.0 or below]
4 |
5 | ## Versions
6 |
7 | Tested on Red Hat 7.2. Not domain joined.
8 |
9 | 64-bit supported.
10 |
11 | ## Dependency Packages
12 |
13 | ```bash
14 | sudo yum -y install libunwind.x86_64 icu
15 | ```
16 | If you're still having issues:
17 | [Full List Needed](https://github.com/dotnet/core/blob/master/Documentation/prereqs.md)
18 |
19 | ## Git
20 |
21 | If you use git, git >= 2.9.0 is a pre-requisite for Red Hat/CentOS agents.
22 |
23 | [Based on Install Latest Git on Red Hat/CentOS](http://tecadmin.net/install-git-2-x-on-centos-rhel-and-fedora/#)
24 |
25 | ```bash
26 | $ yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
27 | $ yum install gcc perl-ExtUtils-MakeMaker
28 |
29 | $ cd /usr/src
30 | $ wget https://www.kernel.org/pub/software/scm/git/git-2.9.2.tar.gz
31 | $ tar xzf git-2.9.2.tar.gz
32 |
33 | $ cd git-2.9.2
34 | $ make prefix=/usr/local/git all
35 | $ make prefix=/usr/local/git install
36 | ```
37 |
38 | In /etc/bashrc
39 | ```bash
40 | export PATH=$PATH:/usr/local/git/bin
41 | ```
42 |
43 | ## Optionally Java if TfsVc
44 |
45 | The agent distributes [Team Explorer Everywhere (TEE)](https://www.visualstudio.com/products/team-explorer-everywhere-vs.aspx).
46 |
47 | But, if you are using TfsVc, install Oracle Java 1.8+ as TEE uses Java.
48 |
49 | ## RHEL Universal Base Images (UBI) packages
50 |
51 | ```bash
52 | yum install -y git unzip libicu
53 | ```
54 |
55 | UBI 8 will require `glibc-langpack-en` to be installed:
56 | ```bash
57 | yum -y install glibc-langpack-en
58 | ```
59 |
--------------------------------------------------------------------------------
/docs/start/envubuntu.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | #  Ubuntu System Prerequisites [2.124.0 or below]
4 |
5 | ## Versions
6 |
7 | Tested on 18.04 LTS (Bionic), 16.04 LTS (Xenial) and 14.04 LTS (Trusty). Not domain joined.
8 |
9 | 18.04 is recommended since it's the latest and supports SystemD for running as a service.
10 |
11 | ## Dependency Packages
12 |
13 | ### Ubuntu 18.04 (x64, ARM32), 16.04 (x64 only)
14 | ```bash
15 | sudo apt-get install -y libunwind8 libcurl3
16 | ```
17 |
18 | ### Ubuntu 14.04 (x64 only)
19 | ```bash
20 | sudo apt-get install -y libunwind8 libcurl3 libicu52
21 | ```
22 |
23 | If you're still having issues:
24 | [Full List Needed](https://github.com/dotnet/core/blob/master/Documentation/prereqs.md)
25 |
26 | ## Git
27 |
28 | If you use git, git >= 2.9.0 is a pre-requisite for Ubuntu agents.
29 |
30 | [Install Latest Git on Ubuntu](http://askubuntu.com/questions/568591/how-do-i-install-the-latest-version-of-git-with-apt/568596)
31 |
32 | ```bash
33 | $ sudo apt-add-repository ppa:git-core/ppa
34 | $ sudo apt-get update
35 | $ sudo apt-get install git
36 | ```
37 |
38 | ## Optionally Java if using TFVC
39 |
40 | The agent distributes Team Explorer Everywhere.
41 |
42 | But, if you are using TFVC, install Oracle Java 1.8+ as TEE uses Java.
43 |
44 | ## Etc
45 |
46 | There was an assertion that on Ubuntu 16 this was needed. We didn't need. Adding in case it helps someone. We will verify on clean build and dev boxes.
47 |
48 | ```bash
49 | apt-get install libcurl4-openssl-dev
50 | ```
51 |
52 |
--------------------------------------------------------------------------------
/docs/start/envwin.md:
--------------------------------------------------------------------------------
1 | # System requirements: Windows
2 |
3 | [This page has moved.](https://docs.microsoft.com/azure/devops/pipelines/agents/v2-windows#check-prerequisites)
4 |
--------------------------------------------------------------------------------
/docs/start/moreconfig.md:
--------------------------------------------------------------------------------
1 | # Replacing an agent
2 |
3 | If an agent already exists, configuration will ask you if you want to replace it. The name will default to the machine name so if configure two agents on the same machine, you can enter N and it will give you a chance to provide another name.
4 |
5 | If you are reconfiguring the agent, then choose Y.
6 |
7 | If you intended to actually replace an different agent, ensure the other agent is unconfigured. If two instances run with the same agent name, one will get a conflict. After a few minutes of conflicts, one will shut down.
8 |
9 | ```bash
10 | Enter agent name (press enter for mymachine) >
11 | Scanning for tool capabilities.
12 | Connecting to the server.
13 | Enter replace? (Y/N) (press enter for N) > N
14 | Enter agent name (press enter for mymachine) > testagent
15 | Scanning for tool capabilities.
16 | Connecting to the server.
17 | Successfully added the agent
18 | ```
19 |
20 | # Unconfigure
21 |
22 | > Important: If you're running as a service on Linux/OSX, ensure you `stop` then `uninstall` the service before unconfiguring. See [Nix Service Config](nixsvc.md)
23 |
24 | ```bash
25 | $ ./config.sh remove
26 | Removing service
27 | Does not exist. Skipping Removing service
28 | Removing agent from the server
29 | Enter authentication type (press enter for PAT) >
30 | Enter personal access token > ****************************************************
31 | Succeeded: Removing agent from the server
32 | Removing .Credentials
33 | Succeeded: Removing .Credentials
34 | Removing .Agent
35 | Succeeded: Removing .Agent
36 | ```
37 |
38 | # Help
39 |
40 | ```bash
41 | ./config.sh --help
42 | ```
--------------------------------------------------------------------------------
/docs/start/roles.md:
--------------------------------------------------------------------------------
1 | # Configure Account and Roles
2 |
3 | ## VSTS
4 |
5 | Create a PAT token. [Step by Step here](https://www.visualstudio.com/en-us/docs/setup-admin/team-services/use-personal-access-tokens-to-authenticate)
6 |
7 | Choose all scopes or the minimum "Agent Pools (read, manage)" scope.
8 |
9 | 
10 |
11 | ## On Premises TFS
12 |
13 | You can use a domain user but it's recommended to create a local windows user on each of your application tiers specifically for registering build agents.
14 |
15 | ## Add to Role
16 |
17 | Add the user from above to only the Agent Pool Administrators which allows you to register the agent.
18 |
19 | 
20 |
21 | >> TIPS:
22 | >> You can add to roles for a specific pool or select "All Pools" on the left and grant for all pools. This allows the account owner to delegate build administration globally or for specific pools. [More here](https://msdn.microsoft.com/en-us/Library/vs/alm/Build/agents/admin)
23 | >> The role is only needed to register the agent. A token is downloaded to listen to the queue.
24 | >> When a build is run, it will generate an OAuth token for the scoped identity selected on the general tab of the build definition. That token is short lived and will be used to access resource in VSTS. The account used to register the agent has no bearing on the build run time credentials
25 |
--------------------------------------------------------------------------------
/docs/start/roles.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/azure-pipelines-agent/5453c1a1915722b10e6017bbb9f041d620591b25/docs/start/roles.png
--------------------------------------------------------------------------------
/docs/start/scopes.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/azure-pipelines-agent/5453c1a1915722b10e6017bbb9f041d620591b25/docs/start/scopes.png
--------------------------------------------------------------------------------
/images/readme.md:
--------------------------------------------------------------------------------
1 | # Docker Images for the Agent CI/CD Pipeline
2 |
3 | ## Docker Hub
4 |
5 | In order to publish these images, you need to be a member of the organization `azpagentinfra`
6 |
7 | ## How to Build
8 |
9 | ```bash
10 | docker build --tag "azpagentinfra/alpine:latest" ./images/alpine/
11 | ```
12 |
13 | ## How to Push
14 |
15 | ```bash
16 | docker push "azpagentinfra/alpine:latest"
17 | ```
18 |
--------------------------------------------------------------------------------
/open-pullrequest.ps1:
--------------------------------------------------------------------------------
1 | param(
2 | [Parameter(Mandatory)]
3 | [string]
4 | $SourceBranch
5 | )
6 |
7 | # Getting a created PR. Result object has interface in accordance with article https://docs.github.com/en/rest/reference/pulls#get-a-pull-request
8 | function Get-PullRequest() {
9 | return (gh api -X GET repos/:owner/:repo/pulls -F head=":owner:$SourceBranch" -f state=open -f base=master | ConvertFrom-Json)
10 | }
11 |
12 | $openedPR = Get-PullRequest
13 |
14 | if ($openedPR.html_url.length -ne 0) {
15 | throw "A PR from $SourceBranch to master already exists."
16 | }
17 |
18 | $buildUrl = "$env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI$env:SYSTEM_TEAMPROJECT/_build/results?buildId=$env:BUILD_BUILDID&_a=summary"
19 | $body = "This PR was auto-generated with [the localization pipeline build]($buildUrl)."
20 |
21 | gh pr create --head $SourceBranch --title 'Localization update' --body $body --label "misc"
22 |
23 | # Getting a number to the opened PR
24 | $PR_NUMBER = (Get-PullRequest).number
25 | Write-Host "##vso[task.setvariable variable=PR_NUMBER]$PR_NUMBER"
26 |
27 | # Getting a link to the opened PR
28 | $PR_LINK = (Get-PullRequest).html_url
29 | Write-Host "##vso[task.setvariable variable=PR_LINK]$PR_LINK"
30 |
--------------------------------------------------------------------------------
/release/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "private": true,
3 | "devDependencies": {
4 | "@octokit/rest": "^16.43.2",
5 | "@octokit/graphql": "^7.1.1",
6 | "azure-devops-node-api": "^12.0.0",
7 | "azure-pipelines-task-lib": "^4.3.1",
8 | "got": "^11.8.6",
9 | "node-getopt": "^0.3.2"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/.helpers.sh:
--------------------------------------------------------------------------------
1 | function failed()
2 | {
3 | local error=${1:-Undefined error}
4 | echo "Failed: $error" >&2
5 | popd
6 | exit 1
7 | }
8 |
9 | function warn()
10 | {
11 | local error=${1:-Undefined error}
12 | echo "WARNING - FAILED: $error" >&2
13 | }
14 |
15 | function checkRC() {
16 | local rc=$?
17 | if [ $rc -ne 0 ]; then
18 | failed "${1} Failed with return code $rc"
19 | fi
20 | }
21 |
22 | function heading()
23 | {
24 | echo
25 | echo
26 | echo "-----------------------------------------"
27 | echo " ${1}"
28 | echo "-----------------------------------------"
29 | }
30 |
--------------------------------------------------------------------------------
/src/Agent.Listener/CommandLine/BaseCommand.cs:
--------------------------------------------------------------------------------
1 | using CommandLine;
2 | using Microsoft.VisualStudio.Services.Agent;
3 |
4 | namespace Agent.Listener.CommandLine
5 | {
6 | public class BaseCommand
7 | {
8 | [Option(Constants.Agent.CommandLine.Flags.Help)]
9 | public bool Help { get; set; }
10 |
11 | [Option(Constants.Agent.CommandLine.Flags.Version)]
12 | public bool Version { get; set; }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Agent.Listener/CommandLine/ConfigureOrRemoveBase.cs:
--------------------------------------------------------------------------------
1 | using CommandLine;
2 | using Microsoft.VisualStudio.Services.Agent;
3 |
4 | namespace Agent.Listener.CommandLine
5 | {
6 | public class ConfigureOrRemoveBase : BaseCommand
7 | {
8 | [Option(Constants.Agent.CommandLine.Args.Auth)]
9 | public string Auth { get; set; }
10 |
11 | [Option(Constants.Agent.CommandLine.Flags.LaunchBrowser)]
12 | public bool LaunchBrowser { get; set; }
13 |
14 | [Option(Constants.Agent.CommandLine.Args.Password)]
15 | public string Password { get; set; }
16 |
17 | [Option(Constants.Agent.CommandLine.Args.Token)]
18 | public string Token { get; set; }
19 |
20 | [Option(Constants.Agent.CommandLine.Flags.Unattended)]
21 | public bool Unattended { get; set; }
22 |
23 | [Option(Constants.Agent.CommandLine.Args.UserName)]
24 | public string UserName { get; set; }
25 |
26 | [Option(Constants.Agent.CommandLine.Args.ClientId)]
27 | public string ClientId { get; set; }
28 |
29 | [Option(Constants.Agent.CommandLine.Args.TenantId)]
30 | public string TenantId { get; set; }
31 |
32 | [Option(Constants.Agent.CommandLine.Args.ClientSecret)]
33 | public string ClientSecret { get; set; }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/Agent.Listener/CommandLine/ReAuthAgent.cs:
--------------------------------------------------------------------------------
1 | using CommandLine;
2 | using Microsoft.VisualStudio.Services.Agent;
3 |
4 | namespace Agent.Listener.CommandLine
5 | {
6 | [Verb(Constants.Agent.CommandLine.Commands.ReAuth)]
7 | public class ReAuthAgent : ConfigureOrRemoveBase
8 | {
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/Agent.Listener/CommandLine/RemoveAgent.cs:
--------------------------------------------------------------------------------
1 | using CommandLine;
2 | using Microsoft.VisualStudio.Services.Agent;
3 |
4 | namespace Agent.Listener.CommandLine
5 | {
6 | [Verb(Constants.Agent.CommandLine.Commands.Remove)]
7 | public class RemoveAgent : ConfigureOrRemoveBase
8 | {
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/Agent.Listener/CommandLine/RunAgent.cs:
--------------------------------------------------------------------------------
1 | using CommandLine;
2 | using Microsoft.VisualStudio.Services.Agent;
3 |
4 | namespace Agent.Listener.CommandLine
5 | {
6 | // Default Non-Requried Verb
7 | [Verb(Constants.Agent.CommandLine.Commands.Run)]
8 | public class RunAgent : BaseCommand
9 | {
10 | [Option(Constants.Agent.CommandLine.Flags.Commit)]
11 | public bool Commit { get; set; }
12 |
13 | [Option(Constants.Agent.CommandLine.Flags.Diagnostics)]
14 | public bool Diagnostics { get; set; }
15 |
16 | [Option(Constants.Agent.CommandLine.Flags.Once)]
17 | public bool RunOnce { get; set; }
18 |
19 | [Option(Constants.Agent.CommandLine.Args.StartupType)]
20 | public string StartupType { get; set; }
21 |
22 | [Option(Constants.Agent.CommandLine.Flags.DebugMode)]
23 | public bool DebugMode { get; set; }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Agent.Listener/CommandLine/WarmupAgent.cs:
--------------------------------------------------------------------------------
1 | using CommandLine;
2 | using Microsoft.VisualStudio.Services.Agent;
3 |
4 | namespace Agent.Listener.CommandLine
5 | {
6 | [Verb(Constants.Agent.CommandLine.Commands.Warmup)]
7 | public class WarmupAgent : BaseCommand
8 | {
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/Agent.Listener/Configuration/IntegratedCredential.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation.
2 | // Licensed under the MIT License.
3 |
4 | using Microsoft.VisualStudio.Services.Agent.Util;
5 | using Microsoft.VisualStudio.Services.Common;
6 |
7 | namespace Microsoft.VisualStudio.Services.Agent.Listener.Configuration
8 | {
9 | public sealed class IntegratedCredential : CredentialProvider
10 | {
11 | public IntegratedCredential() : base(Constants.Configuration.Integrated) { }
12 |
13 | public override VssCredentials GetVssCredentials(IHostContext context)
14 | {
15 | ArgUtil.NotNull(context, nameof(context));
16 | Tracing trace = context.GetTrace(nameof(IntegratedCredential));
17 | trace.Info(nameof(GetVssCredentials));
18 |
19 | // Create instance of VssConnection using default Windows credentials (NTLM)
20 | VssCredentials creds = new VssCredentials(true);
21 |
22 | trace.Verbose("cred created");
23 |
24 | return creds;
25 | }
26 |
27 | public override void EnsureCredential(IHostContext context, CommandSettings command, string serverUrl)
28 | {
29 | //Integrated credentials do not require any configuration parameters
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/Agent.Listener/Diagnostics/DiagnosticSuite.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.VisualStudio.Services.Agent.Listener.Diagnostics;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Text;
5 |
6 | namespace Agent.Listener.Diagnostics
7 | {
8 | class DiagnosticSuite
9 | {
10 | public string SuiteName { get; set; }
11 | public List