How to access files in VSTS Source Repo at the time of release definition?
I have some 10 files in the VSTS source code repo (Git) I want to access those files at the time of release definition. I have kept my PowerShell scripts in the VSTS source Repo and after the deployment, I need to run those script files.

So I have added power shell task after the deploy in the release definition but not sure how to access those script files and how can I run those? I can publish those script files from VSTS build definition and can use at the release definition time but I don't want to use in that way.
I want my release definition to run independently.
git azure-devops azure-pipelines azure-pipelines-release-pipeline
|
show 2 more comments
I have some 10 files in the VSTS source code repo (Git) I want to access those files at the time of release definition. I have kept my PowerShell scripts in the VSTS source Repo and after the deployment, I need to run those script files.

So I have added power shell task after the deploy in the release definition but not sure how to access those script files and how can I run those? I can publish those script files from VSTS build definition and can use at the release definition time but I don't want to use in that way.
I want my release definition to run independently.
git azure-devops azure-pipelines azure-pipelines-release-pipeline
Would you consider publishing those scripts as a package to Package Manager and then downloading and extracting that package in the release? Is your Repo a GIT repo or TFVC repo?
– DenverDev
Nov 30 '17 at 17:33
I don't want to publish from the build definition. I want to use the scripts at the time of release definition. How can I use or access those scripts?
– PRAVEEN
Dec 1 '17 at 2:06
What's the version control system do you use to manage the source file, is it Git?
– Marina Liu - MSFT
Dec 1 '17 at 2:11
My source code is in VSTS REPO
– PRAVEEN
Dec 1 '17 at 2:40
There are two VCS for VSTS: Git and TFVC. The solution should be different for your question based on which VCS you are use. So please add a screen shot for your VSTS project Code Tab.
– Marina Liu - MSFT
Dec 1 '17 at 2:48
|
show 2 more comments
I have some 10 files in the VSTS source code repo (Git) I want to access those files at the time of release definition. I have kept my PowerShell scripts in the VSTS source Repo and after the deployment, I need to run those script files.

So I have added power shell task after the deploy in the release definition but not sure how to access those script files and how can I run those? I can publish those script files from VSTS build definition and can use at the release definition time but I don't want to use in that way.
I want my release definition to run independently.
git azure-devops azure-pipelines azure-pipelines-release-pipeline
I have some 10 files in the VSTS source code repo (Git) I want to access those files at the time of release definition. I have kept my PowerShell scripts in the VSTS source Repo and after the deployment, I need to run those script files.

