openshift-pipelines / pipelines-as-code

Pipelines-as-Code for Tekton
https://pipelinesascode.com
Apache License 2.0
135 stars 81 forks source link

Resolve PaC params as default #1397

Open LvanLeeuwen opened 1 year ago

LvanLeeuwen commented 1 year ago

We have added some of the default Pipelines-as-code parameters to the parameter list of the PipelineRun like this:

params:
  - name: REPO_NAME
    value: "{{ repo_name }}"
  - name: REPO_URL
    value: "{{ repo_url }}"
  - name: REVISION
    value: "{{ revision }}"
  - name: BRANCH
    value: "{{ source_branch }}"
  - name: PULL_REQUEST_NUMBER
    value: "{{ pull_request_number }}"

Adding these values as a default in the Pipeline spec and omitting it in the PipelineRun doesn't seem to resolve the params. Pipeline.yaml:

params:
  - name: REPO_NAME
    default: "{{ repo_name }}"
  - name: REVISION
  - name: BRANCH
  - name: PULL_REQUEST_NUMBER

PipelineRun.yaml:

params:
  - name: REPO_URL
    value: "{{ repo_url }}"
  - name: REVISION
    value: "{{ revision }}"
  - name: BRANCH
    value: "{{ source_branch }}"
  - name: PULL_REQUEST_NUMBER
    value: "{{ pull_request_number }}"

For example when using a github-set-status task I get the following error: http.client.InvalidURL: URL can't contain control characters. '/repos/< organisation>/{{ repo_name }}/statuses/< sha>' (found at least ' ')

Would it be possible to enable using pipelines-as-code parameters as default values in the pipeline spec?

chmouel commented 1 year ago

yeah, we don't resolve params on remote resources..

I am not against adding it.. (as well having remote tasks from remote pipeline annotations).

any chance you can fill in a RFE on red hat access so we can prioritize this?

Waterstraal commented 1 year ago

yeah, we don't resolve params on remote resources..

I am not against adding it.. (as well having remote tasks from remote pipeline annotations).

any chance you can fill in a RFE on red hat access so we can prioritize this?

Hi @chmouel, I'll be happy to pick that up. Could you explain what an RFE entails, and how the process works of filling one in on Red Hat Access works?

Waterstraal commented 1 year ago

@chmouel I created an RFE: https://access.redhat.com/support/cases/#/case/03620521