Skip to content

Rewriting the GitHub Event Sample README#343

Closed
n3wscott wants to merge 8 commits into
knative:masterfrom
n3wscott:update-readme-github
Closed

Rewriting the GitHub Event Sample README#343
n3wscott wants to merge 8 commits into
knative:masterfrom
n3wscott:update-readme-github

Conversation

@n3wscott
Copy link
Copy Markdown
Contributor

@n3wscott n3wscott commented Aug 10, 2018

Based on feedback from https://github.com/knative/eventing/pull/276/files#diff-f9667ca3c88cf4316ebe5aab2d712207 I have updated the README to be more in-line with what the current docs repo does.

Note: I have also staged the commands for the move to knative/docs/eventing/samples/github-events

@evankanderson : I need guidance on how much of the "What just happened" second needs to be pulled from the k8s event or if we can point to that?

Related to #333

Dependent on #340

@knative-prow-robot knative-prow-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 10, 2018
@n3wscott
Copy link
Copy Markdown
Contributor Author

Grant for LGTM:
/assign @grantr

Evan for Approval:
/assign @evankanderson

@n3wscott
Copy link
Copy Markdown
Contributor Author

/test pull-knative-eventing-integration-tests

@grantr
Copy link
Copy Markdown
Contributor

grantr commented Aug 10, 2018

/cc @grantr

(cc requests my review, so I can track this in a different email label)

@knative-prow-robot knative-prow-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 14, 2018
@googlebot
Copy link
Copy Markdown

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of all the commit author(s), set the cla label to yes (if enabled on your project), and then merge this pull request when appropriate.

@n3wscott n3wscott force-pushed the update-readme-github branch from 4f4487b to 427dd5a Compare August 14, 2018 16:55
@googlebot
Copy link
Copy Markdown

CLAs look good, thanks!

@knative-prow-robot knative-prow-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Aug 14, 2018
Copy link
Copy Markdown
Member

@evankanderson evankanderson left a comment

Choose a reason for hiding this comment

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

This looks pretty good, thanks for updating!

Comment thread sample/github/README.md Outdated
```shell
kubectl apply -f https://storage.googleapis.com/knative-releases/eventing/latest/release.yaml
```
- A custom domain is setup to allow for GitHub to be able to call into the cluster,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

s/,/:/

Comment thread sample/github/README.md Outdated
# This will show the available Subscriptions created from the Flow:
kubectl get subscriptions -o yaml
Because the `github` EventSource needs to create a `Service.serving.knative.dev`
and call the Kubernetes watch API on events, you'll need to provision a special
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think github needs to call the Kubernetes watch API, does it?

Comment thread sample/github/README.md Outdated
```

Then create the secret so that you can see changes:
The `eventing/samples/github-events/auth.yaml` file provisions a service account, creates a role
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think you want eventing in this path.

In fact, I'd make this a relative path, so that it can be easily moved to knative/docs when ready.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The docs are written to run from the root of the docs directory so I have already changed things to make that assumption: eventing/samples/github-events

Comment thread sample/github/README.md Outdated

Then create the secret so that you can see changes:
The `eventing/samples/github-events/auth.yaml` file provisions a service account, creates a role
which can create Service in the `default` namespace and can view all
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

"a Knative Service"

Comment thread sample/github/README.md Outdated

Then create the secret so that you can see changes:
The `eventing/samples/github-events/auth.yaml` file provisions a service account, creates a role
which can create Service in the `default` namespace and can view all
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why does it need to view kubernetes resources?

Comment thread sample/github/README.md
legit True <none>
```

