Skip to content

Commit

Permalink
azure-pipelines: Add web build task to package.yml (#1591)
Browse files Browse the repository at this point in the history
* Add web build task to package.yml

* Copy web to artifacts staging

* random nothing-burger change to PR-checks will pass (why did we check-in broken PR checks???)

---------

Co-authored-by: Matthew Rayermann <[email protected]>
  • Loading branch information
nturinski and MRayermannMSFT authored Sep 20, 2023
1 parent 2a6b60a commit f83e42a
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 5 deletions.
1 change: 0 additions & 1 deletion appsettings/src/IAppSettingsClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export interface AppSettingsClientProvider {
}

export interface IAppSettingsClient {

fullName: string;

isLinux: boolean;
Expand Down
69 changes: 65 additions & 4 deletions azure-pipelines/templates/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,79 @@ steps:
workingDir: $(working_directory)

- task: CopyFiles@2
displayName: "Copy package to staging directory"
displayName: "Copy packages and vsix to staging directory"
inputs:
Contents: |
**/*.vsix
**/*.tar.gz
**/*.tgz
TargetFolder: "$(build.artifactstagingdirectory)"
TargetFolder: "$(build.artifactstagingdirectory)/build"
condition: and(eq(variables['Agent.OS'], 'Linux'), ne(variables['System.PullRequest.IsFork'], 'True'))

- task: PublishBuildArtifacts@1
displayName: "Publish artifacts: package"
displayName: "Publish artifacts: packages and vsix"
inputs:
PathtoPublish: "$(build.artifactstagingdirectory)"
PathtoPublish: "$(build.artifactstagingdirectory)/build"
ArtifactName: $(artifact_name)
condition: and(eq(variables['Agent.OS'], 'Linux'), ne(variables['System.PullRequest.IsFork'], 'True'))

- task: CopyFiles@2
displayName: "Copy web to staging directory"
inputs:
Contents: |
dist/web/*.js*
package.json
package.nls.json
resources/**
TargetFolder: "$(build.artifactstagingdirectory)/web"
condition: and(eq(variables['Agent.OS'], 'Windows_NT'), ne(variables['System.PullRequest.IsFork'], 'True'), eq(variables['WEB_BUILDS_ENABLED'], true))

- task: AzureFileCopy@4
# If AzureFileCopy ever supports not using account keys we should consider making use of it.
# If we do, we should also consider moving to user delegatation SAS in the generate SAS step.
# See: https://github.com/microsoft/azure-pipelines-tasks/issues/15610
displayName: "Upload web to blob storage"
inputs:
SourcePath: "$(build.artifactstagingdirectory)/web/*"
# This is a service connection for the ADO project. Can be managed under ADO project settings.
azureSubscription: ms-azuretools-vscode-dot-dev-connection
Destination: AzureBlob
storage: $(WEB_BUILDS_STG_ACCT)
ContainerName: $(WEB_BUILDS_CONTAINER)
BlobPrefix: "$(build.definitionname)/$(build.buildnumber)"
# Only do steps for publishing web bits on Windows as AzureFileCopy is only supported on Windows
# See: https://github.com/microsoft/azure-pipelines-tasks/issues/8920
condition: and(eq(variables['Agent.OS'], 'Windows_NT'), ne(variables['System.PullRequest.IsFork'], 'True'), eq(variables['WEB_BUILDS_ENABLED'], true))

- task: AzureCLI@2
displayName: "Generate SAS to web"
inputs:
# This is a service connection for the ADO project. Can be managed under ADO project settings.
azureSubscription: ms-azuretools-vscode-dot-dev-connection
scriptType: "ps"
scriptLocation: "inlineScript"
inlineScript: |
$sasToken = az storage container generate-sas `
--account-name $(WEB_BUILDS_STG_ACCT) `
--name $(WEB_BUILDS_CONTAINER) `
--permissions r `
--expiry ((Get-Date).AddDays(30)).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssK") `
--auth-mode key `
--out tsv
# Replace all % with %25 so vscode.dev does not re-encode the URL thus breaking it.
$sasToken = $sasToken -replace ("%", "%25")
$extensionRootUrl = "https://$(WEB_BUILDS_STG_ACCT).blob.core.windows.net/$(WEB_BUILDS_CONTAINER)/$(build.definitionname)/$(build.buildnumber)/?" + $sasToken
$extensionRootUrl | Out-File -FilePath '$(build.artifactstagingdirectory)/web-sas.txt'
echo $extensionRootUrl
# Only do steps for publishing web bits on Windows as AzureFileCopy is only supported on Windows
# See: https://github.com/microsoft/azure-pipelines-tasks/issues/8920
condition: and(eq(variables['Agent.OS'], 'Windows_NT'), ne(variables['System.PullRequest.IsFork'], 'True'), eq(variables['WEB_BUILDS_ENABLED'], true))

- task: PublishBuildArtifacts@1
displayName: "Publish artifacts: web-sas"
inputs:
PathtoPublish: "$(build.artifactstagingdirectory)/web-sas.txt"
ArtifactName: web-sas
# Only do steps for publishing web bits on Windows as AzureFileCopy is only supported on Windows
# See: https://github.com/microsoft/azure-pipelines-tasks/issues/8920
condition: and(eq(variables['Agent.OS'], 'Windows_NT'), ne(variables['System.PullRequest.IsFork'], 'True'), eq(variables['WEB_BUILDS_ENABLED'], true))

0 comments on commit f83e42a

Please sign in to comment.