-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
initial implementation for git resource for pipeline #91
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
### Pipeline Resources | ||
|
||
## Git Resource | ||
|
||
Git resource represents a [git](https://git-scm.com/) repository, that containes the source code to be built by the pipeline. Adding the git resource as an input to a task will clone this repository and allow the task to perform the required actions on the contents of the repo. | ||
|
||
Use the following example to understand the syntax and strucutre of a Git Resource | ||
|
||
#### Create a git resource using the `PipelineResource` CRD | ||
|
||
``` | ||
apiVersion: pipeline.knative.dev/v1alpha1 | ||
kind: Resource | ||
metadata: | ||
name: wizzbang-git | ||
namespace: default | ||
spec: | ||
type: git | ||
params: | ||
- name: url | ||
value: github.com/wizzbangcorp/wizzbang | ||
- name: Revision | ||
value: master | ||
- name: ServiceAccount | ||
value: pipeline-sa | ||
``` | ||
|
||
Params that can be added are the following: | ||
|
||
1. URL: represents the location of the git repository | ||
1. Revision: Git [revision](https://git-scm.com/docs/gitrevisions#_specifying_revisions ) (branch, tag, commit SHA or ref) to clone. If no revision is specified, the resource will default to `latest` from `master` | ||
tejal29 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
1. Service Account: specifies the `name` of a `ServiceAccount` resource object. Add this paramater to run your task with the privileges of the specified service account. If no serviceAccountName field is specified, your task runs using the default service account that is in the namespace of the Pipeline resource object. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmmm i wonder if this is a good default - in and/or maybe have an error if there is no serviceaccount? |
||
|
||
#### Use the defined git resource in a `Task` definition | ||
|
||
``` | ||
apiVersion: pipeline.knative.dev/v1alpha1 | ||
kind: Task | ||
metadata: | ||
name: build-push-task | ||
namespace: default | ||
spec: | ||
inputs: | ||
resources: | ||
- name: wizzbang-git | ||
type: git | ||
tejal29 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
params: | ||
- name: PATH_TO_DOCKERFILE | ||
value: string | ||
outputs: | ||
resources: | ||
- name: builtImage | ||
buildSpec: | ||
template: | ||
name: kaniko | ||
arguments: | ||
- name: DOCKERFILE | ||
value: ${PATH_TO_DOCKERFILE} | ||
- name: REGISTRY | ||
value: ${REGISTRY} | ||
``` | ||
|
||
#### And finally set the version in the `TaskRun` definition | ||
|
||
``` | ||
apiVersion: pipeline.knative.dev/v1alpha1 | ||
kind: TaskRun | ||
metadata: | ||
name: build-push-task-run | ||
namespace: default | ||
spec: | ||
taskRef: | ||
name: build-push-task | ||
inputs: | ||
resourcesVersion: | ||
- resourceRef: | ||
name: wizzbang-git | ||
version: HEAD | ||
outputs: | ||
artifacts: | ||
- name: builtImage | ||
type: image | ||
``` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. great docs!! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so cool, thanks for adding docs!
it would be good at add a link from https://github.com/knative/build-pipeline#resources to here as well, since folks won't know this doc exists