1. Create a [personal access token](https://github.com/settings/tokens) to
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This needs a little more detail. At a minimum:

  1. What scopes should be selected?
  2. Does the name matter?
  3. Mention that you'll need to copy the string once, and if you forget to/lose it, you'll need to generate a new one.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A screenshot would be nice, feel free to leave as a TODO.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added a screenshot and a paragraph with the requested info.

Comment thread sample/github/README.md Outdated
1. Create a [personal access token](https://github.com/settings/tokens) to
GitHub repo that the GitHub source can use to register webhooks with the
GitHub API. Also decide on a token that your code will use to authenticate
the incoming webhooks from GitHub (*accessToken*). Update
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What are the properties that this token should have? Just a unique string?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe there's an easy way to generate a unique 12-character alphanumeric string (pwgen or head -c 8 /dev/urandom | base64encode might work)?

Comment thread sample/github/README.md
legit True <none>
```

1. Create a [personal access token](https://github.com/settings/tokens) to
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd also call out that we use the same token for both the flow (to set up the webhook) and the function (to read and update the PR title).

I'd also move this step up before step 2 (kubectl apply -f function.yaml), so that the secrets are in place and the service has everything it needs before step 3 (wait for service to become ready).

Comment thread sample/github/README.md Outdated

## Understanding what happened

...TODO...
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd make this more formal:

TODO: explain the resources and communication channels, as well as where the secret is used.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In particular include a note to look at https://github.com/<owner>/<repo>/settings/hooks to see the webhook registered and then deleted.

Comment thread sample/github/README.md
```

And you can check the repo and see the webhook has been removed
To clean up the function, `Flow`, auth, and secret:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also mention deleting the github Personal Access Token from the github UI.

Comment thread sample/github/Dockerfile
FROM golang AS builder

WORKDIR /go/src/github.com/knative/docs/
ADD . /go/src/github.com/knative/docs/
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Dockerfile pathing is relative to the dockerfile itself which causes two issues here:

  • this github-events directory's contents gets placed under /go/src/github.com/knative/docs/ which results in an unable to find eventing/samples/github-events error when compiling. This can be fixed by changing the above command to ADD . /go/src/github.com/knative/docs/eventing/samples/github-events
  • Because we are only copying the github-events dir we lack the deps for this example (which are in docs/vendor). ISTM we can either add them with go get or add dep to the docker image along with a Gopkg config and then run dep ensure.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the tip! I will be sure to fix this up.

@n3wscott
Copy link
Copy Markdown
Contributor Author

Updated, PTAL @evankanderson

@n3wscott
Copy link
Copy Markdown
Contributor Author

Follow-up move to docs: knative/docs#339

@n3wscott
Copy link
Copy Markdown
Contributor Author

Follow-up to delete the github samples from eventing repo: #383

@n3wscott
Copy link
Copy Markdown
Contributor Author

I had to use the code from #339

Closes #339

Readme works. Source had two minor issues:

  • log flag was missing because glog is not used. removed.
  • istio sidecar injection was preventing the feedlet job from starting. fixed from patch

Copy link
Copy Markdown
Contributor

@grantr grantr left a comment

Choose a reason for hiding this comment

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

/lgtm

Thanks @n3wscott for updating these docs! Just some minor grammar comments.

Comment thread sample/github/README.md Outdated
# This will show the Revision that was created by the Configuration:
kubectl get revisions -o yaml
```
- A Kubernetes cluster with Knative installed. Follow the
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This should probably be with Knative serving installed.

Comment thread sample/github/README.md Outdated
if you need to create one.
- [Docker](https://www.docker.com/) installed and running on your local machine,
and a Docker Hub account configured (you'll use it for a container registry).
- The core Knative eventing tools installed. You can install them with:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think I'd call these "tools". Maybe The Knative eventing core installed.? Alternately, amend the above to say A Kubernetes cluster with Knative serving and eventing installed.

Comment thread sample/github/README.md Outdated
```shell
kubectl apply -f https://storage.googleapis.com/knative-releases/eventing/latest/release.yaml
```
- A custom domain is setup to allow for GitHub to be able to call into the cluster:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The grammar here doesn't line up with the other bullets. I'd rephrase this to A domain name that allows GitHub to call into the cluster.

Comment thread sample/github/README.md Outdated
ko apply -f sample/github/flow.yaml
```
Because the `github` EventSource needs to create a
`Service.serving.knative.dev`, you'll need to provision a special
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd recommend using the non-fully scoped name here: EventSource needs to create a Knative Service

Comment thread sample/github/README.md Outdated
The token can be named anything you find convenient. This sample requires
full `repo` control to be able update the title of the _Pull Request_.
The Source requires `admin:repo_hook`, this allows it to create webhooks
into repos that your account is allowed to do so. Copy and save this token,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Replace the comma with a semicolon: Copy and save this token; GitHub will...

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 20, 2018
@knative-prow-robot knative-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label Aug 20, 2018
@n3wscott
Copy link
Copy Markdown
Contributor Author

Updated both knative/docs#339 and here.

@n3wscott
Copy link
Copy Markdown
Contributor Author

/test pull-knative-eventing-integration-tests

2 similar comments
@n3wscott
Copy link
Copy Markdown
Contributor Author

/test pull-knative-eventing-integration-tests

@n3wscott
Copy link
Copy Markdown
Contributor Author

/test pull-knative-eventing-integration-tests

@knative-prow-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: n3wscott
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: evankanderson

If they are not already assigned, you can assign the PR to them by writing /assign @evankanderson in a comment when ready.

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

The pull request process is described here

Details 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

Copy link
Copy Markdown
Contributor

@grantr grantr left a comment

Choose a reason for hiding this comment

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

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 21, 2018
@grantr
Copy link
Copy Markdown
Contributor

grantr commented Aug 21, 2018

/assign @evankanderson

@knative-prow-robot
Copy link
Copy Markdown
Contributor

New changes are detected. LGTM label has been removed.

@knative-prow-robot knative-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label Aug 21, 2018
@n3wscott
Copy link
Copy Markdown
Contributor Author

Closed in favor of knative/docs#339

@n3wscott n3wscott closed this Aug 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants