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

Generate Tekton Pipeline Python SDK #622

Merged
merged 1 commit into from
Oct 30, 2020

Conversation

jinchihe
Copy link
Contributor

@jinchihe jinchihe commented Aug 13, 2020

Changes

Note the PR is separate from the PR: tektoncd/pipeline#3081 you can get more from there

The PR is going to generate Tekton Pipeline Python SDK. Python SDK is very import for end user.

Design and implements:

  1. Use openapi-gen to generate OpenAPI specification from Go struct definition. (The part is kept in tektoncd/pipeline repo Generate OpenAPI specification and Swagger file pipeline#3081)
  2. And then generate the swagger file from the OpenAPI specification. (The part is kept in tektoncd/pipeline repo Generate OpenAPI specification and Swagger file pipeline#3081)
  3. Use swagger-codegen to generate the python SDK for the python object models (basic on some Kubernetes Python models).
  4. Then we need to develop some Client API such as create, update, delete to maintain Tekton objects, for this, we can use the Kubernetes CRD Python APIs.
  5. Update Readme file (generated) and the docs that linked to Kubernetes Python APIs, and some manually works.
  6. After finished, we can publish the SDK to Pypi so that user can easy to install and use the SDK.

See details in the generate script: https://github.com/tektoncd/experimental/blob/b0ac9b0e37a3ba850395831582c7a0f32e50b009/sdk/hack/README.md

Examples:

from tekton import TektonClient
from tekton import V1beta1TaskRun
from tekton import V1beta1TaskRunSpec
from tekton import V1beta1TaskSpec
from tekton import V1beta1Step
from kubernetes import client

taskrun = V1beta1TaskRun(
    api_version='tekton.dev/v1beta1',
    kind='TaskRun',
    metadata=client.V1ObjectMeta(name='sdk-sample-taskrun'),
    spec=V1beta1TaskRunSpec(
        task_spec=V1beta1TaskSpec(
            steps=[V1beta1Step(name='default',
                            image='ubuntu',
                            script='sleep 30;echo "This is a sdk demo.')]
        )))

tekton_client = TektonClient()
tekton_client.create(taskrun, namespace='default')

See detailed examples of taskrun here: https://github.com/tektoncd/experimental/blob/7f25f4c46dc6f30548cde7089e1c7c180e482311/sdk/python/examples/taskrun.ipynb

See detailed Readme and related docs in the PR: https://github.com/tektoncd/experimental/blob/7f25f4c46dc6f30548cde7089e1c7c180e482311/sdk/python/README.md

What's the next:

This is a init SDK generation, lots of things need to do, such as make more Client APIs manually, in this PR, I just finish basic apis... Thanks.

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

See the contribution guide
for more details.

@tekton-robot
Copy link

Hi @jinchihe. Thanks for your PR.

I'm waiting for a tektoncd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@tekton-robot tekton-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Aug 13, 2020
@jinchihe jinchihe changed the title Generate Tekton Pipeline Python SDK WIP: Generate Tekton Pipeline Python SDK Aug 13, 2020
@tekton-robot tekton-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 13, 2020
@jinchihe jinchihe force-pushed the generate_python_sdk branch 3 times, most recently from 585619d to 5b796bc Compare August 14, 2020 11:17
@jinchihe jinchihe changed the title WIP: Generate Tekton Pipeline Python SDK Generate Tekton Pipeline Python SDK Aug 14, 2020
@tekton-robot tekton-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 14, 2020
@jinchihe
Copy link
Contributor Author

Hey Reviewers, the PR is ready for review now. Thanks.

/cc @vdemeester

@jinchihe
Copy link
Contributor Author

@vdemeester Any more comments? I think that's ready. Thanks.

@vincent-pli
Copy link
Member

/ok-to-test

@tekton-robot tekton-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 18, 2020
Copy link
Member

@afrittoli afrittoli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this!
I think the first should be to merge it in, and we can then take it from there.
If you are part of the tekton org, you may want to add yourself and OWNER to this folder.
/approve

@vdemeester
Copy link
Member

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 27, 2020
Copy link
Member

@afrittoli afrittoli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: afrittoli

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 27, 2020
@vdemeester
Copy link
Member

/test pull-tekton-experimental-build-tests

@afrittoli
Copy link
Member

/restest

@jinchihe
Copy link
Contributor Author

I will take a look the CI issue and fix that ASAP . Thanks.

@tekton-robot tekton-robot added do-not-merge/invalid-owners-file Indicates that a PR should not merge because it has an invalid OWNERS file in it. and removed lgtm Indicates that a PR is ready to be merged. labels Oct 29, 2020
@jinchihe jinchihe force-pushed the generate_python_sdk branch 2 times, most recently from 05c9594 to 697933a Compare October 29, 2020 10:14
@jinchihe
Copy link
Contributor Author

Seems the CI test is passed now. Thanks!

@tekton-robot tekton-robot removed the do-not-merge/invalid-owners-file Indicates that a PR should not merge because it has an invalid OWNERS file in it. label Oct 29, 2020
@vincent-pli
Copy link
Member

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 30, 2020
@tekton-robot tekton-robot merged commit f9f49d9 into tektoncd:master Oct 30, 2020
@jinchihe jinchihe deleted the generate_python_sdk branch October 30, 2020 00:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants