Skip to content

Commit dd49cab

Browse files
authored
Update marketplace pipelines (#145)
* obtain marketplace accesstoken * update share-marketplace-extension --------- Co-authored-by: bryan cook <3217452+bryancook@users.noreply.github.com>
1 parent 33c034b commit dd49cab

3 files changed

Lines changed: 23 additions & 3 deletions

File tree

devops/pipelines/marketplace-extension/pipeline.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ jobs:
9191
version: 'v0.x'
9292
checkLatest: true
9393

94+
- template: /devops/steps/obtain-marketplace-accesstoken.yml
95+
9496
# fetch the current extension version
9597
# You must build and upload manually for the first execution
9698
# specify the Extension.VersionOverride variable at queue time to override this value
@@ -99,7 +101,7 @@ jobs:
99101
name: Query
100102
inputs:
101103
connectTo: 'VsTeam'
102-
connectedServiceName: 'AzureDevOpsMarketplace'
104+
connectedServiceName: '$(MarketplaceServiceConnection)'
103105
publisherId: '$(PublisherID)'
104106
extensionId: '$(ExtensionID)'
105107
versionAction: 'Patch'
@@ -125,7 +127,7 @@ jobs:
125127
condition: eq('${{ parameters.publishExtension}}', 'true')
126128
inputs:
127129
connectTo: 'VsTeam'
128-
connectedServiceName: 'AzureDevOpsMarketplace'
130+
connectedServiceName: '$(MarketplaceServiceConnection)'
129131
fileType: 'vsix'
130132
vsixFile: '$(Build.ArtifactStagingDirectory)/*.vsix'
131133
publisherId: '$(PublisherID)'

devops/pipelines/share-marketplace-extension/pipeline.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@ steps:
2424
version: 'v0.x'
2525
checkLatest: true
2626

27+
- template: /devops/steps/obtain-marketplace-accesstoken.yml
28+
2729
# share the extension
2830
# --share-with only adds new organizations, existing orgs are untouched
2931
- task: ShareAzureDevOpsExtension@5
3032
displayName: 'Share Extension with Organization'
3133
inputs:
3234
connectTo: 'VsTeam'
33-
connectedServiceName: 'AzureDevOpsMarketplace'
35+
connectedServiceName: '$(MarketplaceServiceConnection)'
3436
method: 'id'
3537
publisherId: '$(PublisherID)'
3638
extensionId: '$(ExtensionID)'
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# uses $(MarketplaceServiceConnection) stored in pipeline-extension-settings variable group. This is the ID of the service connection
2+
3+
4+
steps:
5+
- task: AzureCLI@2
6+
displayName: 'Obtain Access Token for Marketplace API'
7+
inputs:
8+
azureSubscription: 'azure-devops-marketplace'
9+
scriptType: 'pscore'
10+
scriptLocation: 'inlineScript'
11+
useGlobalConfig: true
12+
inlineScript: |
13+
$accessToken = az account get-access-token --resource 499b84ac-1321-427f-aa17-267ca6975798 --query "accessToken" --output tsv
14+
write-host "##vso[task.setsecret]$accessToken"
15+
write-host "##vso[task.setendpoint id=$env:MARKETPLACESERVICECONNECTION;field=authParameter;key=password]$accessToken"
16+

0 commit comments

Comments
 (0)