Skip to content

Commit

Permalink
Merge pull request #285 from stakater/buildah-docs
Browse files Browse the repository at this point in the history
SA-5570 - Update buidah docs & Add comment on pr task
  • Loading branch information
rasheedamir authored Aug 2, 2024
2 parents f9b6eaa + c3873de commit 9aa5ad7
Show file tree
Hide file tree
Showing 27 changed files with 405 additions and 3,527 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,86 +19,7 @@ You have already created a PipelineRun in the previous tutorial. Let's now add a
1. Now edit the file, so the YAML becomes like the one given below.

```yaml
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
name: pullrequest # pipelineRun name
annotations:
pipelinesascode.tekton.dev/on-event: "[pull_request]" # Trigger the pipelineRun on pullrequest events on branch main
pipelinesascode.tekton.dev/on-target-branch: "main"
pipelinesascode.tekton.dev/task: "[git-clone,
https://raw.githubusercontent.com/stakater-tekton-catalog/create-git-tag/0.0.12/task/stakater-create-git-tag/stakater-create-git-tag.yaml]"
pipelinesascode.tekton.dev/max-keep-runs: "2" # Only remain 2 latest pipelineRuns on SAAP
spec:
params:
- name: repo_url
value: "[email protected]:<YOUR-ORG>/<YOUR-REPO-NAME>/" # Place your repo SSH URL
- name: git_revision
value: {{revision}} # Dynamic variable to fetch branch name of the push event on your repo
- name: repo_path
value: {{repo_name}} # Dynamic variable to fetch repo name
- name: image_registry
value: "<docker-registry-url>" # Place image registry URL without https:// succeeded by your application name
- name: helm_registry
value: "<https://helm-registry-url>" # Place helm registry URL with https://
- name: pull_request_number
value: {{pull_request_number}}
pipelineSpec: # Define what parameters will be used for pipeline
params:
- name: repo_url
- name: git_revision
- name: repo_path
- name: image_registry
- name: helm_registry
- name: pull_request_number
workspaces: # Mention what workspaces will be used by this pipeline to store data and used by data transferring between tasks
- name: source
- name: ssh-directory
tasks: # Mention what tasks will be used by this pipeline
- name: fetch-repository #Name what you want to call the task
taskRef:
name: git-clone # Name of tasks mentioned in tekton-catalog
kind: Task
workspaces: # Mention what workspaces will be used by this task
- name: output
workspace: source
- name: ssh-directory
workspace: ssh-directory
params: # Parameters will be used by this task
- name: depth
value: "0"
- name: url
value: $(params.repo_url)
- name: revision
value: $(params.git_revision)
- name: create-git-tag
runAfter:
- fetch-repository
taskRef:
name: stakater-create-git-tag
kind: Task
params:
- name: PR_NUMBER
value: $(params.pull_request_number)
- name: GIT_REVISION
value: $(params.git_revision)
workspaces:
- name: source
workspace: source
- name: ssh-directory
workspace: ssh-directory
workspaces: # Mention Workspaces configuration
- name: source
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
- name: ssh-directory # Using ssh-directory workspace for our task to have better security
secret:
secretName: git-ssh-creds # Created this secret earlier
{% include "https://raw.githubusercontent.com/NordMart/review-api/main/.tekton/git_clone.yaml" %}
```

**Notice** that we added another value to the **`pipelinesascode.tekton.dev/task`** annotation. The annotation is used by pipeline as code resolver to fetch tasks defined remotely. To explore stakater's Tekton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,124 +21,7 @@ The create environment task utilizes [Tronador](https://docs.stakater.com/tronad
1. Now edit the file so the YAML becomes like the one given below.

