Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentations for using tekton with Prow #13874

Closed
yfei1 opened this issue Aug 13, 2019 · 14 comments
Closed

Documentations for using tekton with Prow #13874

yfei1 opened this issue Aug 13, 2019 · 14 comments
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Comments

@yfei1
Copy link

yfei1 commented Aug 13, 2019

I'm working on migrating a CI pipeline from Google Cloud Build to Prow, yet couldn't figure out a way to let the Prow native Kubernetes agent runs sequentially. It seems like Tekton agent provides the pipeline feature but I couldn't find related documentations for setting up Tekton with Prow.

Issue in Tekton: tektoncd/pipeline#1187

@stevekuznetsov
Copy link
Contributor

/cc @ccojocar @JoelSpeed @cjwagner

@JoelSpeed
Copy link
Contributor

Our experience is that there isn't really documentation at the moment, that said we did manage to get a working pipeline.

You'll need to:

Note the PROW_IMPLICIT_GIT_REF in the Presubmit definition. This is some Prow magic that will be replaced by a PipelineResource pointing to the Git repo and commit you are testing. (This took me a while to figure out). This will then act as an input to your Pipeline which you can then pass as input to your tasks.

While this works and the pipeline runs, there is very little observability into the runs at present which means I can't recommend pushing this to "production", the issues we identified that block us are:

I don't know if any of this has changed since we made our evaluation a few weeks ago, I know this is a very active area of development for Prow at present and things are moving quite quickly

@ccojocar
Copy link
Member

I wanted to write some docs for installation since quite a while but I haven't had much time. Thanks @JoelSpeed for providing some details above. The install process is a bit tedious at the moment.

@bobcatfish
Copy link
Contributor

No persistent logs from pipeline runs

Issue in the tekton backlog possibly relevant to your interests @JoelSpeed : tektoncd/pipeline#1155 ( + @sbwsg )

bobcatfish added a commit to bobcatfish/catservice that referenced this issue Aug 16, 2019
bobcatfish added a commit to bobcatfish/catservice that referenced this issue Aug 16, 2019
Thanks to kubernetes/test-infra#13874 (comment)

SOOOOOON

Questioning your own mental health (yeah) it's like a maze within itself
bobcatfish added a commit to bobcatfish/catservice that referenced this issue Aug 16, 2019
Thanks to kubernetes/test-infra#13874 (comment)

SOOOOOON

Questioning your own mental health (yeah) it's like a maze within itself

0.2.0 of pipelines is gonna be the one, i know it
@bobcatfish
Copy link
Contributor

Thanks for writing this up @JoelSpeed !! I was able to get Prow + Pipeline working thanks to this write up :D

Quick note: it looks like the crier component is also required now when the agent type is something other than kubernetes ( thanks @krzyzacy + @BenTheElder !! ❤️ )

bobcatfish added a commit to bobcatfish/plumbing that referenced this issue Aug 19, 2019
A step toward tektoncd/pipeline#922 !

This commit adds configuration and supporting docs to get Prow to
execute a simple Pipeline on every pull request to the plumbing repo.

