openshift-pipelines / pipelines-as-code

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

`auto-configure` setting does not create a namespace and Repository CRD #1152

Open Stringls opened 1 year ago

Stringls commented 1 year ago

Hi, folks!

I set the value for auto-configure-new-github-repo to True

apiVersion: v1
data:
  application-name: Pipelines as Code CI
  auto-configure-new-github-repo: "true"
  auto-configure-repo-namespace-template: "{{repo_name}}-pipeline"
  bitbucket-cloud-additional-source-ip: ""
  bitbucket-cloud-check-source-ip: "true"
  default-max-keep-runs: ""
  error-detection-from-container-logs: "false"
  error-detection-max-number-of-lines: "50"
  error-detection-simple-regexp: |
    ^(?P<filename>[^:]*):(?P<line>[0-9]+):(?P<column>[0-9]+):([ ]*)?(?P<error>.*)
  error-log-snippet: "true"
  hub-catalog-name: tekton
  hub-url: https://api.hub.tekton.dev/v1
  max-keep-run-upper-limit: ""
  remote-tasks: "true"
  secret-auto-create: "true"
  secret-github-app-scope-extra-repos: "Stringls/artie"
  secret-github-app-token-scoped: "true"
  tekton-dashboard-url: ""
kind: ConfigMap
metadata:
  labels:
    app.kubernetes.io/part-of: pipelines-as-code
    app.kubernetes.io/version: v0.15.5
  name: pipelines-as-code
  namespace: pipelines-as-code

But when I try to add a new repository to my CI workflow it fails because of no namespace created

cannot find a namespace match for https://github.com/Stringls/test-repo

Logs of the controller

{"level":"info","ts":1676371985.5279555,"caller":"params/run.go:67","msg":"added or modifies events are coming"}
{"level":"info","ts":1676371985.5282037,"caller":"settings/config.go:150","msg":"CONFIG: auto configure repo namespace template set to {{repo_name}}-pipelines"}
{"level":"info","ts":1676371985.5285232,"caller":"settings/config.go:150","msg":"CONFIG: auto configure repo namespace template set to {{repo_name}}-pipelines"}
{"level":"info","ts":1676371985.5287163,"caller":"settings/config.go:150","msg":"CONFIG: auto configure repo namespace template set to {{repo_name}}-pipelines"}
{"level":"info","ts":1676371985.5289354,"caller":"settings/config.go:150","msg":"CONFIG: auto configure repo namespace template set to {{repo_name}}-pipelines"}
{"level":"info","ts":1676371985.5291998,"caller":"settings/config.go:150","msg":"CONFIG: auto configure repo namespace template set to {{repo_name}}-pipelines"}
{"level":"info","ts":1676371985.5294359,"caller":"settings/config.go:150","msg":"CONFIG: auto configure repo namespace template set to {{repo_name}}-pipelines"}
{"level":"info","ts":1676371985.5296552,"caller":"settings/config.go:150","msg":"CONFIG: auto configure repo namespace template set to {{repo_name}}-pipelines"}
{"level":"info","ts":1676371998.6787953,"caller":"params/run.go:67","msg":"added or modifies events are coming"}
{"severity":"INFO","timestamp":"2023-02-14T10:53:18.840178376Z","logger":"pipelinesascode","caller":"github/parse_payload.go:323","message":"issue_comment: pipelinerun recheck on Stringls/test-repo#1 has been requested","commit":"6134468","provider":"github","event-id":"c9dac9f0-ac55-11ed-9511-8b0f26e8d8a9"}
{"severity":"WARNING","timestamp":"2023-02-14T10:53:19.822759568Z","logger":"pipelinesascode","caller":"events/emit.go:49","message":"cannot find a namespace match for https://github.com/Stringls/test-repo","commit":"6134468","provider":"github","event-id":"c9dac9f0-ac55-11ed-9511-8b0f26e8d8a9","event-sha":"11d4a0861e3ee870e41f6b98728fc1e547f7f489","event-type":"pull_request"}
{"level":"info","ts":1676372328.199323,"caller":"params/run.go:67","msg":"added or modifies events are coming"}
{"severity":"INFO","timestamp":"2023-02-14T10:58:48.407716956Z","logger":"pipelinesascode","caller":"github/parse_payload.go:323","message":"issue_comment: pipelinerun recheck on Stringls/test-repo#1 has been requested","commit":"6134468","provider":"github","event-id":"8e51e4d0-ac56-11ed-9549-b8bebda641c4"}
{"severity":"WARNING","timestamp":"2023-02-14T10:58:49.610422466Z","logger":"pipelinesascode","caller":"events/emit.go:49","message":"cannot find a namespace match for https://github.com/Stringls/test-repo","commit":"6134468","provider":"github","event-id":"8e51e4d0-ac56-11ed-9549-b8bebda641c4","event-sha":"11d4a0861e3ee870e41f6b98728fc1e547f7f489","event-type":"pull_request"}
{"level":"info","ts":1676372393.743666,"caller":"params/run.go:67","msg":"added or modifies events are coming"}
{"level":"info","ts":1676372393.7437074,"caller":"params/run.go:67","msg":"added or modifies events are coming"}
{"level":"info","ts":1676372393.7442343,"caller":"params/run.go:67","msg":"added or modifies events are coming"}
{"level":"info","ts":1676372393.7466435,"caller":"params/run.go:67","msg":"added or modifies events are coming"}
{"level":"info","ts":1676372393.7474515,"caller":"params/run.go:67","msg":"added or modifies events are coming"}
{"level":"info","ts":1676372393.7479708,"caller":"params/run.go:67","msg":"added or modifies events are coming"}
{"level":"info","ts":1676372393.7482412,"caller":"params/run.go:67","msg":"added or modifies events are coming"}
{"level":"info","ts":1676372393.7484522,"caller":"params/run.go:67","msg":"added or modifies events are coming"}
{"level":"info","ts":1676372393.7487464,"caller":"params/run.go:67","msg":"added or modifies events are coming"}
{"level":"info","ts":1676372393.7489028,"caller":"params/run.go:67","msg":"added or modifies events are coming"}
{"level":"info","ts":1676372393.7494297,"caller":"params/run.go:67","msg":"added or modifies events are coming"}
{"level":"info","ts":1676372393.7494602,"caller":"params/run.go:67","msg":"added or modifies events are coming"}
{"level":"info","ts":1676372393.7498295,"caller":"params/run.go:67","msg":"added or modifies events are coming"}
{"level":"info","ts":1676372393.7499232,"caller":"params/run.go:67","msg":"added or modifies events are coming"}
{"level":"info","ts":1676372393.750522,"caller":"params/run.go:67","msg":"added or modifies events are coming"}
{"level":"info","ts":1676372393.750867,"caller":"params/run.go:67","msg":"added or modifies events are coming"}
{"level":"info","ts":1676372393.7513514,"caller":"params/run.go:67","msg":"added or modifies events are coming"}
{"level":"info","ts":1676372393.751612,"caller":"params/run.go:67","msg":"added or modifies events are coming"}
{"level":"info","ts":1676372393.7517872,"caller":"params/run.go:67","msg":"added or modifies events are coming"}
{"level":"info","ts":1676372393.750968,"caller":"params/run.go:67","msg":"added or modifies events are coming"}
{"level":"info","ts":1676372393.7522094,"caller":"params/run.go:67","msg":"added or modifies events are coming"}
{"level":"info","ts":1676372393.752581,"caller":"params/run.go:67","msg":"added or modifies events are coming"}
{"level":"info","ts":1676372393.7528944,"caller":"params/run.go:67","msg":"added or modifies events are coming"}
{"level":"info","ts":1676372393.7548778,"caller":"settings/config.go:150","msg":"CONFIG: auto configure repo namespace template set to {{repo_name}}-pipeline"}
{"level":"info","ts":1676372399.0063024,"caller":"params/run.go:67","msg":"added or modifies events are coming"}
{"severity":"INFO","timestamp":"2023-02-14T10:59:59.187973535Z","logger":"pipelinesascode","caller":"github/parse_payload.go:323","message":"issue_comment: pipelinerun recheck on Stringls/test-repo#1 has been requested","commit":"6134468","provider":"github","event-id":"b8893c80-ac56-11ed-8403-2c5418ce102a"}
{"severity":"WARNING","timestamp":"2023-02-14T11:00:00.232242023Z","logger":"pipelinesascode","caller":"events/emit.go:49","message":"cannot find a namespace match for https://github.com/Stringls/test-repo","commit":"6134468","provider":"github","event-id":"b8893c80-ac56-11ed-8403-2c5418ce102a","event-sha":"11d4a0861e3ee870e41f6b98728fc1e547f7f489","event-type":"pull_request"}