```yaml
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
name: pullrequest # pipelineRun name
annotations:
pipelinesascode.tekton.dev/on-event: "[push]" # Trigger the pipelineRun on push events on branch main
pipelinesascode.tekton.dev/on-target-branch: "main"
pipelinesascode.tekton.dev/task: "[git-clone,
https://raw.githubusercontent.com/stakater-tekton-catalog/create-git-tag/0.0.12/task/stakater-create-git-tag/stakater-create-git-tag.yaml,
https://raw.githubusercontent.com/stakater-tekton-catalog/create-environment/0.0.16/task/stakater-create-environment/stakater-create-environment.yaml]"
pipelinesascode.tekton.dev/max-keep-runs: "2" # Only remain 2 latest pipelineRuns on SAAP
spec:
params:
- name: repo_url
value: "[email protected]:<YOUR-ORG>/<YOUR-REPO-NAME>/" # Place your repo SSH URL
- name: git_revision
value: {{revision}} # Dynamic variable to fetch branch name of the push event on your repo
- name: git_branch
value: {{source_branch}}
- name: repo_path
value: {{repo_name}} # Dynamic variable to fetch repo name
- name: image_registry
value: "<docker-registry-url>" # Place image registry URL without https:// succeeded by your application name
- name: helm_registry
value: "<https://helm-registry-url>" # Place helm registry URL with https://
- name: pull_request_number
value: {{pull_request_number}}
- name: organization
value: {{YOUR_GIT_ORG}}
pipelineSpec: # Define what parameters will be used for pipeline
params:
- name: repo_url
- name: git_revision
- name: repo_path
- name: image_registry
- name: helm_registry
- name: pull_request_number
- name: organization
- name: git_branch
workspaces: # Mention what workspaces will be used by this pipeline to store data and used by data transferring between tasks
- name: source
- name: ssh-directory
tasks: # Mention what tasks will be used by this pipeline
- name: fetch-repository #Name what you want to call the task
taskRef:
name: git-clone # Name of tasks mentioned in tekton-catalog
kind: Task
workspaces: # Mention what workspaces will be used by this task
- name: output
workspace: source
- name: ssh-directory
workspace: ssh-directory
params: # Parameters will be used by this task
- name: depth
value: "0"
- name: url
value: $(params.repo_url)
- name: revision
value: $(params.git_revision)
- name: create-git-tag
runAfter:
- fetch-repository
taskRef:
name: stakater-create-git-tag-0.0.7
kind: Task
params:
- name: PR_NUMBER
value: $(params.pull_request_number)
- name: GIT_REVISION
value: $(params.git_revision)
workspaces:
- name: source
workspace: source
- name: ssh-directory
workspace: ssh-directory
- name: stakater-create-environment
runAfter:
- create-git-tag
taskRef:
kind: Task
name: stakater-create-environment
params:
- name: CREATE_ON_CLUSTER
value: "true"
- name: REPO_NAME
value: $(params.repo_path)
- name: PR_NUMBER
value: $(params.pull_request_number)
- name: GIT_URL
value: "<https://github.com/org/app.git>" #Replace with your application repository Url
- name: GIT_BRANCH
value: $(params.git_branch)
- name: IMAGE_TAG
value: $(tasks.create-git-tag.results.GIT_TAG)
- name: IMAGE_REPO
value: $(params.image_registry)
- name: PULL_REQUEST_COMMITS_API # Replace when not using Git
value: https://api.github.com/repos/$(params.organization)/$(params.repo_path)/pulls/$(params.pull_request_number)/commits
workspaces:
- name: output
workspace: source
- name: repo-token
workspace: repo-token
workspaces: # Mention Workspaces configuration
- name: source
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
- name: ssh-directory # Using ssh-directory workspace for our task to have better security
secret:
secretName: git-ssh-creds # Created this secret earlier
- name: repo-token
secret:
secretName: git-pat-creds
{% include "https://raw.githubusercontent.com/NordMart/review-api/main/.tekton/code_linting.yaml" %}
```

**Notice** that we added another **workspace, repo-token** to the pipeline run. This workspace utilizes the git-pat-creds secret that we previously created and mounts it to the create-environment task.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,134 +20,7 @@ You have already created a PipelineRun in the previous tutorial. Let's now add a
1. Now edit the file so the YAML becomes like the one given below.

