Pompano Beach : gitlab devops - Kabrinskiy Eduard

Поздравляем! Ваш новый форум создан.
Самое время войти на Ваш форум под зарегистрированным именем и затем войти в "административный раздел" (ссылка внизу), чтобы настроить форум по своему вкусу.
Miamineem
Сообщения: 2
Зарегистрирован: 13 июн 2020, 17:50
Откуда: USA http://remmont.com/la-donazione-tutto-sulla-donazione/
Контактная информация:

Pompano Beach : gitlab devops - Kabrinskiy Eduard

Сообщение Miamineem » 23 май 2021, 05:08

Eduard Kabrinskiy - Vsts artifacts - Кабринский Эдуард


<h1>Vsts artifacts</h1>
<p>[youtube]</p>
Vsts artifacts <a href="http://remmont.com">Current breaking news</a> Vsts artifacts
<h1>Vsts artifacts</h1>
<p style="clear: both"><img src="https://i1.social.s-msft.com/globalresources/Images/trans.gif" /></p>
<h3>Question</h3>
<p style="clear: both"><img src="https://i1.social.s-msft.com/globalresources/Images/trans.gif" /></p>
<p style="clear: both"><img src="https://i1.social.s-msft.com/globalresources/Images/trans.gif" /></p>
<p>I am starting to work with Visual Studio Online and I love it.</p>
<p>I managed to put my entire build on it with minimal effort.</p>
<p>I am looking for a powershell script that downloads the artifact from the latest build.</p>
<p>I saw something with rest methods but to me that is unclear</p>
<p>So far I got this :</p>
<p>Add-Type -AssemblyName System.IO.Compression.FileSystem <br />$mysite = "mysite" <br />$myproject = "myfirstproject" <br />$mybuild = "testbuild" # not really needed anymore <br />$buildid = "3" # you can find this one in the browser link <br />$destination = "c:\temp\drop.zip" <br />$outpath = "c:\temp\unzip"</p>
<p>$source = "https://"+ $mysite + ".visualstudio.com/DefaultCollection/" +$myproject + "/_build#definitionId=" + $buildid + "&_a=completed" <br />echo $source</p>
<p># download the file <br />Invoke-WebRequest $source -OutFile $destination</p>
<p>#unzip the file <br />Remove-Item -Recurse -Force $outpath <br />#[System.IO.Compression.ZipFile]::ExtractToDirectory($destination, $outpath)</p>
<p>Any ideas or help please ?</p>
<h3>Answers</h3>
<p style="clear: both"><img src="https://i1.social.s-msft.com/globalresources/Images/trans.gif" /></p>
<p style="clear: both"><img src="https://i1.social.s-msft.com/globalresources/Images/trans.gif" /></p>
<p>I would request you to refer the link it may provide you the information about REST API and other way to integrated and extend Visual Studio ,TFS,Visual Studio Team Service. <br /></p>
<p>Here is the powershell Script to downloading Build Artifact using Power shell and REST API</p>
<p>param( <br />[Parameter(Mandatory=$True)] <br />[string]$buildDefinitionName, <br />[Parameter()] <br />[string]$artifactDestinationFolder = $Env:BUILD_STAGINGDIRECTORY, <br />[Parameter()] <br />[switch]$appendBuildNumberVersion = $false <br />) <br />Write-Verbose -Verbose ('buildDefinitionName: ' + $buildDefinitionName) <br />Write-Verbose -Verbose ('artifactDestinationFolder: ' + $artifactDestinationFolder) <br />Write-Verbose -Verbose ('appendBuildNumberVersion: ' + $appendBuildNumberVersion)</p>
<p>$tfsUrl = $Env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI + $Env:SYSTEM_TEAMPROJECT</p>
<p>$tfsGetLatestCompletedBuildUrl = $tfsUrl + '/_apis/build/builds?definitions=' + $buildDefinitionId + '&statusFilter=completed&resultFilter=succeeded&$top=1&api-version=2.0'</p>
<p>$builds = Invoke-RestMethod -Uri $tfsGetLatestCompletedBuildUrl -Method GET -UseDefaultCredentials <br />$buildId = ($builds.value).id;</p>
<p>if( $appendBuildNumberVersion) <br /> <<br />$buildNumber = ($builds.value).buildNumber <br />$versionRegex = "\d+\.\d+\.\d+\.\d+"</p>
<p># Get and validate the version data <br />$versionData = [regex]::matches($buildNumber,$versionRegex) <br />switch($versionData.Count) <br /> <<br />0 <br /> < <br />Write-Error "Could not find version number data in $buildNumber." <br />exit 1 <br />> <br />1 <> <br />default <br /> < <br />Write-Warning "Found more than instance of version data in buildNumber." <br />Write-Warning "Will assume first instance is version." <br />> <br />> <br />$buildVersionNumber = $versionData[0] <br />$newBuildNumber = $Env:BUILD_BUILDNUMBER + $buildVersionNumber <br />Write-Verbose -Verbose "Version: $newBuildNumber" <br />Write-Verbose -Verbose "##vso[build.updatebuildnumber]$newBuildNumber" <br />></p>
<p>$dropArchiveDestination = Join-path $artifactDestinationFolder "drop.zip"</p>
<p> <br />#build URI for buildNr <br />$buildArtifactsURI = $tfsURL + '/_apis/build/builds/' + $buildId + '/artifacts?api-version=2.0'</p>
<p>#get artifact downloadPath <br />$artifactURI = (Invoke-RestMethod -Uri $buildArtifactsURI -Method GET -UseDefaultCredentials).Value.Resource.downloadUrl</p>
<p>#download ZIP <br />Invoke-WebRequest -uri $artifactURI -OutFile $dropArchiveDestination -UseDefaultCredentials</p>
<p>#unzip <br />Add-Type -assembly 'system.io.compression.filesystem' <br />[io.compression.zipfile]::ExtractToDirectory($dropArchiveDestination, $artifactDestinationFolder)</p>
<p>Write-Verbose -Verbose ('Build artifacts extracted into ' + $Env:BUILD_STAGINGDIRECTORY)</p>
<h2>Vsts artifacts</h2>

<h3>Vsts artifacts</h3>
<p>[youtube]</p>
Vsts artifacts <a href="http://remmont.com">Recent news headlines</a> Vsts artifacts
<h4>Vsts artifacts</h4>
Vsts artifacts Question I am starting to work with Visual Studio Online and I love it. I managed to put my entire build on it with minimal effort. I am looking for a
<h5>Vsts artifacts</h5>
Vsts artifacts <a href="http://remmont.com">Vsts artifacts</a> Vsts artifacts
SOURCE: <h6>Vsts artifacts</h6> <a href="https://dev-ops.engineer/">Vsts artifacts</a> Vsts artifacts
#tags#[replace: -,-Vsts artifacts] Vsts artifacts#tags#

Эдуард Кабринский
breaking news
Перейти:  

Кто сейчас на конференции

Сейчас этот форум просматривают: нет зарегистрированных пользователей и 2 гостя

cron