-
-
Notifications
You must be signed in to change notification settings - Fork 83
Overwrite featureId during packaging #909
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
base: main
Are you sure you want to change the base?
Conversation
const parts = constraint.properties.featureId.split("."); | ||
parts[1] = extensionId; | ||
const newFeatureId = parts.join("."); | ||
constraint.properties.featureId = newFeatureId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any cases where people opt into someone else's feature Id? Say, the Microsoft new Boards Hub feature?
I haven't personally used these IDs, so there might be cases that we must keep in mind.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And I suspect the publisher may also be overwritten here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like ideally we'd loop over the feature contributions and then only overwrite the ones that match the same name at least.
https://github.com/gustavobergamim/azdevops-pipeline-approval/blob/master/vss-extension.json#L62-L99
await updateExtensionManifestsTaskIds(manifestPaths, tasksIds); | ||
} | ||
|
||
if (extensionTag && updateFeatureConstraints) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if extensionId || extentionTag || publisherId
@@ -7,6 +7,7 @@ import { AzureRMEndpoint } from "azure-pipelines-tasks-azure-arm-rest/azure-arm- | |||
import fse from "fs-extra"; | |||
import uuidv5 from "uuidv5"; | |||
import tmp from "tmp"; | |||
import { forEach } from "core-js/core/array"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this?
const parts = constraint.properties.featureId.split("."); | ||
parts[1] = extensionId; | ||
const newFeatureId = parts.join("."); | ||
constraint.properties.featureId = newFeatureId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like ideally we'd loop over the feature contributions and then only overwrite the ones that match the same name at least.
https://github.com/gustavobergamim/azdevops-pipeline-approval/blob/master/vss-extension.json#L62-L99
Sorry i was busy this weekend, haven't found time for it. But it is on my
list to wrap things up and test it.
…On Mon, 10 Jun 2024, 16:34 Jesse Houwing, ***@***.***> wrote:
***@***.**** requested changes on this pull request.
------------------------------
In BuildTasks/Common/v5/Common.ts
<#909 (comment)>
:
> + }
+
+ const extensionTag = tl.getInput("extensionTag", false) || "";
+ const extensionId = `${(tl.getInput("extensionId", false) || manifest.id)}${extensionTag}`;
+
+ manifest.contributions
+ .filter((c: any) => c.constraints && c.constraints.length > 0)
+ .forEach((c: any) => {
+ c.constraints.forEach((constraint: any) => {
+ if (constraint.properties?.featureId) {
+ tl.debug(`Extension manifest featureId before: ${constraint.properties.featureId}`);
+
+ const parts = constraint.properties.featureId.split(".");
+ parts[1] = extensionId;
+ const newFeatureId = parts.join(".");
+ constraint.properties.featureId = newFeatureId;
Looks like ideally we'd loop over the feature contributions and then only
overwrite the ones that match the same name at least.
https://github.com/gustavobergamim/azdevops-pipeline-approval/blob/master/vss-extension.json#L62-L99
—
Reply to this email directly, view it on GitHub
<#909 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAXC456AP2HIL4HFUY6QDCDZGW2RBAVCNFSM6AAAAABIU46IHKVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDCMBXHE4DSMRVGE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***
com>
|
No problem! The release pipeline is still broken anyway ;). I was just exploring github how people were using features in the manifest to make sure this change won't break anyone. |
@mmajcica stil have plans to carry this forward, or shall we convert this to a draft PR for now? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new flag to update feature constraints during packaging and adjusts corresponding workflows and manifest updates.
- Added "updateFeatureConstraints" flag and associated edit method in VSIXEditor.
- Modified PublishExtension to pass through the new feature constraints update.
- Updated Common utilities with a new manifest update function for feature constraints.
Reviewed Changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
BuildTasks/PublishExtension/v5/vsixeditor.ts | Introduces new flag and method for updating feature constraints; conditional logic updated to include the new feature. |
BuildTasks/PublishExtension/v5/PublishExtension.ts | Reads and passes the new "updateFeatureConstraints" parameter to VSIXEditor. |
BuildTasks/Common/v5/Common.ts | Adds a new function to update feature IDs in extension manifests and renames an existing manifest update function. |
Files not reviewed (1)
- BuildTasks/PublishExtension/v5/task.json: Language not supported
if (this.versionNumber && this.updateTasksVersion || this.updateTasksId) { | ||
|
||
if (this.versionNumber && this.updateTasksVersion || this.updateTasksId || | ||
this.editIdTag && this.editUpdateFeatureConstraints) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The conditional block references 'this.editIdTag && this.editUpdateFeatureConstraints' which appears to be a mistake since there is no 'editUpdateFeatureConstraints' property; it is likely intended to use 'this.updateFeatureConstraints'.
this.editIdTag && this.editUpdateFeatureConstraints) { | |
this.editIdTag && this.updateFeatureConstraints) { |
Copilot uses AI. Check for mistakes.
@@ -378,6 +379,35 @@ function updateExtensionManifestTaskIds(manifest: any, originalTaskId: string, n | |||
return manifest; | |||
} | |||
|
|||
function updateExtensionManifestsFeatureConstrains(manifest: any): unknown { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function name 'updateExtensionManifestsFeatureConstrains' appears to be misspelled. Consider renaming it to 'updateExtensionManifestsFeatureConstraints' for clarity.
function updateExtensionManifestsFeatureConstrains(manifest: any): unknown { | |
function updateExtensionManifestsFeatureConstraints(manifest: any): unknown { |
Copilot uses AI. Check for mistakes.
await updateExtensionManifestsFeatureConstrains(manifestPaths); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function 'updateExtensionManifestsFeatureConstrains' is being passed 'manifestPaths' (an array) whereas it expects a manifest object. Consider iterating over 'manifestPaths' to load each manifest before processing.
await updateExtensionManifestsFeatureConstrains(manifestPaths); | |
} | |
for (const manifestPath of manifestPaths) { | |
const manifest = await getManifest(manifestPath); | |
await updateExtensionManifestsFeatureConstrains(manifest); | |
} |
Copilot uses AI. Check for mistakes.
In the contribution constraints, it is possible to reference the featureId's. FeatureId is composed of publisherId.extensionId.featureName. In case of extension tag being set, these fields do also need to be updated.
For further details check #172
This pull request introduces a new feature to update feature constraints in extension manifests and includes several related changes to the codebase. The most important updates involve adding the functionality to modify
featureId
properties in constraints, integrating this capability into the build and publish workflows, and updating the task configuration to support this feature.New Feature: Update Feature Constraints in Extension Manifests
updateExtensionManifestsFeatureConstrains
, to modifyfeatureId
properties in constraints within extension manifests. This function updates thefeatureId
to include the correct extension ID and tag. (BuildTasks/Common/v5/Common.ts
, BuildTasks/Common/v5/Common.tsR382-R410)Workflow Integration
updateManifests
function to include logic for updating feature constraints when the newupdateFeatureConstraints
input is enabled. (BuildTasks/Common/v5/Common.ts
, [1] [2]updateExtensionManifests
toupdateExtensionManifestsTaskIds
for clarity, as it now specifically handles task IDs. (BuildTasks/Common/v5/Common.ts
, BuildTasks/Common/v5/Common.tsL478-R520)Publish Task Enhancements
updateFeatureConstraints
, to the publish task configuration (task.json
). This input allows users to enable or disable the feature constraint update functionality. (BuildTasks/PublishExtension/v5/task.json
, BuildTasks/PublishExtension/v5/task.jsonR179-R187)updateFeatureConstraints
input into thePublishExtension
task's workflow, ensuring the VSIX editor processes this new feature when enabled. (BuildTasks/PublishExtension/v5/PublishExtension.ts
, [1] [2] [3]VSIX Editor Updates
updateFeatureConstraints
option in theVSIXEditor
class, including a new methodeditUpdateFeatureConstraints
and logic to handle this option during VSIX file processing. (BuildTasks/PublishExtension/v5/vsixeditor.ts
, [1] [2] [3]These changes collectively enhance the flexibility and functionality of the extension publishing process by enabling automated updates to feature constraints in extension manifests.