```yaml
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
name: pullrequest # pipelineRun name
annotations:
pipelinesascode.tekton.dev/on-event: "[pull_request]" # Trigger the pipelineRun on pullrequest events on branch main
pipelinesascode.tekton.dev/on-target-branch: "main"
pipelinesascode.tekton.dev/task: "[git-clone,
https://raw.githubusercontent.com/stakater-tekton-catalog/create-git-tag/0.0.12/task/stakater-create-git-tag/stakater-create-git-tag.yaml,
https://raw.githubusercontent.com/stakater-tekton-catalog/create-environment/0.0.16/task/stakater-create-environment/stakater-create-environment.yaml,
https://raw.githubusercontent.com/stakater-tekton-catalog/code-linting-mvn/0.0.4/task/stakater-code-linting/stakater-code-linting.yaml]"
pipelinesascode.tekton.dev/max-keep-runs: "2" # Only remain 2 latest pipelineRuns on SAAP
spec:
params:
- name: repo_url
value: "[email protected]:<YOUR-ORG>/<YOUR-REPO-NAME>/" # Place your repo SSH URL
- name: git_revision
value: {{revision}} # Dynamic variable to fetch branch name of the push event on your repo
- name: git_branch
value: {{source_branch}}
- name: repo_path
value: {{repo_name}} # Dynamic variable to fetch repo name
- name: image_registry
value: "<docker-registry-url>" # Place image registry URL without https:// succeeded by your application name
- name: helm_registry
value: "<https://helm-registry-url>" # Place helm registry URL with https://
- name: pull_request_number
value: {{pull_request_number}}
- name: organization
value: {{YOUR_GIT_ORG}}
pipelineSpec: # Define what parameters will be used for pipeline
params:
- name: repo_url
- name: git_revision
- name: repo_path
- name: image_registry
- name: helm_registry
- name: pull_request_number
- name: organization
- name: git_branch
workspaces: # Mention what workspaces will be used by this pipeline to store data and used by data transferring between tasks
- name: source
- name: ssh-directory
tasks: # Mention what tasks will be used by this pipeline
- name: fetch-repository #Name what you want to call the task
taskRef:
name: git-clone # Name of tasks mentioned in tekton-catalog
kind: Task
workspaces: # Mention what workspaces will be used by this task
- name: output
workspace: source
- name: ssh-directory
workspace: ssh-directory
params: # Parameters will be used by this task
- name: depth
value: "0"
- name: url
value: $(params.repo_url)
- name: revision
value: $(params.git_revision)
- name: create-git-tag
runAfter:
- fetch-repository
taskRef:
name: stakater-create-git-tag
kind: Task
params:
- name: PR_NUMBER
value: $(params.pull_request_number)
- name: GIT_REVISION
value: $(params.git_revision)
workspaces:
- name: source
workspace: source
- name: ssh-directory
workspace: ssh-directory
- name: stakater-create-environment
runAfter:
- create-git-tag
taskRef:
kind: Task
name: stakater-create-environment
params:
- name: CREATE_ON_CLUSTER
value: "true"
- name: REPO_NAME
value: $(params.repo_path)
- name: PR_NUMBER
value: $(params.pull_request_number)
- name: GIT_URL
value: "<https://github.com/org/app.git>" #Replace with your application repository Url
- name: GIT_BRANCH
value: $(params.git_branch)
- name: IMAGE_TAG
value: $(tasks.create-git-tag.results.GIT_TAG)
- name: IMAGE_REPO
value: $(params.image_registry)
- name: PULL_REQUEST_COMMITS_API # Replace when not using Git
value: https://api.github.com/repos/$(params.organization)/$(params.repo_path)/pulls/$(params.pull_request_number)/commits
workspaces:
- name: output
workspace: source
- name: repo-token
workspace: repo-token
- name: code-linting
runAfter:
- stakater-create-environment
taskRef:
name: stakater-code-linting
kind: Task
workspaces:
- name: source
workspace: source
workspaces: # Mention Workspaces configuration
- name: source
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
- name: ssh-directory # Using ssh-directory workspace for our task to have better security
secret:
secretName: git-ssh-creds # Created this secret earlier
- name: repo-token
secret:
secretName: git-pat-creds
{% include "https://raw.githubusercontent.com/NordMart/review-api/main/.tekton/code_linting.yaml" %}
```

!!! note
Expand Down
Loading

0 comments on commit 9aa5ad7

Please sign in to comment.