I am also working on docs in the Prow repo
(for kubernetes/test-infra#13874 and
tektoncd/pipeline#1187) to explain how
one could put this all together from scratch.

One important caveat is that we were previously using the Tekton
installation in this cluster to do manual releases, and we were keeping
our release configuration up to date with the latest version of Tekton
Pipelines. Because of kubernetes/test-infra#13948
the newest version we can use with Prow is v0.3.1 so we need to keep our
release configs in sync with this for now ( attn folks doing releases
@vdemeester @a-roberts @mnuttall - the next thing I want to do is add
release automation via Prow so hopefully this won't impact you for
long!)

Note I have already manually applied this configuration to the cluster 🙏
bobcatfish added a commit to bobcatfish/test-infra-1 that referenced this issue Aug 19, 2019
This commit adds the beginning of some usage documentation about how to
get Tekton and Prow working.

I wouldn't have been able to do this without @JoelSpeed's guidance in
kubernetes#13874 (comment)
Thanks @JoelSpeed!!! ❤️

I was able to follow along with these docs and get Tekton + Prow running
for `tektoncd` itself: tektoncd/plumbing#66 🎉

Fixes kubernetes#13874
bobcatfish added a commit to bobcatfish/test-infra-1 that referenced this issue Aug 19, 2019
This commit adds the beginning of some usage documentation about how to
get Tekton and Prow working.

I wouldn't have been able to do this without @JoelSpeed's guidance in
kubernetes#13874 (comment)
Thanks @JoelSpeed!!! ❤️

I was able to follow along with these docs and get Tekton + Prow running
for `tektoncd` itself: tektoncd/plumbing#66 🎉

Fixes kubernetes#13874
bobcatfish added a commit to bobcatfish/test-infra-1 that referenced this issue Aug 19, 2019
This commit adds the beginning of some usage documentation about how to
get Tekton and Prow working.

I wouldn't have been able to do this without JoelSpeed's guidance in
kubernetes#13874 (comment)
Thanks JoelSpeed!!! ❤️

I was able to follow along with these docs and get Tekton + Prow running
for `tektoncd` itself: tektoncd/plumbing#66 🎉

This is being done for kubernetes#13874
tekton-robot pushed a commit to tektoncd/plumbing that referenced this issue Aug 20, 2019
A step toward tektoncd/pipeline#922 !

This commit adds configuration and supporting docs to get Prow to
execute a simple Pipeline on every pull request to the plumbing repo.

I am also working on docs in the Prow repo
(for kubernetes/test-infra#13874 and
tektoncd/pipeline#1187) to explain how
one could put this all together from scratch.

One important caveat is that we were previously using the Tekton
installation in this cluster to do manual releases, and we were keeping
our release configuration up to date with the latest version of Tekton
Pipelines. Because of kubernetes/test-infra#13948
the newest version we can use with Prow is v0.3.1 so we need to keep our
release configs in sync with this for now ( attn folks doing releases
@vdemeester @a-roberts @mnuttall - the next thing I want to do is add
release automation via Prow so hopefully this won't impact you for
long!)

Note I have already manually applied this configuration to the cluster 🙏
bobcatfish added a commit to bobcatfish/test-infra-1 that referenced this issue Aug 20, 2019
This commit adds the beginning of some usage documentation about how to
get Tekton and Prow working.

I wouldn't have been able to do this without JoelSpeed's guidance in
kubernetes#13874 (comment)
Thanks JoelSpeed!!! ❤️

I was able to follow along with these docs and get Tekton + Prow running
for `tektoncd` itself: tektoncd/plumbing#66 🎉

This is being done for kubernetes#13874
bobcatfish added a commit to bobcatfish/test-infra-1 that referenced this issue Sep 19, 2019
This commit adds the beginning of some usage documentation about how to
get Tekton and Prow working.

I wouldn't have been able to do this without JoelSpeed's guidance in
kubernetes#13874 (comment)
Thanks JoelSpeed!!! ❤️

I was able to follow along with these docs and get Tekton + Prow running
for `tektoncd` itself: tektoncd/plumbing#66 🎉

This is being done for kubernetes#13874
@eddycharly
Copy link
Member

Is there a way to construct the PipelineResource differently than with the PROW_IMPLICIT_GIT_REF magic ?

Some kind of template in the pipeline_run_spec maybe ?

My goal is to pass the branch name to the pipeline, i guess prow uses the commit hash as revision argument to the PipelineResource. I tried to use ${inputs.resources.git.revision} in my task and it is indeed the commit hash.

Is there a way to pass the branch name to the pipeline in a separate argument ?

@cjwagner
Copy link
Member

I'm not sure how constructing the PipelineResource differently would help you pass the branch name to the pipeline, but if your goal is to just determine the branch name from within a pipeline you can already do that using the PULL_BASE_REF pipeline parameter. All ProwJob environment variables are defined here and pipeline ProwJobs use pipeline Params to pass the values instead of actual environment variables.

// Add parameters instead of env vars.
env, err := downwardapi.EnvForSpec(downwardapi.NewJobSpec(pj.Spec, buildID, pj.Name))
if err != nil {
return nil, nil, err
}
for _, key := range sets.StringKeySet(env).List() {
val := env[key]
// TODO: make this handle existing values/substitutions.
p.Spec.Params = append(p.Spec.Params, pipelinev1alpha1.Param{
Name: key,
Value: val,
})
}

@eddycharly
Copy link
Member

@cjwagner i just checked, prow injects the variables in the PipelineRun resource like this :

  params:
  - name: BUILD_ID
    value: "1188889208643653632"
  - name: JOB_NAME
    value: tekton
  - name: JOB_TYPE
    value: presubmit
  - name: PROW_JOB_ID
    value: ee0b566e-f9b2-11e9-a511-06179cedbf44
  - name: PULL_BASE_REF
    value: master
...

PULL_BASE_REF contains the target branch of the pull request, is there any way to have the source branch also ?

@cjwagner
Copy link
Member

No, the source branch is a branch from the source repo which can be the upstream repo, but is typically a fork repo, so the source branch doesn't necessarily exist in the upstream repo that the presubmit checks out. Why do you need to know the name of the source branch given that it doesn't necessarily even exist in the repo we are checking out?

@eddycharly
Copy link
Member

I see your point, I didn’t think about forks.
I wanted to setup an environment related to the pull request, I will use the pull request number instead as it is available.
Thanks.

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 26, 2020
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Feb 25, 2020
@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@k8s-ci-robot
Copy link
Contributor

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants