Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 10 additions & 19 deletions pkg/pipelines/tekton/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,6 @@ const (
taskGitCloneRef = "git-clone"

// Following part holds a reference to Git Clone Task to be used in Pipeline template,
// the usage depends whether we use direct code upload or Git reference for a standard (non PAC) on-cluster build
taskGitClonePACTaskRef = `- name: fetch-sources
params:
- name: url
value: $(params.gitRepository)
- name: revision
value: $(params.gitRevision)
taskRef:
kind: Task
name: git-clone
workspaces:
- name: output
workspace: source-workspace
- name: cache
workspace: cache-workspace
- name: dockerconfig
workspace: dockerconfig-workspace`

taskGitCloneTaskRef = `- name: fetch-sources
params:
- name: URL
Expand Down Expand Up @@ -114,13 +96,22 @@ type templateData struct {
// createPipelineTemplatePAC creates a Pipeline template used for PAC on-cluster build
// it creates the resource in the project directory
func createPipelineTemplatePAC(f fn.Function, labels map[string]string) error {
gct, err := getGitCloneTask()
if err != nil {
return fmt.Errorf("error getting git clone task: %v", err)
}
gts, err := getTaskSpec(gct)
if err != nil {
return err
}
Comment on lines +99 to +106

Choose a reason for hiding this comment

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

New if-conditions need unit tests.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is just quick fix for 1.37.1 patch release. To properly unit test it would require a lot more re-work. We might not have enough time for that.

This branch will probably be dead after the release. No point to have test for regression.

data := templateData{
FunctionName: f.Name,
Annotations: f.Deploy.Annotations,
Labels: labels,
PipelineName: getPipelineName(f),
RunAfterFetchSources: runAfterFetchSourcesRef,
GitCloneTaskRef: taskGitClonePACTaskRef,
GitCloneTaskRef: taskGitCloneTaskRef,
GitCloneTaskSpec: gts,
}

for _, val := range []struct {
Expand Down
3 changes: 0 additions & 3 deletions pkg/pipelines/tekton/templates_pack.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,6 @@ metadata:
# The branch or tag we are targeting (ie: main, refs/tags/*)
pipelinesascode.tekton.dev/on-target-branch: "[{{.PipelinesTargetBranch}}]"

# Fetch the git-clone task from hub
pipelinesascode.tekton.dev/task: {{.GitCloneTaskRef}}

# How many runs we want to keep attached to this event
pipelinesascode.tekton.dev/max-keep-runs: "5"

Expand Down
3 changes: 0 additions & 3 deletions pkg/pipelines/tekton/templates_s2i.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,6 @@ metadata:
# The branch or tag we are targeting (ie: main, refs/tags/*)
pipelinesascode.tekton.dev/on-target-branch: "[{{.PipelinesTargetBranch}}]"

# Fetch the git-clone task from hub
pipelinesascode.tekton.dev/task: {{.GitCloneTaskRef}}

# Fetch the pipelie definition from the .tekton directory
pipelinesascode.tekton.dev/pipeline: {{.PipelineYamlURL}}

Expand Down
Loading