atlassian-api / atlassian-python-api

Atlassian Python REST API wrapper
https://atlassian-python-api.readthedocs.io
Apache License 2.0
1.36k stars 664 forks source link

Unable to trigger a specific pipeline without providing commit key #847

Open arvind-kalyan opened 3 years ago

arvind-kalyan commented 3 years ago

Hello, I'm trying out the bitbucket pipelines python api, but running into an issue where it mandatorily asks for commit to be non None while calling pipelines.trigger() API.

What I'm trying to do is to be able to trigger a custom pipeline for a branch : r.pipelines.trigger(branch="master", pattern="deployment-to-test-infra", variables=[{'key': 'SERVER_ENV', 'value': 'test-01'}), it's giving the error : ValueError: Missing argument [commit]..

I'm however able to trigger the HTTP API directly without commits and it works fine.

        if pattern is not None:
            if commit is None:
                raise ValueError("Missing argument [commit].")
            data["target"]["selector"] = {
                "type": "custom",
                "pattern": pattern,
            }

I'm not sure why this inner IF check was added. I can help with the PR if you can let me know the changes required.

Spacetown commented 3 years ago

I think the whole if block can be removed. Please also update the documentation. A commit or/and a pattern can be given.

arvind-kalyan commented 3 years ago

@Spacetown - I've raised a PR, please check and ack.

arvind-kalyan commented 3 years ago

@Spacetown - have addressed the comments.

Spacetown commented 2 years ago

@gonchik This can be closed.