Skip to content
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

Add the ability to build with parameters #101

Merged
merged 11 commits into from
Aug 3, 2016

Conversation

olivierdagenais
Copy link
Member

The /team-build/ endpoint now supports /team-build/buildWithParameters/JOB_NAME in both structured form and legacy form modes.

Manual testing

  1. Given the following buildWithParameters.json file:

    {
        "parameter":
        [
            {"name": "id", "value": "123"},
            {"name": "verbosity", "value": "high"}
        ],
        "team-parameters":
        {
            "collectionUri":"https://mseng.visualstudio.com",
            "repoUri":"https://mseng.visualstudio.com/Personal/_git/olivida.gcm4ml",
            "projectId":"Personal",
            "repoId":"olivida.gcm4ml",
            "commit":"8a76fbe5c9e087491d672c7951bf2613be35de44",
            "pushedBy":"olivida"
        }
    }

    ...run the following command to test the structured form mode: curl --request PUT http://localhost:9090/team-build/build/param --data-urlencode json@buildWithParameters.json --user remote:92e9d8998a8c005697d252f09a2a311b and notice that:

    1. the param job is indeed triggered
    2. the job's parameters are set as specified
    3. the specified commit is fetched by the Git plugin
    4. the specified commit in Team Services has statuses added for the build being pending and then successful
  2. Run the following command for the complete equivalent in legacy form mode: curl --request PUT http://localhost:9090/team-build/build/param --data id=123 --data verbosity=high --data _team-build_Build.Repository.Provider=TfGit --data _team-build_System.TeamFoundationCollectionUri=https://mseng.visualstudio.com --data _team-build_Build.Repository.Uri=https://mseng.visualstudio.com/Personal/_git/olivida.gcm4ml --data _team-build_System.TeamProject=Personal --data _team-build_Build.Repository.Name=olivida.gcm4ml --data _team-build_Build.SourceVersion=8a76fbe5c9e087491d672c7951bf2613be35de44 --data _team-build_Build.RequestedFor=olivida --user remote:92e9d8998a8c005697d252f09a2a311b
    ...and notice it has the exact same consequences!

Mission accomplished!

@jasholl
Copy link

jasholl commented Aug 3, 2016

I've tested this briefly both build and build with parameters. The only thing I noticed is I was getting a 200 back -- shouldn't it be sending a 201 instead?

@olivierdagenais
Copy link
Member Author

The only thing I noticed is I was getting a 200 back -- shouldn't it be sending a 201 instead?

Good catch! I've fixed this in 87084ab.

@olivierdagenais olivierdagenais merged commit 2ddb56b into master Aug 3, 2016
@olivierdagenais olivierdagenais deleted the build_with_parameters branch August 3, 2016 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants