问题描述
我想获取发布行构建的软件包 ,然后将其安装到另一个(非产品)VSTS中,以便可以验证其是否有效,在安装到我们的产品VSTS之前.
I want to take the package as-built by the release line, and install it to another (non-prod) VSTS, so I can validate it works, before installing to our prod VSTS.
我们使用带有VSTS任务"Package Extension"的VSTS vNext版本来编译软件包.这样会将值"my-prod-publisher"的"Publisher"编译为文件"extension.vsixmanifest"
We use VSTS vNext build with VSTS task 'Package Extension' to compile the package.This compiles 'Publisher' with value 'my-prod-publisher' into file 'extension.vsixmanifest'
我尝试过:
-
将软件包手动上传到"my-dev-publisher"的VSTS市场门户.结果是:
Manually upload package to VSTS marketplace portal for "my-dev-publisher".Results are:
修改VSIX软件包:
Modify VSIX package:
- 解压缩.VSIX软件包
- 编辑文件'extension.vsixmanifest'将'Publisher'从值'my-prod-publisher'更改为'my-dev-publisher'
- 将内容压缩到新的ZIP文件中
- 将包文件后缀.ZIP更改为.VSIX
- 上传到"my-dev-publisher"的VSTS市场门户
- 结果是:
- Unzip the .VSIX package
- Edit file 'extension.vsixmanifest' to change 'Publisher' from value 'my-prod-publisher' to 'my-dev-publisher'
- zip contents into new ZIP file
- change package file suffix .ZIP to .VSIX
- upload to VSTS marketplace portal for 'my-dev-publisher'
- Results are:
我的google-fu无法找到与我的案件有关的有关此错误的内容.对此并没有太费劲,因为我不希望重新压缩文件以产生与编译这些包相同的结果.
My google-fu failed to find content about this error relevant to my case. Didn't search too hard on this, as I wasn't expecting re-zipping the files to produce same results as how these packages are compiled.
通过tfx-cli发布
Publish via tfx-cli
tfx extension publish --service-url https://marketplace.visualstudio.com/ --publisher "my-dev-publisher" --vsix .\my-prod-publisher.vsts-buildrelease-tasks-0.6.181012.vsix --accounts my-dev-vsts --auth-type pat --token [my-dev-vsts-PAT] --trace-level debug
结果错误:
我在VSTS'my-dev-vsts'中验证了' my dev vsts PAT '没有过期,并且已获得所有作用域"的授权.
I verified 'my dev vsts PAT' isn't expired, and is authorized for "All scopes", in VSTS 'my-dev-vsts'.
验证分支版本,而不是发布行版本
Validating a branch build, instead of release-line build
使用'Publisher'='my-dev-publisher'编译软件包确实使我可以发布到门户网站'my-dev-publisher',这随后使我可以将扩展软件包安装到'my-dev-VSTS'中.这还不够有效,因为我一直被诸如以下的细微问题困扰:
Compiling the package with 'Publisher' = 'my-dev-publisher' does allow me to publish to portal 'my-dev-publisher' which then allows me to install extensions package into 'my-dev-VSTS'.This wasn't effective enough, since I've been burned by subtle issues such as:
- 程序包/任务的版本号未正确碰撞,或与PROD的值不同.
- 提交发布行期间缺少文件/更改.
推荐答案
我们在扩展的CI/CD任务.这些构建任务还提供了扩展扩展版本和扩展中包含的构建任务的选项.您可以根据需要使用任务组来标准化构建过程.或使用发布管理将vsix从dev升级到prod.这些任务实际上将覆盖发布者ID.您还必须覆盖扩展ID并将其设为私有.只能公开发布一个公共产品扩展名,并且扩展名在全球范围内是唯一的.
We have support for these features in the CI/CD tasks for extensions. These build tasks also offer the option of bumping the version of the extension and the build tasks included in the extension. You can standardize the build process using a Task Group if you want to. Or use Release Management to promote the vsix from dev to prod. These tasks will actually override the publisher-id. You will also have to override the extension-id and make it private. Only one public prod extension can be made public and extension-ids are globally unique.
另一种选择是同时构建dev和发行版vsix,以确保它们匹配.然后,在需要之前不要使用发行包.
The alternative is to build the dev and the release vsix at the same time to ensure they're matching. Then don't use the release package until you need it.
您看到的问题是我们构建这些任务的原因.
The issues you're seeing are the reason we built these tasks.
-
TF400898: An Internal Error Occurred. Activity Id: 64d37121-ea19-42dc-9994-dbef8e6dc205.
当zip使用错误的压缩方法时,会发生这种情况.在扩展任务中,我不得不花很多时间来使7z语法正确. -
Received response 401 (Not Authorized). Check that your personal access token is correct and hasn't expired.
是由于以下事实引起的:从vsix发布时,--extension-id
和--publisher
被忽略.但是TFX不会告诉你.
TF400898: An Internal Error Occurred. Activity Id: 64d37121-ea19-42dc-9994-dbef8e6dc205.
This happens when the zip is using the wrong compression method. In the extension tasks I had to fiddle quite a bit to get the 7z syntx right.Received response 401 (Not Authorized). Check that your personal access token is correct and hasn't expired.
is caused by the fact that when publishing from vsix the--extension-id
and--publisher
are ignored. But TFX doesn't tell you.
这篇关于如何将我们的VSTS扩展包的产品版本发布到我的开发VSTS(而不是产品VSTS),以便在发布到产品VSTS之前可以对其进行验证?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!