We recently upgraded our Kubernetes cluster and due to that, we had to upgrade Tekton and Prow. After the upgrade, we had to make changes to the Prow job's pre and postsubmit config and we had to change PROW_IMPLICIT_GIT_REF to git which is a PipelineResource.
Now the issue is, with the earlier version due to PROW_IMPLICIT_GIT_REF we could see a diff of the changes that we are pushing to the Environment. Now there is no way to get a diff of the changes we are pushing. We tried creating our own param and passing it from the Prow job to PipelineResource but that also is not working as it is not getting the value for the git branch. Below is the pipeline resource we are using and the Prow job config is also given below. We tried various params like params.branch or directly passing PULL_BASE_REF to the PipelineResource but nothing worked.
Can anyone help me with how we can pass the git branch info from prow job to tekton pipelineresource and this way we can pass the correct branch name to the helm diff command and get the diff of the changes we are pushing.
Prow-job:
presubmits:
Org/env-state:
- name: job-name
namespace: tekton-pipelines
agent: tekton-pipeline
max_concurrency: 1
clone_uri: <git-url>
run_if_changed: "^folder/somefiles.yaml"
branches:
- ^master$
pipeline_run_spec:
pipelineRef:
name: upgrade-env-pipeline
params:
- name: cluster-name
value: test
- name: DRY_RUN
value: "true"
- name: CMD_IMAGE
value: pipeline-infra
- name: CMD_BRANCH
value: master
- name: BRANCH_NAME
value: $(PULL_BASE_REF)
resources:
- name: git
resourceRef:
name: git
PipelineResource:
apiVersion: tekton.dev/v1alpha1
kind: PipelineResource
metadata:
name: git
namespace: tekton-pipelines
spec:
params:
- name: revision
value: $(params.BRANCH_NAME)
- name: url
value: <git-url>
type: git