Skip to content

Commit 0e240e4

Browse files
committed
skip deb and rpm publish if release is frozen
related to microsoft#26363
1 parent 8203121 commit 0e240e4

3 files changed

Lines changed: 48 additions & 1 deletion

File tree

build/tfs/linux/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
pat
1+
pat
2+
*.js

build/tfs/linux/frozen-check.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
'use strict';
7+
8+
import { DocumentClient } from 'documentdb';
9+
10+
interface Config {
11+
id: string;
12+
frozen: boolean;
13+
}
14+
15+
function createDefaultConfig(quality: string): Config {
16+
return {
17+
id: quality,
18+
frozen: false
19+
};
20+
}
21+
22+
function getConfig(quality: string): Promise<Config> {
23+
const client = new DocumentClient(process.env['AZURE_DOCUMENTDB_ENDPOINT'], { masterKey: process.env['AZURE_DOCUMENTDB_MASTERKEY'] });
24+
const collection = 'dbs/builds/colls/config';
25+
const query = {
26+
query: `SELECT TOP 1 * FROM c WHERE c.id = @quality`,
27+
parameters: [
28+
{ name: '@quality', value: quality }
29+
]
30+
};
31+
32+
return new Promise<Config>((c, e) => {
33+
client.queryDocuments(collection, query).toArray((err, results) => {
34+
if (err && err.code !== 409) { return e(err); }
35+
36+
c(!results || results.length === 0 ? createDefaultConfig(quality) : results[0] as any as Config);
37+
});
38+
});
39+
}
40+
41+
getConfig(process.argv[2])
42+
.then(c => console.log(c.frozen), e => console.error(e));

build/tfs/linux/release.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,12 @@ step "Publish RPM package" \
5555
# SNAP_FILENAME="$(ls $REPO/.build/linux/snap/$ARCH/ | grep .snap)"
5656
# SNAP_PATH="$REPO/.build/linux/snap/$ARCH/$SNAP_FILENAME"
5757

58+
IS_FROZEN="$(node build/tfs/linux/frozen-check.js $VSCODE_QUALITY)"
59+
5860
if [ -z "$VSCODE_QUALITY" ]; then
5961
echo "VSCODE_QUALITY is not set, skipping repo package publish"
62+
elif [ "$IS_FROZEN" = "true" ]; then
63+
echo "$VSCODE_QUALITY is frozen, skipping repo package publish"
6064
else
6165
if [ "$BUILD_SOURCEBRANCH" = "master" ] || [ "$BUILD_SOURCEBRANCH" = "refs/heads/master" ]; then
6266
if [[ $BUILD_QUEUEDBY = *"Project Collection Service Accounts"* || $BUILD_QUEUEDBY = *"Microsoft.VisualStudio.Services.TFS"* ]]; then

0 commit comments

Comments
 (0)