Skip to content
Merged
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
5 changes: 5 additions & 0 deletions .github/workflows/test-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ jobs:
run: ./hack/allocate.sh
- name: Setup testing images
run: ./hack/setup-testing-images.sh
- name: Install RH pull secrets for KinD cluster
env:
RH_REG_USR: ${{ secrets.REGISTRY_REDHAT_IO_USERNAME }}
RH_REG_PWD: ${{ secrets.REGISTRY_REDHAT_IO_PASSWORD }}
run: ./hack/install-pull-secrets.sh
- name: Install Tekton
run: ./hack/install-tekton.sh
- name: Install Pipelines as Code
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/test-podman.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ jobs:
run: ./hack/registry.sh
- name: Setup testing images
run: ./hack/setup-testing-images.sh
- name: Install RH pull secrets for KinD cluster
env:
RH_REG_USR: ${{ secrets.REGISTRY_REDHAT_IO_USERNAME }}
RH_REG_PWD: ${{ secrets.REGISTRY_REDHAT_IO_PASSWORD }}
run: ./hack/install-pull-secrets.sh
- name: Install Tekton
run: ./hack/install-tekton.sh
- name: Integration Test Podman
env:
FUNC_REPO_REF: ${{ github.event.pull_request.head.repo.full_name }}
Expand Down
252 changes: 252 additions & 0 deletions hack/git-clone.yaml

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions hack/install-tekton.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ install_tekton() {
echo "${green}✅ Tekton${reset}"
}

install_ocp_git_clone_task() {
echo "Installing Openshift Pipelines specific task"
kubectl apply -f "$(dirname "$(realpath "$0")")/git-clone.yaml"
}

# Invoke only when run directly
# Be a library when sourced
if [ "$0" = "${BASH_SOURCE[0]}" ]; then
Expand All @@ -50,6 +55,7 @@ if [ "$0" = "${BASH_SOURCE[0]}" ]; then

function main() {
install_tekton
install_ocp_git_clone_task
}
main "$@"
fi
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
}
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