title | description | ms.prod | ms.technology | ms.assetid | ms.manager | ms.author | ms.date | ms.topic | monikerRange |
---|---|---|---|---|---|---|---|---|---|
Build your Go app | VSTS or Team Foundation Server |
Learn how you can use the continuous integration (CI) process in VSTS or TFS to automatically build your Go application |
devops |
devops-cicd |
cd16d151-8786-4b65-82eb-95d152232f39 |
douge |
dastahel |
05/01/2018 |
quickstart |
>= tfs-2017 |
VSTS | TFS 2018 | TFS 2017.2
Visual Studio Team Services (VSTS) and Team Foundation Server (TFS) provide a highly customizable continuous integration (CI) process to automatically build your Go application whenever your team pushes or checks in code. In this quickstart you learn how to define your CI process for a Go application.
[!INCLUDE include]
- While the simplest way to try this quickstart is to use a VSTS account, you can also use a TFS server instead of a VSTS account. Make sure that you have configured a build agent for your project, and that you have Go installed on the agent machine.
[!INCLUDE include]
https://github.com/adventworks/go-sample
[!INCLUDE include]
[!INCLUDE include]
[!INCLUDE include]
- Create a new build definition.
Navigate to the Files tab of the Code hub, and then click Set up build.
You are taken to the Build and Release hub and asked to Select a template for the new build definition.
::: moniker range="> tfs-2018"
- In the right panel, search for
Go
, select Go (Preview), and then click Apply.
You now see all the tasks that were automatically added to the build definition by the template. These are the tasks that will automatically run every time you push code changes.
- For the Agent queue:
-
VSTS: Select Hosted Linux, Hosted macOS, or Hosted VS2017. This will use a Microsoft-hosted agent with Go installed.
-
TFS: Select a queue that includes an agent with Go installed.
- Click Get sources and observe that the new build definition is automatically linked to your repository.
::: moniker-end
::: moniker range="<=tfs-2018"
-
In the right panel, select Empty, and then click Apply. This template allows starting from scratch and adding your own build tasks.
-
For the Agent queue, select a queue that includes an agent with Go installed.
-
Click Get sources and observe that the new build definition is automatically linked to your repository.
-
Click the + icon on Phase 1 of the build.
-
Search for the Command Line task and click Add to add it to your build.
-
Click the Command Line task and set its field values as follows:
Field Value Display name Build Go application
Tool go
Arguments build hello.go
::: moniker-end
Navigate to the Builds tab of the Build and Release hub in VSTS or TFS, and then click + New. You are asked to Select a template for the new build definition.
::: moniker range="> tfs-2018"
- In the right panel, search for
Go
, select Go (Preview), and then click Apply.
You now see all the tasks that were automatically added to the build definition by the template. These are the tasks that will automatically run every time you push code changes.
- For the Agent queue:
-
VSTS: Select Hosted Linux, Hosted macOS, or Hosted VS2017. This will use a Microsoft-hosted agent with Go installed.
-
TFS: Select a queue that includes an agent with Go installed.
- Click Get sources and select your version control repository. You'll need to authorize access to it.
::: moniker-end
::: moniker range="<=tfs-2018"
-
In the right panel, select Empty, and then click Apply. This template allows starting from scratch and adding your own build tasks.
-
For the Agent queue, select a queue that includes an agent with Go installed.
-
Click Get sources and select your version control repository. You'll need to authorize access to it.
-
Click the + icon on Phase 1 of the build.
-
Search for the Command Line task and click Add to add it to your build.
-
Click the Command Line task and set its field values as follows:
Field Value Display name Build Go application
Tool go
Arguments build hello.go
-
Click the Triggers tab in the build definition. Enable the Continuous integration trigger. This will ensure that the build process is automatically triggered every time changes are pushed to your repository.
-
Click Save & queue to kick off your first build. On the Save build definition and queue dialog box, click Save & queue.
-
A new build is started. You'll see a link to the new build on the top of the page. Click the link to watch the new build as it happens.
//: # (TODO:> To learn more about GitHub CI builds, see Define CI build process for your Git repo
[!INCLUDE include]
::: moniker range="<=tfs-2018"
Add the Copy Files and Publish Build Artifacts tasks to your build to save its compiled output as a build artifact.
::: moniker-end
[!INCLUDE include]