So I have added power shell task after the deploy in the release definition but not sure how to access those script files and how can I run those? I can publish those script files from VSTS build definition and can use at the release definition time but I don't want to use in that way.
I want my release definition to run independently.
git azure-devops azure-pipelines azure-pipelines-release-pipeline
git azure-devops azure-pipelines azure-pipelines-release-pipeline
edited Dec 1 '17 at 20:38
jessehouwing
67.4k9161234
67.4k9161234
asked Nov 30 '17 at 12:03
PRAVEENPRAVEEN
67111
67111
Would you consider publishing those scripts as a package to Package Manager and then downloading and extracting that package in the release? Is your Repo a GIT repo or TFVC repo?
– DenverDev
Nov 30 '17 at 17:33
I don't want to publish from the build definition. I want to use the scripts at the time of release definition. How can I use or access those scripts?
– PRAVEEN
Dec 1 '17 at 2:06
What's the version control system do you use to manage the source file, is it Git?
– Marina Liu - MSFT
Dec 1 '17 at 2:11
My source code is in VSTS REPO
– PRAVEEN
Dec 1 '17 at 2:40
There are two VCS for VSTS: Git and TFVC. The solution should be different for your question based on which VCS you are use. So please add a screen shot for your VSTS project Code Tab.
– Marina Liu - MSFT
Dec 1 '17 at 2:48
|
show 2 more comments
Would you consider publishing those scripts as a package to Package Manager and then downloading and extracting that package in the release? Is your Repo a GIT repo or TFVC repo?
– DenverDev
Nov 30 '17 at 17:33
I don't want to publish from the build definition. I want to use the scripts at the time of release definition. How can I use or access those scripts?
– PRAVEEN
Dec 1 '17 at 2:06
What's the version control system do you use to manage the source file, is it Git?
– Marina Liu - MSFT
Dec 1 '17 at 2:11
My source code is in VSTS REPO
– PRAVEEN
Dec 1 '17 at 2:40
There are two VCS for VSTS: Git and TFVC. The solution should be different for your question based on which VCS you are use. So please add a screen shot for your VSTS project Code Tab.
– Marina Liu - MSFT
Dec 1 '17 at 2:48
Would you consider publishing those scripts as a package to Package Manager and then downloading and extracting that package in the release? Is your Repo a GIT repo or TFVC repo?
– DenverDev
Nov 30 '17 at 17:33
Would you consider publishing those scripts as a package to Package Manager and then downloading and extracting that package in the release? Is your Repo a GIT repo or TFVC repo?
– DenverDev
Nov 30 '17 at 17:33
I don't want to publish from the build definition. I want to use the scripts at the time of release definition. How can I use or access those scripts?
– PRAVEEN
Dec 1 '17 at 2:06
I don't want to publish from the build definition. I want to use the scripts at the time of release definition. How can I use or access those scripts?
– PRAVEEN
Dec 1 '17 at 2:06
What's the version control system do you use to manage the source file, is it Git?
– Marina Liu - MSFT
Dec 1 '17 at 2:11
What's the version control system do you use to manage the source file, is it Git?
– Marina Liu - MSFT
Dec 1 '17 at 2:11
My source code is in VSTS REPO
– PRAVEEN
Dec 1 '17 at 2:40
My source code is in VSTS REPO
– PRAVEEN
Dec 1 '17 at 2:40
There are two VCS for VSTS: Git and TFVC. The solution should be different for your question based on which VCS you are use. So please add a screen shot for your VSTS project Code Tab.
– Marina Liu - MSFT
Dec 1 '17 at 2:48
There are two VCS for VSTS: Git and TFVC. The solution should be different for your question based on which VCS you are use. So please add a screen shot for your VSTS project Code Tab.
– Marina Liu - MSFT
Dec 1 '17 at 2:48
|
show 2 more comments
3 Answers
3
active
oldest
votes
In your release definition, you can add one or more artefact sources. These sources can include TFVC and Git repositories as well as the output of a Build Definition.
Reference your repository as an artefact
You can have multiple artefact sources, so you can add the Git Repo as a secondary source:

