VSTS fabrikam-build-extension示例无法正常工作(模板)

时间:2017-06-01 12:57:47

标签: azure-pipelines-build-task

刚刚尝试了2017年TFS和VSTS上的fabrikam-build-extension示例。我可以看到修改构建的自定义任务,但是我无法使用Template1模板来创建构建定义。模板1未列出。

有人有线索吗?

1 个答案:

答案 0 :(得分:0)

是的,我可以重现这个问题。这两个任务可以成功添加。但是模板1无法添加到VSTS构建模板中。

但如果我使用与template.json相同的内容到create a build template by REST API,我可以在构建模板中找到它。

enter image description here

PUT https://marinaliu.visualstudio.com/DefaultCollection/Git2/_apis/build/definitions/templates/myCustomTemplate?api-version=2.0

应用程序/ JSON:

{
    "id": "android",
    "name": "My Custom Andriod Template",
    "category": "Build",
    "iconTaskId": "DF857559-8715-46EB-A74E-AC98B9178AA0",
    "description": "Build your Android projects, run tests, sign and align Android App Package files. This template requires the Android SDK to be installed on the build agent.",
    "template": {
        "buildNumberFormat": "$(date:yyyyMMdd)$(rev:.r)",
        "build": [{
                "enabled": true,
                "inputs": {
                    "wrapperScript": "$(Parameters.wrapperScript)",
                    "tasks": "$(Parameters.tasks)"
                },
                "task": {
                    "id": "8D8EEBD8-2B94-4C97-85AF-839254CC6DA4",
                    "versionSpec": "1.*"
                }
            },
            {
                "enabled": true,
                "inputs": {
                    "files": "**/*.apk",
                    "jarsign": "false",
                    "zipalign": "false"
                },
                "task": {
                    "id": "80F3F6A0-82A6-4A22-BA7A-E5B8C541B9B9",
                    "versionSpec": "1.*"
                }
            },
            {
                "enabled": true,
                "alwaysRun": true,
                "inputs": {
                    "SourceFolder": "$(build.sourcesdirectory)",
                    "Contents": "**/*.apk",
                    "TargetFolder": "$(build.artifactstagingdirectory)"
                },
                "task": {
                    "id": "5bfb729a-a7c8-4a78-a7c3-8d717bb7c13c",
                    "versionSpec": "2.*"
                }
            },
            {
                "enabled": true,
                "alwaysRun": true,
                "inputs": {
                    "PathtoPublish": "$(build.artifactstagingdirectory)",
                    "ArtifactName": "drop",
                    "ArtifactType": "Container"
                },
                "task": {
                    "id": "2ff763a7-ce83-4e1f-bc89-0ae63477cebe",
                    "versionSpec": "1.*"
                }
            }
        ],
        "options": [{
            "definition": {
                "id": "5D58CC01-7C75-450C-BE18-A388DDB129EC"
            },
            "enabled": true,
            "inputs": {}
        }],
        "variables": {
            "system.debug": {
                "value": "false",
                "allowOverride": true
            }
        },
        "triggers": [],
        "processParameters": {
            "inputs": [{
                    "name": "wrapperScript",
                    "label": "{GradleWrapper}",
                    "defaultValue": "gradlew",
                    "required": true,
                    "type": "filePath"
                },
                {
                    "name": "tasks",
                    "label": "{GradleTasks}",
                    "defaultValue": "build",
                    "required": true,
                    "type": "string"
                }
            ]
        }
    }
}

创建问题here,您可以跟进。

相关问题