Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azure-pipelines: Add web build task to package.yml #1591

Merged
merged 3 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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*
bwateratmsft marked this conversation as resolved.
Show resolved Hide resolved
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))