Note: this will not just fetch these scripts, but it will pull the repository again during the release workflow. This can be time-consuming if your repository is large.
You can consider putting them in a TFVC repository, as that allows very specific mapping of required scripts.
Publish your scripts in a separate build definition
The normal approach would be to publish these scripts as an artefact of a Build Definition (doesn't have to be the same build definition as your main Build). That way you only have to sync these scripts and won't need to get the full repository. To be clear, you can have one build definition that contains the contents of your build linked to the Release and have another build definition linked which published just the scripts.

Note: You don't need to publish these scripts every time you want to use them, your release definition can keep referencing the published artefacts from months ago. The script build only needs to run in order to publish the scripts as they change. A CI build with a trigger filter can be used to only republish the scripts when they change.
Leverage a script repository such as PowerShell Gallery, NuGet, Chocolatey
Other options you may want to consider are publishing your scripts to a PowerShell gallery, Chocolatey gallery etc and as part of your release workflow, you can then fetch these scripts through One-Get.
You can use the NuGet task in a build definition or nuget.exe to push these scripts to the VSTS package management feature. And you can use a commanline task or inline powershell task to install the powershell module on the agent.
Use the REST API
This is a more developer centric approach, you can call the REST API of VSTS/TFS to download individual files from a Git repository. The Download Item api allows you to fetch individual files. It wouldn't be hard to create a Build task that uses the Invoke-WebRequest powershell command to download and save the desired files.
Create a custom build task
A final option you could consider is building a custom build/release task. PowerShell scripts can easily be included in a custom build task and they can be installed to the VSTS/TFS account. That way you can re-use your scripts, have a small UI around them if desired without having to reference a repository at all. You would have to update and publish your task every time you change the scripts. Though you could use the REST API to always download the script before invoking it.
,thanks for your response.But as I requested,I don't want to use any build definition to access those scripts but I need is is there any possibility to access those script files which are in the repo at the release definition without need of any build definition.Even I can copy and publish the scripts as part of my build def but I don't want to publish every time so need to be accessed those scripts which are in the source code repo directly from the release definition .Please suggest any other way.I can accept your answer but I am accepting different answer which I want to use in my project
– PRAVEEN
Dec 2 '17 at 8:14
I outlined two options: 1 use the Git Artifact. 2. publish your scripts to a package repository and install them on the target system using PowerShell one-get.
– jessehouwing
Dec 2 '17 at 8:19
Options galore.
– jessehouwing
Dec 2 '17 at 8:36
add a comment |
You just need to add a Command Line task to get files from git repo. Detail steps as below:
Create alternate authentication credentials
In alternate authentication credentials page (https://account.visualstudio.com/_details/security/altcreds) -> Enable alternate authentication credentials -> specify secondary username and password -> Save.

Add a Command Line task in release definition
Tool:
git
Arguments:
clone https://second:password@account.visualstudio.com/project/_git/reponame foldername(use secondary username and password for credential)

Now all the files of the git repo are located in $(System.DefaultWorkingDirectory)foldername, and you can use the files from the directory.
add a comment |
There are some ways we can reach to repo assets.
Use Build Definition to checkout repo
Inside Build definition, publish file/source as artifact. Then using that artifacts as input of Release defininition.
Use Repo as input artiface
At pipeline view of Release definition, config artifact value of Release definition. For example: Chose Azure Repository type
Add additional step that checkout repo in Release definition:
It's simply a command line call using Git clone. Command line call maybe kind of Batch Script task, PowerShell task, etc..
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f47573072%2fhow-to-access-files-in-vsts-source-repo-at-the-time-of-release-definition%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
In your release definition, you can add one or more artefact sources. These sources can include TFVC and Git repositories as well as the output of a Build Definition.
Reference your repository as an artefact
You can have multiple artefact sources, so you can add the Git Repo as a secondary source:

Note: this will not just fetch these scripts, but it will pull the repository again during the release workflow. This can be time-consuming if your repository is large.
You can consider putting them in a TFVC repository, as that allows very specific mapping of required scripts.
Publish your scripts in a separate build definition
The normal approach would be to publish these scripts as an artefact of a Build Definition (doesn't have to be the same build definition as your main Build). That way you only have to sync these scripts and won't need to get the full repository. To be clear, you can have one build definition that contains the contents of your build linked to the Release and have another build definition linked which published just the scripts.

Note: You don't need to publish these scripts every time you want to use them, your release definition can keep referencing the published artefacts from months ago. The script build only needs to run in order to publish the scripts as they change. A CI build with a trigger filter can be used to only republish the scripts when they change.
Leverage a script repository such as PowerShell Gallery, NuGet, Chocolatey
Other options you may want to consider are publishing your scripts to a PowerShell gallery, Chocolatey gallery etc and as part of your release workflow, you can then fetch these scripts through One-Get.
You can use the NuGet task in a build definition or nuget.exe to push these scripts to the VSTS package management feature. And you can use a commanline task or inline powershell task to install the powershell module on the agent.
Use the REST API
This is a more developer centric approach, you can call the REST API of VSTS/TFS to download individual files from a Git repository. The Download Item api allows you to fetch individual files. It wouldn't be hard to create a Build task that uses the Invoke-WebRequest powershell command to download and save the desired files.
Create a custom build task
A final option you could consider is building a custom build/release task. PowerShell scripts can easily be included in a custom build task and they can be installed to the VSTS/TFS account. That way you can re-use your scripts, have a small UI around them if desired without having to reference a repository at all. You would have to update and publish your task every time you change the scripts. Though you could use the REST API to always download the script before invoking it.
,thanks for your response.But as I requested,I don't want to use any build definition to access those scripts but I need is is there any possibility to access those script files which are in the repo at the release definition without need of any build definition.Even I can copy and publish the scripts as part of my build def but I don't want to publish every time so need to be accessed those scripts which are in the source code repo directly from the release definition .Please suggest any other way.I can accept your answer but I am accepting different answer which I want to use in my project
– PRAVEEN
Dec 2 '17 at 8:14
I outlined two options: 1 use the Git Artifact. 2. publish your scripts to a package repository and install them on the target system using PowerShell one-get.
– jessehouwing
Dec 2 '17 at 8:19
Options galore.
– jessehouwing
Dec 2 '17 at 8:36
add a comment |
In your release definition, you can add one or more artefact sources. These sources can include TFVC and Git repositories as well as the output of a Build Definition.
Reference your repository as an artefact
You can have multiple artefact sources, so you can add the Git Repo as a secondary source:

Note: this will not just fetch these scripts, but it will pull the repository again during the release workflow. This can be time-consuming if your repository is large.
You can consider putting them in a TFVC repository, as that allows very specific mapping of required scripts.
Publish your scripts in a separate build definition
The normal approach would be to publish these scripts as an artefact of a Build Definition (doesn't have to be the same build definition as your main Build). That way you only have to sync these scripts and won't need to get the full repository. To be clear, you can have one build definition that contains the contents of your build linked to the Release and have another build definition linked which published just the scripts.

Note: You don't need to publish these scripts every time you want to use them, your release definition can keep referencing the published artefacts from months ago. The script build only needs to run in order to publish the scripts as they change. A CI build with a trigger filter can be used to only republish the scripts when they change.
Leverage a script repository such as PowerShell Gallery, NuGet, Chocolatey
Other options you may want to consider are publishing your scripts to a PowerShell gallery, Chocolatey gallery etc and as part of your release workflow, you can then fetch these scripts through One-Get.
You can use the NuGet task in a build definition or nuget.exe to push these scripts to the VSTS package management feature. And you can use a commanline task or inline powershell task to install the powershell module on the agent.
Use the REST API
This is a more developer centric approach, you can call the REST API of VSTS/TFS to download individual files from a Git repository. The Download Item api allows you to fetch individual files. It wouldn't be hard to create a Build task that uses the Invoke-WebRequest powershell command to download and save the desired files.
Create a custom build task
A final option you could consider is building a custom build/release task. PowerShell scripts can easily be included in a custom build task and they can be installed to the VSTS/TFS account. That way you can re-use your scripts, have a small UI around them if desired without having to reference a repository at all. You would have to update and publish your task every time you change the scripts. Though you could use the REST API to always download the script before invoking it.
,thanks for your response.But as I requested,I don't want to use any build definition to access those scripts but I need is is there any possibility to access those script files which are in the repo at the release definition without need of any build definition.Even I can copy and publish the scripts as part of my build def but I don't want to publish every time so need to be accessed those scripts which are in the source code repo directly from the release definition .Please suggest any other way.I can accept your answer but I am accepting different answer which I want to use in my project
– PRAVEEN
Dec 2 '17 at 8:14
I outlined two options: 1 use the Git Artifact. 2. publish your scripts to a package repository and install them on the target system using PowerShell one-get.
– jessehouwing
Dec 2 '17 at 8:19
Options galore.
– jessehouwing
Dec 2 '17 at 8:36
add a comment |
In your release definition, you can add one or more artefact sources. These sources can include TFVC and Git repositories as well as the output of a Build Definition.
Reference your repository as an artefact
You can have multiple artefact sources, so you can add the Git Repo as a secondary source:

Note: this will not just fetch these scripts, but it will pull the repository again during the release workflow. This can be time-consuming if your repository is large.
You can consider putting them in a TFVC repository, as that allows very specific mapping of required scripts.
Publish your scripts in a separate build definition
The normal approach would be to publish these scripts as an artefact of a Build Definition (doesn't have to be the same build definition as your main Build). That way you only have to sync these scripts and won't need to get the full repository. To be clear, you can have one build definition that contains the contents of your build linked to the Release and have another build definition linked which published just the scripts.

Note: You don't need to publish these scripts every time you want to use them, your release definition can keep referencing the published artefacts from months ago. The script build only needs to run in order to publish the scripts as they change. A CI build with a trigger filter can be used to only republish the scripts when they change.
Leverage a script repository such as PowerShell Gallery, NuGet, Chocolatey
Other options you may want to consider are publishing your scripts to a PowerShell gallery, Chocolatey gallery etc and as part of your release workflow, you can then fetch these scripts through One-Get.
You can use the NuGet task in a build definition or nuget.exe to push these scripts to the VSTS package management feature. And you can use a commanline task or inline powershell task to install the powershell module on the agent.
Use the REST API
This is a more developer centric approach, you can call the REST API of VSTS/TFS to download individual files from a Git repository. The Download Item api allows you to fetch individual files. It wouldn't be hard to create a Build task that uses the Invoke-WebRequest powershell command to download and save the desired files.
Create a custom build task
A final option you could consider is building a custom build/release task. PowerShell scripts can easily be included in a custom build task and they can be installed to the VSTS/TFS account. That way you can re-use your scripts, have a small UI around them if desired without having to reference a repository at all. You would have to update and publish your task every time you change the scripts. Though you could use the REST API to always download the script before invoking it.
In your release definition, you can add one or more artefact sources. These sources can include TFVC and Git repositories as well as the output of a Build Definition.
Reference your repository as an artefact
You can have multiple artefact sources, so you can add the Git Repo as a secondary source:

Note: this will not just fetch these scripts, but it will pull the repository again during the release workflow. This can be time-consuming if your repository is large.
You can consider putting them in a TFVC repository, as that allows very specific mapping of required scripts.
Publish your scripts in a separate build definition
The normal approach would be to publish these scripts as an artefact of a Build Definition (doesn't have to be the same build definition as your main Build). That way you only have to sync these scripts and won't need to get the full repository. To be clear, you can have one build definition that contains the contents of your build linked to the Release and have another build definition linked which published just the scripts.

Note: You don't need to publish these scripts every time you want to use them, your release definition can keep referencing the published artefacts from months ago. The script build only needs to run in order to publish the scripts as they change. A CI build with a trigger filter can be used to only republish the scripts when they change.
Leverage a script repository such as PowerShell Gallery, NuGet, Chocolatey
Other options you may want to consider are publishing your scripts to a PowerShell gallery, Chocolatey gallery etc and as part of your release workflow, you can then fetch these scripts through One-Get.
You can use the NuGet task in a build definition or nuget.exe to push these scripts to the VSTS package management feature. And you can use a commanline task or inline powershell task to install the powershell module on the agent.
Use the REST API
This is a more developer centric approach, you can call the REST API of VSTS/TFS to download individual files from a Git repository. The Download Item api allows you to fetch individual files. It wouldn't be hard to create a Build task that uses the Invoke-WebRequest powershell command to download and save the desired files.
Create a custom build task
A final option you could consider is building a custom build/release task. PowerShell scripts can easily be included in a custom build task and they can be installed to the VSTS/TFS account. That way you can re-use your scripts, have a small UI around them if desired without having to reference a repository at all. You would have to update and publish your task every time you change the scripts. Though you could use the REST API to always download the script before invoking it.
edited Dec 2 '17 at 8:36
answered Dec 1 '17 at 20:34
jessehouwingjessehouwing
67.4k9161234
67.4k9161234
,thanks for your response.But as I requested,I don't want to use any build definition to access those scripts but I need is is there any possibility to access those script files which are in the repo at the release definition without need of any build definition.Even I can copy and publish the scripts as part of my build def but I don't want to publish every time so need to be accessed those scripts which are in the source code repo directly from the release definition .Please suggest any other way.I can accept your answer but I am accepting different answer which I want to use in my project
– PRAVEEN
Dec 2 '17 at 8:14
I outlined two options: 1 use the Git Artifact. 2. publish your scripts to a package repository and install them on the target system using PowerShell one-get.
– jessehouwing
Dec 2 '17 at 8:19
Options galore.
– jessehouwing
Dec 2 '17 at 8:36
add a comment |
,thanks for your response.But as I requested,I don't want to use any build definition to access those scripts but I need is is there any possibility to access those script files which are in the repo at the release definition without need of any build definition.Even I can copy and publish the scripts as part of my build def but I don't want to publish every time so need to be accessed those scripts which are in the source code repo directly from the release definition .Please suggest any other way.I can accept your answer but I am accepting different answer which I want to use in my project
– PRAVEEN
Dec 2 '17 at 8:14
I outlined two options: 1 use the Git Artifact. 2. publish your scripts to a package repository and install them on the target system using PowerShell one-get.
– jessehouwing
Dec 2 '17 at 8:19
Options galore.
– jessehouwing
Dec 2 '17 at 8:36
,thanks for your response.But as I requested,I don't want to use any build definition to access those scripts but I need is is there any possibility to access those script files which are in the repo at the release definition without need of any build definition.Even I can copy and publish the scripts as part of my build def but I don't want to publish every time so need to be accessed those scripts which are in the source code repo directly from the release definition .Please suggest any other way.I can accept your answer but I am accepting different answer which I want to use in my project
– PRAVEEN
Dec 2 '17 at 8:14
,thanks for your response.But as I requested,I don't want to use any build definition to access those scripts but I need is is there any possibility to access those script files which are in the repo at the release definition without need of any build definition.Even I can copy and publish the scripts as part of my build def but I don't want to publish every time so need to be accessed those scripts which are in the source code repo directly from the release definition .Please suggest any other way.I can accept your answer but I am accepting different answer which I want to use in my project
– PRAVEEN
Dec 2 '17 at 8:14
I outlined two options: 1 use the Git Artifact. 2. publish your scripts to a package repository and install them on the target system using PowerShell one-get.
– jessehouwing
Dec 2 '17 at 8:19
I outlined two options: 1 use the Git Artifact. 2. publish your scripts to a package repository and install them on the target system using PowerShell one-get.
– jessehouwing
Dec 2 '17 at 8:19
Options galore.
– jessehouwing
Dec 2 '17 at 8:36
Options galore.
– jessehouwing
Dec 2 '17 at 8:36
add a comment |
You just need to add a Command Line task to get files from git repo. Detail steps as below:
Create alternate authentication credentials
In alternate authentication credentials page (https://account.visualstudio.com/_details/security/altcreds) -> Enable alternate authentication credentials -> specify secondary username and password -> Save.

Add a Command Line task in release definition
Tool:
git
Arguments:
clone https://second:password@account.visualstudio.com/project/_git/reponame foldername(use secondary username and password for credential)

Now all the files of the git repo are located in $(System.DefaultWorkingDirectory)foldername, and you can use the files from the directory.
add a comment |
You just need to add a Command Line task to get files from git repo. Detail steps as below:
Create alternate authentication credentials
In alternate authentication credentials page (https://account.visualstudio.com/_details/security/altcreds) -> Enable alternate authentication credentials -> specify secondary username and password -> Save.

Add a Command Line task in release definition
Tool:
git
Arguments:
clone https://second:password@account.visualstudio.com/project/_git/reponame foldername(use secondary username and password for credential)

Now all the files of the git repo are located in $(System.DefaultWorkingDirectory)foldername, and you can use the files from the directory.
add a comment |
You just need to add a Command Line task to get files from git repo. Detail steps as below:
Create alternate authentication credentials
In alternate authentication credentials page (https://account.visualstudio.com/_details/security/altcreds) -> Enable alternate authentication credentials -> specify secondary username and password -> Save.

Add a Command Line task in release definition
Tool:
git
Arguments:
clone https://second:password@account.visualstudio.com/project/_git/reponame foldername(use secondary username and password for credential)

Now all the files of the git repo are located in $(System.DefaultWorkingDirectory)foldername, and you can use the files from the directory.
You just need to add a Command Line task to get files from git repo. Detail steps as below:
Create alternate authentication credentials
In alternate authentication credentials page (https://account.visualstudio.com/_details/security/altcreds) -> Enable alternate authentication credentials -> specify secondary username and password -> Save.

Add a Command Line task in release definition
Tool:
git
Arguments:
clone https://second:password@account.visualstudio.com/project/_git/reponame foldername(use secondary username and password for credential)

Now all the files of the git repo are located in $(System.DefaultWorkingDirectory)foldername, and you can use the files from the directory.
answered Dec 4 '17 at 8:11
Marina Liu - MSFTMarina Liu - MSFT
23.1k21830
23.1k21830
add a comment |
add a comment |
There are some ways we can reach to repo assets.
Use Build Definition to checkout repo
Inside Build definition, publish file/source as artifact. Then using that artifacts as input of Release defininition.
Use Repo as input artiface
At pipeline view of Release definition, config artifact value of Release definition. For example: Chose Azure Repository type
Add additional step that checkout repo in Release definition:
It's simply a command line call using Git clone. Command line call maybe kind of Batch Script task, PowerShell task, etc..
add a comment |
There are some ways we can reach to repo assets.
Use Build Definition to checkout repo
Inside Build definition, publish file/source as artifact. Then using that artifacts as input of Release defininition.
Use Repo as input artiface
At pipeline view of Release definition, config artifact value of Release definition. For example: Chose Azure Repository type
Add additional step that checkout repo in Release definition:
It's simply a command line call using Git clone. Command line call maybe kind of Batch Script task, PowerShell task, etc..
add a comment |
There are some ways we can reach to repo assets.
Use Build Definition to checkout repo
Inside Build definition, publish file/source as artifact. Then using that artifacts as input of Release defininition.
Use Repo as input artiface
At pipeline view of Release definition, config artifact value of Release definition. For example: Chose Azure Repository type
Add additional step that checkout repo in Release definition:
It's simply a command line call using Git clone. Command line call maybe kind of Batch Script task, PowerShell task, etc..
There are some ways we can reach to repo assets.
Use Build Definition to checkout repo
Inside Build definition, publish file/source as artifact. Then using that artifacts as input of Release defininition.
Use Repo as input artiface
At pipeline view of Release definition, config artifact value of Release definition. For example: Chose Azure Repository type
Add additional step that checkout repo in Release definition:
It's simply a command line call using Git clone. Command line call maybe kind of Batch Script task, PowerShell task, etc..
edited Nov 13 '18 at 9:50
answered Nov 13 '18 at 9:43
kansazkansaz
315
315
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f47573072%2fhow-to-access-files-in-vsts-source-repo-at-the-time-of-release-definition%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Would you consider publishing those scripts as a package to Package Manager and then downloading and extracting that package in the release? Is your Repo a GIT repo or TFVC repo?
– DenverDev
Nov 30 '17 at 17:33
I don't want to publish from the build definition. I want to use the scripts at the time of release definition. How can I use or access those scripts?
– PRAVEEN
Dec 1 '17 at 2:06
What's the version control system do you use to manage the source file, is it Git?
– Marina Liu - MSFT
Dec 1 '17 at 2:11
My source code is in VSTS REPO
– PRAVEEN
Dec 1 '17 at 2:40
There are two VCS for VSTS: Git and TFVC. The solution should be different for your question based on which VCS you are use. So please add a screen shot for your VSTS project Code Tab.
– Marina Liu - MSFT
Dec 1 '17 at 2:48