What I am doing wrong?

sm43 commented 1 year ago

hello 👋🏽 does your GitHub app configured for repository event? :)

cmoulliard commented 1 year ago

I'm also getting the same message on my PR - https://github.com/ch007m/pac-demo/pull/1/checks. The github app has been created according to the following doc page: https://pipelinesascode.com/docs/install/github_apps/#setup-manually

Log of the pipeline controller reports

{"severity":"ERROR","timestamp":"2023-03-06T16:43:32.833672077Z","logger":"pipelinesascode","caller":"events/emit.go:45","message":"Cannot create status: could not validate payload, check
your webhook secret?: payload signature check failed: cannot set status on github no token or url set","commit":"c08c907","provider":"github","event-id":"0789f7b0-bc3e-11ed-86be-d5145d8cee
db","event-sha":"8d6cc510ecd0ce998e4482f8a38f2e0b0ce73d77","event-type":"pull_request","stacktrace":"github.com/openshift-pipelines/pipelines-as-code/pkg/events.(*EventEmitter).EmitMessage
\n\t/src/pkg/events/emit.go:45\ngithub.com/openshift-pipelines/pipelines-as-code/pkg/pipelineascode.(*PacRun).Run\n\t/src/pkg/pipelineascode/pipelineascode.go:57\ngithub.com/openshift-pipe
lines/pipelines-as-code/pkg/adapter.(*sinker).processEvent\n\t/src/pkg/adapter/sinker.go:52\ngithub.com/openshift-pipelines/pipelines-as-code/pkg/adapter.listener.handleEvent.func1.2\n\t/s
rc/pkg/adapter/adapter.go:189"}
sm43 commented 1 year ago

yeah the event is missing there, as it is an optional feature https://pipelinesascode.com/docs/install/settings/ here you can see

auto-configure-new-github-repo

If you have a GitHub App already setup then verify if the `repository` event is subscribed into your Github App setting.

also to clarify this feature is for new repositories created in your github user/org will be auto-configured by creating a namespace and repository CR.

cc @chmouel

anton-livewyer commented 5 months ago

@sm43 Is there any plans to support the existent repos for this automation feature as well? E.g. I have the existent repo and I want to simply add the pipelinerun definition into .tekton/ folder to enable CI on it

chmouel commented 5 months ago

@anton-livewyer there is no plans for this at the moment. having a catch all namespace for all pipeline may be something we can have with a regexp kind of matching for the repo URL but that's not planned at the moment...