diff --git a/.github/issue-template.md b/.github/issue-template.md new file mode 100644 index 0000000000..e9044a11b0 --- /dev/null +++ b/.github/issue-template.md @@ -0,0 +1,16 @@ +--- +name: Issue Template +about: Template for both bug reports and feature requests +--- + +# Expected Behavior + +# Actual Behavior + +# Steps to Reproduce the Problem + +1. +2. +3. + +# Additional Info diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000000..e7939b6346 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,31 @@ + + +# Changes + + + +# Submitter Checklist + +These are the criteria that every PR should meet, please check them off as you +review them: + +- [ ] Includes [tests](https://github.com/tektoncd/community/blob/master/standards.md#principles) (if functionality changed/added) +- [ ] Includes [docs](https://github.com/tektoncd/community/blob/master/standards.md#principles) (if user facing) +- [ ] Commit messages follow [commit message best practices](https://github.com/tektoncd/community/blob/master/standards.md#commit-messages) + +_See [the contribution guide](https://github.com/tektoncd/pipeline/blob/master/CONTRIBUTING.md) +for more details._ + +# Release Notes + + + +``` +release-note +``` diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000000..9eab68a0c3 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,26 @@ +# Contributing to Tekton Pipelines cli + +Welcome to the Tekton Pipelines project! Thanks for considering contributing to +our project and we hope you'll enjoy it :D + +**All contributors must comply with +[the code of conduct](./code-of-conduct.md).** + +To get started developing, see our [DEVELOPMENT.md](./DEVELOPMENT.md). + +In [the community repo](https://github.com/tektoncd/community) you'll +find info on: + +- [Contacting other contributors](https://github.com/tektoncd/community/blob/master/contact.md) +- [Development standards](https://github.com/tektoncd/community/blob/master/standards.md) around + [principles](https://github.com/tektoncd/community/blob/master/standards.md#principles), + [commit messages](https://github.com/tektoncd/community/blob/master/standards.md#commit-messages) + and [code](https://github.com/tektoncd/community/blob/master/standards.md#coding-standards) +- [Processes](https://github.com/tektoncd/community/blob/master/process.md) like + [finding something to work on](https://github.com/tektoncd/community/blob/master/process.md#finding-something-to-work-on), + [proposing features](https://github.com/tektoncd/community/blob/master/process.md#proposing-features), + [reviews](https://github.com/tektoncd/community/blob/master/process.md#reviews) + and [becoming an OWNER](https://github.com/tektoncd/community/blob/master/process.md#owners) + +You can find details on our automation infrastructure in +[the plumbing repo](https://github.com/tektoncd/plumbing). diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md new file mode 100644 index 0000000000..6ad5b348a1 --- /dev/null +++ b/DEVELOPMENT.md @@ -0,0 +1,118 @@ +# Developing + +## Getting started + +1. Create [a GitHub account](https://github.com/join) +1. Setup + [GitHub access via SSH](https://help.github.com/articles/connecting-to-github-with-ssh/) +1. [Create and checkout a repo fork](#checkout-your-fork) +1. Set up your [shell environment](#environment-setup) +1. Install [requirements](#requirements) +1. [Set up a Kubernetes cluster](#kubernetes-cluster) + +Then you can [iterate](#iterating) (including +[runing the controllers with `ko`](#install-pipeline)). + +### Checkout your fork + +The Go tools require that you clone the repository to the +`src/github.com/tektoncd/pipeline` directory in your +[`GOPATH`](https://github.com/golang/go/wiki/SettingGOPATH). + +To check out this repository: + +1. Create your own + [fork of this repo](https://help.github.com/articles/fork-a-repo/) +1. Clone it to your machine: + +```shell +mkdir -p ${GOPATH}/src/github.com/tektoncd +cd ${GOPATH}/src/github.com/tektoncd +git clone git@github.com:${YOUR_GITHUB_USERNAME}/cli.git +cd cli +git remote add upstream git@github.com:tektoncd/cli.git +git remote set-url --push upstream no_push +``` + +_Adding the `upstream` remote sets you up nicely for regularly +[syncing your fork](https://help.github.com/articles/syncing-a-fork/)._ + +### Requirements + +You must install these tools: + +1. [`go`](https://golang.org/doc/install): The language Tekton + Pipelines CLI is built in +1. [`git`](https://help.github.com/articles/set-up-git/): For source control +1. [`kubectl`](https://kubernetes.io/docs/tasks/tools/install-kubectl/) + (optional): For interacting with your kube cluster + +## Kubernetes cluster + +Docker for Desktop using an edge version has been proven to work for both +developing and running Pipelines. Your Kubernetes version must be 1.11 or later. + +To setup a cluster with GKE: + +1. [Install required tools and setup GCP project](https://github.com/knative/docs/blob/master/docs/install/Knative-with-GKE.md#before-you-begin) + (You may find it useful to save the ID of the project in an environment + variable (e.g. `PROJECT_ID`). +1. [Create a GKE cluster](https://github.com/knative/docs/blob/master/docs/install/Knative-with-GKE.md#creating-a-kubernetes-cluster) + +Note that +[the `--scopes` argument to `gcloud container cluster create`](https://cloud.google.com/sdk/gcloud/reference/container/clusters/create#--scopes) +controls what GCP resources the cluster's default service account has access to; +for example to give the default service account full access to your GCR +registry, you can add `storage-full` to your `--scopes` arg. + +## Environment Setup + +To build the Tekton pipelines cli you'll need to set `GO111MODULE=on` +enviroment variable to force `go` to use [go +modules](https://github.com/golang/go/wiki/Modules#quick-start). + +## Iterating + +While iterating on the project, you may need to: + +1. [Install Tekton pipeline](#install-pipeline) +2. [Buildking Tekton client](#building-tekton-client) +1. [Add and run tests](./test/README.md#tests) + +## Building Tekton client + +**Dependencies:** + +[go mod](https://github.com/golang/go/wiki/Modules#quick-start) is used and required for dependencies. + +**Building:** + +```sh +$ go build ./cmd/... +``` + +It builds `tkn` binary in your current directory. You can start playing with it. + +**Notes:** + +- For building, Go `1.12` is required +- If you are building in your `$GOPATH` folder, you need to specify `GO111MODULE` for building it + +```sh +# if you are building in your $GOPATH +GO111MODULE=on go build ./cmd/... +``` + +You can now try updating code for client and test out the changes by building the `tkn` binary. + + +## Install Pipeline + +You can stand up a version of this controller on-cluster (to your +`kubectl config current-context`): + +- using a `release.yaml` file from the Tekton pipelines + [releases](https://github.com/tektoncd/pipeline/releases) +- using [tektoncd/pipeline](https://github.com/tektoncd/pipeline) + sources, following + [DEVELOPMENT.md](https://github.com/tektoncd/pipeline/blob/master/DEVELOPMENT.md). diff --git a/LICENSE b/LICENSE index 261eeb9e9f..d645695673 100644 --- a/LICENSE +++ b/LICENSE @@ -1,3 +1,4 @@ + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ diff --git a/OWNERS b/OWNERS index 8ec191e208..49b6444133 100644 --- a/OWNERS +++ b/OWNERS @@ -3,3 +3,4 @@ approvers: - pwittrock - vdemeester +- sthaha \ No newline at end of file diff --git a/README.md b/README.md index e8d37906c9..9289a03c96 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,19 @@ -# cli -A CLI for interacting with Tekton! +# Tekton Pipelines cli + +[![Go Report Card](https://goreportcard.com/badge/tektoncd/pipeline)](https://goreportcard.com/report/tektoncd/pipeline) + +The Tekton Pipelines cli project provides a CLI for interacting with +Tekton ! + + +## Want to contribute + +We are so excited to have you! + +- See [CONTRIBUTING.md](CONTRIBUTING.md) for an overview of our processes +- See [DEVELOPMENT.md](DEVELOPMENT.md) for how to get started +- Look at our + [good first issues](https://github.com/tektoncd/pipeline/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) + and our + [help wanted issues](https://github.com/tektoncd/pipeline/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) + diff --git a/code-of-conduct.md b/code-of-conduct.md new file mode 100644 index 0000000000..5f04b3187c --- /dev/null +++ b/code-of-conduct.md @@ -0,0 +1,75 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of +experience, education, socio-economic status, nationality, personal appearance, +race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +- Using welcoming and inclusive language +- Being respectful of differing viewpoints and experiences +- Gracefully accepting constructive criticism +- Focusing on what is best for the community +- Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +- The use of sexualized language or imagery and unwelcome sexual attention or + advances +- Trolling, insulting/derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or electronic + address, without explicit permission +- Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, or to ban temporarily or permanently any +contributor for other behaviors that they deem inappropriate, threatening, +offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at +knative-code-of-conduct@googlegroups.com. All complaints will be reviewed and +investigated and will result in a response that is deemed necessary and +appropriate to the circumstances. The project team is obligated to maintain +confidentiality with regard to the reporter of an incident. Further details of +specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 1.4, available at +https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org diff --git a/test/README.md b/test/README.md new file mode 100644 index 0000000000..0ed63c720e --- /dev/null +++ b/test/README.md @@ -0,0 +1,73 @@ +# Tests + +To run tests: + +```shell +# Unit tests +go test ./... + +# Integration tests (against your current kube cluster) +go test -v -count=1 -tags=e2e ./test +``` + +## Unit tests + +Unit tests live side by side with the code they are testing and can be run with: + +```shell +go test ./... +``` + +By default `go test` will not run [the end to end tests](#end-to-end-tests), +which need `-tags=e2e` to be enabled. + +## End to end tests + +### Running + +To run end to end tests, you will need to have a running Tekton +pipeline deployed on your cluster, see [Install Pipeline](../DEVELOPMENT.md#install-pipeline). + +End to end tests live in this directory. To run these tests, you must provide +`go` with `-tags=e2e`. By default the tests run against your current kubeconfig +context, but you can change that and other settings with [the flags](#flags): + +```shell +go test -v -count=1 -tags=e2e -timeout=20m ./test +go test -v -count=1 -tags=e2e -timeout=20m ./test --kubeconfig ~/special/kubeconfig --cluster myspecialcluster +``` + +You can also use +[all of flags defined in `knative/pkg/test`](https://github.com/knative/pkg/tree/master/test#flags). + +### Flags + +- By default the e2e tests against the current cluster in `~/.kube/config` using + the environment specified in + [your environment variables](/DEVELOPMENT.md#environment-setup). +- Since these tests are fairly slow, running them with logging enabled is + recommended (`-v`). +- Using [`--logverbose`](#output-verbose-log) to see the verbose log output from + test as well as from k8s libraries. +- Using `-count=1` is + [the idiomatic way to disable test caching](https://golang.org/doc/go1.10#test). +- The end to end tests take a long time to run so a value like `-timeout=20m` + can be useful depending on what you're running + +You can [use test flags](#flags) to control the environment your tests run +against, i.e. override +[your environment variables](/DEVELOPMENT.md#environment-setup): + +```bash +go test -v -tags=e2e -count=1 ./test --kubeconfig ~/special/kubeconfig --cluster myspecialcluster +``` + +### One test case + +To run one e2e test case, e.g. TestTaskRun, use +[the `-run` flag with `go test`](https://golang.org/cmd/go/#hdr-Testing_flags): + +```bash +go test -v -tags=e2e -count=1 ./test -run ^TestTaskRun$ +``` +