Skip to content

Commit 3b95d19

Browse files
authored
Add gulp build --test (#1276)
* Add gulp build --test Added --test argument to gulp build command * Update name of the extension for test build * Update extnsions categories to new standard * Final update for azure pipeline with tests stages * Improve build time by merging stages * Bump iis version * Bump ansible version for tests * Commented out test stage * Bump circle ci * Bump iis version * Remove gulp clean from the build pipeline * Replace notifyUsers * Bump ansible version * Cleanup yaml
1 parent 26d6374 commit 3b95d19

File tree

8 files changed

+274
-86
lines changed

8 files changed

+274
-86
lines changed

.pipelines/1es-migration/azure-pipelines.yml

Lines changed: 185 additions & 76 deletions
Large diffs are not rendered by default.

Extensions/Ansible/Src/vss-extension.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"id": "vss-services-ansible",
44
"name": "Ansible",
55
"publisher": "ms-vscs-rm",
6-
"version": "0.258.1",
6+
"version": "0.261.2",
77
"public": true,
88
"description": "This extension executes an Ansible playbook using a specified inventory via command line interface",
99
"_description.comment": "The below format to define extensions is currently in preview and may change in future.",

Extensions/AzureExp/Src/vss-extension.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"description": "Azure Exp feature rollout",
88
"public": false,
99
"categories": [
10-
"Build and release"
10+
"Azure Pipelines"
1111
],
1212
"files": [
1313
{

Extensions/BitBucket/Src/vss-extension.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"public": true,
88
"description": "Tools related to connecting with Bitbucket",
99
"_description.comment": "The below format to define artifact extensions is currently in preview and may change in future.",
10-
"categories": [ "Integrate" ],
10+
"categories": [ "Azure Pipelines" ],
1111
"Tags": [ "Bitbucket", "Release", "DevOps", "Artifacts" ],
1212
"targets": [
1313
{

Extensions/CircleCI/Src/vss-extension.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
"id": "vss-services-circleci-extension",
44
"name": "CircleCI artifacts for Release Pipeline",
55
"publisher": "ms-vscs-rm",
6-
"version": "0.258.0",
6+
"version": "0.261.0",
77
"public": true,
88
"description": "Tool for connecting with CircleCI",
99
"_description.comment": "The below format to define artifact extensions is currently in preview and may change in future.",
10-
"categories": [ "Build and release", "Azure pipelines" ],
10+
"categories": [ "Azure Pipelines" ],
1111
"Tags": [ "CircleCI", "Release", "DevOps", "Artifacts", "Pipelines" ],
1212
"targets": [
1313
{

Extensions/ExternalTfs/Src/vss-extension.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"description": "Deploy external TFS/ Azure DevOps artifacts using Release Management",
88
"_description.comment": "The below format to define artifact extensions is currently in preview and may change in future.",
99
"public": true,
10-
"categories": [ "Build and release" ],
10+
"categories": [ "Azure Pipelines" ],
1111
"tags": [ "Artifacts", "DevOps", "Release" ],
1212
"targets": [
1313
{

Extensions/IISWebAppDeploy/Src/vss-extension.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"manifestVersion": 1,
33
"extensionId": "iiswebapp",
44
"name": "IIS Web App Deployment Using WinRM",
5-
"version": "1.258.0",
5+
"version": "1.261.1",
66
"publisher": "ms-vscs-rm",
77
"description": "Using WinRM connect to the host Computer, to deploy a Web project using Web Deploy or a SQL DB using sqlpackage.exe.",
88
"public": true,
@@ -11,7 +11,7 @@
1111
"large": "images/IIS_Web_App_Large.png"
1212
},
1313
"categories": [
14-
"Build and release"
14+
"Azure Pipelines"
1515
],
1616
"tags": [ ],
1717
"links": {

gulpfile.js

Lines changed: 81 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ gulp.task("TaskModuleTest", gulp.series('copy:TaskModuleTest', function() {
160160
}));
161161

162162
gulp.task('prepublish:TaskModulePublish', function (done) {
163-
return del([TaskModulesTestRoot], done);
163+
return del([TaskModulesTestRoot], done);
164164
});
165165

166166
gulp.task('TaskModulePublish', gulp.series('prepublish:TaskModulePublish', function (done) {
@@ -651,7 +651,86 @@ function compileUIExtensions(extensionRoot) {
651651
};
652652
}
653653

654-
gulp.task("build", gulp.series("compileNode"));
654+
gulp.task("updateTestIds", function(cb) {
655+
if (args.test) {
656+
var buildExtensionsRoot = path.join(_buildRoot, 'Extensions');
657+
if (fs.existsSync(buildExtensionsRoot)) {
658+
var extensionDirs = fs.readdirSync(buildExtensionsRoot).filter(function (file) {
659+
return fs.statSync(path.join(buildExtensionsRoot, file)).isDirectory();
660+
});
661+
extensionDirs.forEach(function (extName) {
662+
// Check multiple possible locations for vss-extension.json
663+
var possiblePaths = [
664+
path.join(buildExtensionsRoot, extName, 'Src', 'vss-extension.json'),
665+
path.join(buildExtensionsRoot, extName, 'src', 'vss-extension.json'),
666+
path.join(buildExtensionsRoot, extName, 'vss-extension.json')
667+
];
668+
669+
var manifestPath = null;
670+
for (var i = 0; i < possiblePaths.length; i++) {
671+
if (fs.existsSync(possiblePaths[i])) {
672+
manifestPath = possiblePaths[i];
673+
break;
674+
}
675+
}
676+
677+
if (manifestPath) {
678+
try {
679+
// Read file and handle potential BOM
680+
var fileContent = fs.readFileSync(manifestPath, 'utf8');
681+
// Remove BOM if present
682+
if (fileContent.charCodeAt(0) === 0xFEFF) {
683+
fileContent = fileContent.slice(1);
684+
}
685+
686+
var manifest = JSON.parse(fileContent);
687+
var updated = false;
688+
689+
// Check for both 'id' and 'extensionId' properties
690+
var idProperty = manifest.id ? 'id' : (manifest.extensionId ? 'extensionId' : null);
691+
692+
if (idProperty && manifest[idProperty] && !manifest[idProperty].endsWith('-test')) {
693+
manifest[idProperty] = manifest[idProperty] + '-test';
694+
updated = true;
695+
}
696+
697+
// Update name property
698+
if (manifest.hasOwnProperty('name')) {
699+
manifest.name = `${manifest.name} (Test)`;
700+
}
701+
702+
// Always set public to false if it exists
703+
if (manifest.hasOwnProperty('public') && manifest.public !== false) {
704+
manifest.public = false;
705+
updated = true;
706+
} else if (!manifest.hasOwnProperty('public')) {
707+
// Add public: false if it doesn't exist
708+
manifest.public = false;
709+
updated = true;
710+
}
711+
712+
if (updated) {
713+
// Write back without BOM
714+
fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2));
715+
console.log('Updated manifest for test build: ' + manifestPath);
716+
console.log(' - ' + idProperty + ': ' + manifest[idProperty]);
717+
console.log(' - Public: ' + manifest.public);
718+
} else if (idProperty && manifest[idProperty].endsWith('-test')) {
719+
console.log('Extension already has -test suffix: ' + manifestPath);
720+
}
721+
} catch (e) {
722+
console.error('Failed to update manifest: ' + manifestPath + ' - ' + e.message);
723+
}
724+
} else {
725+
console.log('No vss-extension.json found for extension: ' + extName);
726+
}
727+
});
728+
}
729+
}
730+
cb();
731+
});
732+
733+
gulp.task("build", gulp.series("compileNode", "updateTestIds"));
655734

656735
gulp.task("handoff", function(cb) {
657736
handoff(cb);

0 commit comments

Comments
 (0)