-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add resource to Build as an input source
- Loading branch information
1 parent
d2a6825
commit 8221983
Showing
4 changed files
with
493 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
### 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 | ||
``` | ||
|
||
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` | ||
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. | ||
|
||
#### 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 | ||
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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.