CDN
CDN

Reputation: 410

Copy file from CI Pipeline to Azure Devops Repository

I am creating a pipeline and want to copy a file after being processed in the pipeline onto Azure devops reposirory. I used cURL to copy as per the setting below. But still can not copy.

What job can I use to copy files?

Setting of cURL

Upvotes: 2

Views: 5951

Answers (3)

CDN
CDN

Reputation: 410

@Leo Liu-MSFT Thanks you sir . I used this scrips and it ran .

git config --global user.email "[email protected]"
git config --global user.name "yourname"

git status

git checkout xxxbranch


git add $(Build.SourcesDirectory)/doc/Jsdoc.zip 
$(Build.SourcesDirectory)/doc/coverage.zip


git status

git commit -m "Latest JsDoc Version"

git push origin xxxbranch

Upvotes: 0

Leo Liu
Leo Liu

Reputation: 76996

Copy file from CI Pipeline to Azure Devops Repository

If your repo is git repo, you could use the git command line to commit and push the file back to the repo.

Details:

Add a command line task in the pipeline to use git command line to clone repo:

git config --global user.email "[email protected]"
git config --global user.name "Admin"

git clone <repo> <directory>

We use the copy task to copy the docs.zip file to the <directory> folder.

Then add a command line task to submit and push the changes to the repo:

git commit -m "Add docs.zip file"

git push -u origin master

Note: When you use git clone to clone the repo, you need to provide your certificate in your source link, usually using PAT:

enter image description here

The link looks like:

https://<OrganizationName>@dev.azure.com/<OrganizationName>/MyTestProject/_git/TestSample

Then we need to replace the first OrganizationName with PAT. So, it will be:

https://<PAT>@dev.azure.com/<OrganizationName>/MyTestProject/_git/TestSample

Hope this helps.

Upvotes: 3

michiel Thai
michiel Thai

Reputation: 597

What is the use case of this upload? An Azure Repo is meant for code storage not data. You could publish your files as an artifact and have a different pipeline to consume.

If it is for storage purposes I suggest using azure blob storage or something

Upvotes: 1

Related Questions