Uploaded image for project: 'OpenShift Bugs'
  1. OpenShift Bugs
  2. OCPBUGS-15410

[release-4.13] Add Git Repository (PAC) doesn't setup GitLab and Bitbucket configuration correct

    XMLWordPrintable

Details

    • Important
    • Rejected
    • False
    • Hide

      None

      Show
      None
    • Hide
      * Previously, if you used the *Pipelines* page of the *Developer* console to add a repository, and you entered a GitLab or Bitbucket Pipelines as Code repository URL as the *Git Repo URL*, the created `Repository` resource was invalid. This was caused by a missing schema issue in the `git_provider.url` spec, which is now fixed. (link:https://issues.redhat.com/browse/OCPBUGS-15410[*OCPBUGS-15410*])
      * In this release, the `git_provider.user` spec has been added for Pipelines as Code `Repository` objects. This spec requires you to provide a username if the Git provider is Bitbucket. (link:https://issues.redhat.com/browse/OCPBUGS-15410[*OCPBUGS-15410*])
      * In this release, the *Secret* field in the *Pipelines* -> *Create* -> *Add Git Repository* page is now mandatory. You must click *Show configuration options*, and then configure either a Git access token or a Git access token secret for your repository. (link:https://issues.redhat.com/browse/OCPBUGS-15410[*OCPBUGS-15410*])
      Show
      * Previously, if you used the *Pipelines* page of the *Developer* console to add a repository, and you entered a GitLab or Bitbucket Pipelines as Code repository URL as the *Git Repo URL*, the created `Repository` resource was invalid. This was caused by a missing schema issue in the `git_provider.url` spec, which is now fixed. (link: https://issues.redhat.com/browse/OCPBUGS-15410 [* OCPBUGS-15410 *]) * In this release, the `git_provider.user` spec has been added for Pipelines as Code `Repository` objects. This spec requires you to provide a username if the Git provider is Bitbucket. (link: https://issues.redhat.com/browse/OCPBUGS-15410 [* OCPBUGS-15410 *]) * In this release, the *Secret* field in the *Pipelines* -> *Create* -> *Add Git Repository* page is now mandatory. You must click *Show configuration options*, and then configure either a Git access token or a Git access token secret for your repository. (link: https://issues.redhat.com/browse/OCPBUGS-15410 [* OCPBUGS-15410 *])
    • Bug Fix
    • Done
    • Release Notes

    Description

      Description of problem:
      When adding a "Git Repository" (a tekton or pipelines Repository) and enter a GitLab or Bitbucket PAC repository the created Repository resource is invalid.

      Version-Release number of selected component (if applicable):
      411-4.13

      How reproducible:
      Always

      Steps to Reproduce:
      Setup a PAC git repo, you can mirror these projects if you want: https://github.com/jerolimov/nodeinfo-pac

      For GitHub you need setup

      1. an account-global "private access token" > a classic access token, see https://github.com/settings/tokens
      2. a repo > webhook

      For GitLab:

      1. a repo > Project Access Tokens
      2. a repo > webhook

      For Bitbucket:

      1. an account-global "app password, see https://bitbucket.org/account/settings/app-passwords/
      2. a repo > webhook

      On a cluster bot instance:

      1. Install OpenShift Pipelines operator
      2. Navigate to Developer perspective > Pipelines
      3. Select Create > Repository
      4. Enter a GitLab based git repository with Git access token and Webhook secret
      5. Enter a Bitbucket based git repository with Git access token (webhook secret isn't supported)

      Actual results:
      The GitLab created resource looks like this:

      apiVersion: pipelinesascode.tekton.dev/v1alpha1
      kind: Repository
      metadata:
        name: gitlab-nodeinfo-pac
      spec:
        git_provider:
          secret:
            key: provider.token
            name: gitlab-nodeinfo-pac-token-gfr66
          url: gitlab.com   # missing schema
          webhook_secret:
            key: webhook.secret
            name: gitlab-nodeinfo-pac-token-gfr66
        url: 'https://gitlab.com/jerolimov/nodeinfo-pac'
      

      The Bitbucket resource looks like this:

      apiVersion: pipelinesascode.tekton.dev/v1alpha1
      kind: Repository
      metadata:
        name: bitbucket-nodeinfo-pac
      spec:
        git_provider:
          secret:
            key: provider.token
            name: bitbucket-nodeinfo-pac-token-9pf75
          url: bitbucket.org   # missing schema and invalid API URL !
          webhook_secret:   # don't entered a webhook URL, see OCPBUGS-7035
            key: webhook.secret
            name: bitbucket-nodeinfo-pac-token-9pf75
        url: 'https://bitbucket.org/jerolimov/nodeinfo-pac'
      

      The pipeline-as-code controller Pod log contains some error messages and no PipelineRun is created.

      Expected results:
      For GitLab:

      1. The spec.git_provider.url should contain the schema https://, so it should be https://gitlab.com, or can be removed completely. Both work fine.
        A working example:
      apiVersion: pipelinesascode.tekton.dev/v1alpha1
      kind: Repository
      metadata:
        name: gitlab-nodeinfo-pac
      spec:
        git_provider:
          secret:
            key: provider.token
            name: gitlab-nodeinfo-pac-token-gfr66
          url: https://gitlab.com
          webhook_secret:
            key: webhook.secret
            name: gitlab-nodeinfo-pac-token-gfr66
        url: 'https://gitlab.com/jerolimov/nodeinfo-pac'
      

      Bitbucket:

      1. The spec.git_provider.url should be https://api.bitbucket.org/2.0, or can be removed completely. Both work fine.
      2. The Account Secret needs also a Bitbucket login name, passed as spec.git_provider.user.

      A working example:

      apiVersion: pipelinesascode.tekton.dev/v1alpha1
      kind: Repository
      metadata:
        name: bitbucket-nodeinfo-pac
      spec:
        git_provider:
          user: jerolimov
          secret:
            key: provider.token
            name: bitbucket-nodeinfo-pac-token-9pf75
          webhook_secret:
            key: webhook.secret
            name: bitbucket-nodeinfo-pac-token-9pf75
        url: 'https://bitbucket.org/jerolimov/nodeinfo-pac'
      

      A PipelineRun should be created for each push to the git repo.

      Additional info:

      1. Bitbucket use a small 2nd b.
      2. For the Bitbucket issue see also https://github.com/openshift-pipelines/pipelines-as-code/issues/416

      Attachments

        Issue Links

          Activity

            People

              rh-ee-lprabhu Lokananda Prabhu
              cjerolim Christoph Jerolimov
              Sanket Pathak Sanket Pathak
              Ashleigh Brennan Ashleigh Brennan
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: