Skip to content

Commit

Permalink
Revert build folder update to fix it properly (microsoft#22981)
Browse files Browse the repository at this point in the history
* Revert "Disable publishing crash reports temporarily (microsoft#22950)"

This reverts commit 13a791d.

* Revert "Compile build folder (microsoft#22811)"

This reverts commit 2c07c09.
  • Loading branch information
cheenamalhotra authored May 5, 2023
1 parent 70e756b commit 9af7a04
Show file tree
Hide file tree
Showing 33 changed files with 1,467 additions and 1,482 deletions.
109 changes: 109 additions & 0 deletions build/azure-pipelines/common/release.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

'use strict';

import { DocumentClient } from 'documentdb';

interface Config {
id: string;
frozen: boolean;
}

function createDefaultConfig(quality: string): Config {
return {
id: quality,
frozen: false
};
}

function getConfig(quality: string): Promise<Config> {
const client = new DocumentClient(process.env['AZURE_DOCUMENTDB_ENDPOINT']!, { masterKey: process.env['AZURE_DOCUMENTDB_MASTERKEY'] });
const collection = 'dbs/builds/colls/config';
const query = {
query: `SELECT TOP 1 * FROM c WHERE c.id = @quality`,
parameters: [
{ name: '@quality', value: quality }
]
};

return new Promise<Config>((c, e) => {
client.queryDocuments(collection, query).toArray((err, results) => {
if (err && err.code !== 409) { return e(err); }

c(!results || results.length === 0 ? createDefaultConfig(quality) : results[0] as any as Config);
});
});
}

function doRelease(commit: string, quality: string): Promise<void> {
const client = new DocumentClient(process.env['AZURE_DOCUMENTDB_ENDPOINT']!, { masterKey: process.env['AZURE_DOCUMENTDB_MASTERKEY'] });
const collection = 'dbs/builds/colls/' + quality;
const query = {
query: 'SELECT TOP 1 * FROM c WHERE c.id = @id',
parameters: [{ name: '@id', value: commit }]
};

let updateTries = 0;

function update(): Promise<void> {
updateTries++;

return new Promise<void>((c, e) => {
client.queryDocuments(collection, query).toArray((err, results) => {
if (err) { return e(err); }
if (results.length !== 1) { return e(new Error('No documents')); }

const release = results[0];
release.isReleased = true;

client.replaceDocument(release._self, release, err => {
if (err && err.code === 409 && updateTries < 5) { return c(update()); }
if (err) { return e(err); }

console.log('Build successfully updated.');
c();
});
});
});
}

return update();
}

async function release(commit: string, quality: string): Promise<void> {
const config = await getConfig(quality);

console.log('Quality config:', config);

if (config.frozen) {
console.log(`Skipping release because quality ${quality} is frozen.`);
return;
}

await doRelease(commit, quality);
}

function env(name: string): string {
const result = process.env[name];

if (!result) {
throw new Error(`Skipping release due to missing env: ${name}`);
}

return result;
}

async function main(): Promise<void> {
const commit = env('BUILD_SOURCEVERSION');
const quality = env('VSCODE_QUALITY');

await release(commit, quality);
}

main().catch(err => {
console.error(err);
process.exit(1);
});
81 changes: 40 additions & 41 deletions build/azure-pipelines/linux/sql-product-build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,21 +123,20 @@ steps:
displayName: Run core unit tests
condition: and(succeeded(), eq(variables['RUN_TESTS'], 'true'), ne(variables['EXTENSIONS_ONLY'], 'true'))
# {{SQL CARBON EDIT}} - Reenable "Run core integration tests" step
# - script: |
# # Figure out the full absolute path of the product we just built
# # including the remote server and configure the integration tests
# # to run with these builds instead of running out of sources.
# set -e
# APP_ROOT=$(agent.builddirectory)/azuredatastudio-linux-x64
# APP_NAME=$(node -p "require(\"$APP_ROOT/resources/app/product.json\").applicationName")
# INTEGRATION_TEST_ELECTRON_PATH="$APP_ROOT/$APP_NAME" \
# VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/azuredatastudio-reh-linux-x64" \
# DISPLAY=:10 ./scripts/test-integration.sh --build --tfs "Integration Tests"
# displayName: Run core integration tests
# condition: and(succeeded(), eq(variables['RUN_TESTS'], 'true'), ne(variables['EXTENSIONS_ONLY'], 'true'))
- script: |
# Figure out the full absolute path of the product we just built
# including the remote server and configure the integration tests
# to run with these builds instead of running out of sources.
set -e
APP_ROOT=$(agent.builddirectory)/azuredatastudio-linux-x64
APP_NAME=$(node -p "require(\"$APP_ROOT/resources/app/product.json\").applicationName")
INTEGRATION_TEST_ELECTRON_PATH="$APP_ROOT/$APP_NAME" \
VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/azuredatastudio-reh-linux-x64" \
DISPLAY=:10 ./scripts/test-integration.sh --build --tfs "Integration Tests"
displayName: Run core integration tests
condition: and(succeeded(), eq(variables['RUN_TESTS'], 'true'), ne(variables['EXTENSIONS_ONLY'], 'true'))
# {{SQL CARBON TODO}} Reenable "Run Extension Unit Tests (Continue on Error)" and "Run Extension Unit Tests (Fail on Error)" and "Archive Logs" and "Copy Coverage"
# {{SQL CARBON TODO}} Reenable "Run Extension Unit Tests (Continue on Error)" and "Run Extension Unit Tests (Fail on Error)" and "Archive Logs"
# - script: |
# # Figure out the full absolute path of the product we just built
# # including the remote server and configure the unit tests
Expand Down Expand Up @@ -181,11 +180,12 @@ steps:
# continueOnError: true
# condition: and(succeeded(), eq(variables['RUN_TESTS'], 'true'))

- script: |
set -e
yarn gulp vscode-linux-x64-build-deb
displayName: Build Deb
condition: and(succeeded(), ne(variables['EXTENSIONS_ONLY'], 'true'))
# {{SQL CARBON TODO}} - Reenable
# - script: |
# set -e
# yarn gulp vscode-linux-x64-build-deb
# displayName: Build Deb
# condition: and(succeeded(), ne(variables['EXTENSIONS_ONLY'], 'true'))

- script: |
set -e
Expand Down Expand Up @@ -237,29 +237,28 @@ steps:
./build/azure-pipelines/linux/createDrop.sh
displayName: Create Drop
# {{SQL CARBON TODO}} Reenable "Run Extension Unit Tests (Continue on Error)" and "Run Extension Unit Tests (Fail on Error)" and "Archive Logs" and "Copy Coverage" and "Publish test results/crash reports"
# - script: |
# set -e
# shopt -s globstar
# mkdir -p $(Build.ArtifactStagingDirectory)/test-results/coverage
# cp --parents -r $(Build.SourcesDirectory)/extensions/*/coverage/** $(Build.ArtifactStagingDirectory)/test-results/coverage
# displayName: Copy Coverage
# condition: and(succeeded(), eq(variables['RUN_TESTS'], 'true'))
- script: |
set -e
shopt -s globstar
mkdir -p $(Build.ArtifactStagingDirectory)/test-results/coverage
cp --parents -r $(Build.SourcesDirectory)/extensions/*/coverage/** $(Build.ArtifactStagingDirectory)/test-results/coverage
displayName: Copy Coverage
condition: and(succeeded(), eq(variables['RUN_TESTS'], 'true'))
# - task: PublishTestResults@2
# displayName: 'Publish Test Results test-results.xml'
# inputs:
# testResultsFiles: '*.xml'
# searchFolder: '$(Build.ArtifactStagingDirectory)/test-results'
# continueOnError: true
# condition: and(succeededOrFailed(), eq(variables['RUN_TESTS'], 'true'))

# - task: PublishBuildArtifacts@1
# displayName: 'Publish Artifact: crash reports'
# inputs:
# PathtoPublish: '$(Build.SourcesDirectory)/.build/crashes'
# ArtifactName: crashes
# condition: and(succeededOrFailed(), eq(variables['RUN_TESTS'], 'true'))
- task: PublishTestResults@2
displayName: 'Publish Test Results test-results.xml'
inputs:
testResultsFiles: '*.xml'
searchFolder: '$(Build.ArtifactStagingDirectory)/test-results'
continueOnError: true
condition: and(succeededOrFailed(), eq(variables['RUN_TESTS'], 'true'))

- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: crash reports'
inputs:
PathtoPublish: '$(Build.SourcesDirectory)/.build/crashes'
ArtifactName: crashes
condition: and(succeededOrFailed(), eq(variables['RUN_TESTS'], 'true'))

- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'
Expand Down
16 changes: 8 additions & 8 deletions build/azure-pipelines/linux/sql-publish.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ If (-NOT ($Quality -eq "stable")) {
node $sourcesDir\build\azure-pipelines\common\publish.js $Quality $PlatformLinux archive-unsigned "$TarballUploadName.tar.gz" $Version true $TarballPath $CommitId

# Publish DEB
$PlatformDeb = "linux-deb-$Arch"
$DebFilename = "$(Get-ChildItem -File -Name $artifactsDir\linux\deb\amd64\deb\*.deb)"
$DebPath = "$artifactsDir\linux\deb\amd64\deb\$DebFilename"
$DebUploadName = "azuredatastudio-linux-$Version"
# $PlatformDeb = "linux-deb-$Arch"
# $DebFilename = "$(Get-ChildItem -File -Name $artifactsDir\linux\deb\amd64\deb\*.deb)"
# $DebPath = "$artifactsDir\linux\deb\amd64\deb\$DebFilename"
# $DebUploadName = "azuredatastudio-linux-$Version"

If (-NOT ($Quality -eq "stable")) {
$DebUploadName = "$DebUploadName-$Quality"
}
# If (-NOT ($Quality -eq "stable")) {
# $DebUploadName = "$DebUploadName-$Quality"
# }

node $sourcesDir\build\azure-pipelines\common\publish.js $Quality $PlatformDeb package "$DebUploadName.deb" $Version true $DebPath $CommitId
# node $sourcesDir\build\azure-pipelines\common\publish.js $Quality $PlatformDeb package "$DebUploadName.deb" $Version true $DebPath $CommitId

# Publish RPM
$PlatformRpm = "linux-rpm-$Arch"
Expand Down
8 changes: 4 additions & 4 deletions build/lib/compilation.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use strict";
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
exports.watchApiProposalNamesTask = exports.compileApiProposalNamesTask = exports.watchTask = exports.compileTask = exports.transpileTask = void 0;
const es = require("event-stream");
Expand Down Expand Up @@ -52,7 +52,7 @@ function createCompile(src, build, emitError, transpileOnly) {
console.warn('* and re-run the build/watch task *');
console.warn('********************************************************************************************');
}
const compilation = tsb.create(projectPath, overrideOptions, { verbose: false }, err => reporter(err));
const compilation = tsb.create(projectPath, overrideOptions, false, err => reporter(err));
function pipeline(token) {
const bom = require('gulp-bom');
const utf8Filter = util.filter(data => /(\/|\\)test(\/|\\).*utf8/.test(data.path));
Expand Down Expand Up @@ -204,7 +204,7 @@ function generateApiProposalNames() {
const match = /\r?\n/m.exec(src);
eol = match ? match[0] : os.EOL;
}
catch (_a) {
catch {
eol = os.EOL;
}
const pattern = /vscode\.proposed\.([a-zA-Z]+)\.d\.ts$/;
Expand Down
2 changes: 1 addition & 1 deletion build/lib/compilation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function createCompile(src: string, build: boolean, emitError: boolean, transpil
}


const compilation = tsb.create(projectPath, overrideOptions, { verbose: false }, err => reporter(err));
const compilation = tsb.create(projectPath, overrideOptions, false, err => reporter(err));

function pipeline(token?: util.ICancellationToken) {
const bom = require('gulp-bom') as typeof import('gulp-bom');
Expand Down
2 changes: 1 addition & 1 deletion build/lib/eslint/vscode-dts-event-naming.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ module.exports = new (_a = class ApiEventNaming {
if (def.type === experimental_utils_1.AST_NODE_TYPES.Identifier) {
return def;
}
else if ((def.type === experimental_utils_1.AST_NODE_TYPES.TSPropertySignature || def.type === experimental_utils_1.AST_NODE_TYPES.Property) && def.key.type === experimental_utils_1.AST_NODE_TYPES.Identifier) {
else if ((def.type === experimental_utils_1.AST_NODE_TYPES.TSPropertySignature || def.type === experimental_utils_1.AST_NODE_TYPES.PropertyDefinition) && def.key.type === experimental_utils_1.AST_NODE_TYPES.Identifier) {
return def.key;
}
return this.getIdent(def.parent);
Expand Down
2 changes: 1 addition & 1 deletion build/lib/eslint/vscode-dts-event-naming.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export = new class ApiEventNaming implements eslint.Rule.RuleModule {

if (def.type === AST_NODE_TYPES.Identifier) {
return def;
} else if ((def.type === AST_NODE_TYPES.TSPropertySignature || def.type === AST_NODE_TYPES.Property) && def.key.type === AST_NODE_TYPES.Identifier) {
} else if ((def.type === AST_NODE_TYPES.TSPropertySignature || def.type === AST_NODE_TYPES.PropertyDefinition) && def.key.type === AST_NODE_TYPES.Identifier) {
return def.key;
}

Expand Down
Loading

0 comments on commit 9af7a04

Please sign in to comment.