pullrequest-operator

command module
v0.1.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 13, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

README

Pull Request Operator

The Pull Request operator checks a target branch in a repository for new pull requests at a specified interval.

Workflow

Installation

Run the following command:

kubectl apply -f https://github.com/jquad-group/pullrequest-operator/releases/latest/download/release.yaml

The operator is installed in the pullrequest-operator-system namespace.

After the installation of the operator, the PullRequest resource is added to the kubernetes cluster.

Specification

Bitbucket

For the bitbucket provider a rest endpoint url must be specified, a project and the repository where the code resides. Currently only Bitbucket Server is supported.

apiVersion: pipeline.jquad.rocks/v1alpha1
kind: PullRequest
metadata:
  name: pullrequest-bitbucket-sample
spec:
  gitProvider:
    provider: Bitbucket
    secretRef: bitbucket-secret
    bitbucket:
      restEndpoint: https://bitbucket.jquad.rocks/rest
      project: jquad
      repository: microservice
  targetBranch: 
    name: refs/heads/main
  interval: 1m

Github

For the github provider one must specifiy the url to the repository, the owner and the repository name.

apiVersion: pipeline.jquad.rocks/v1alpha1
kind: PullRequest
metadata:
  name: pullrequest-bitbucket-sample
spec:
  gitProvider:
    provider: Github
    secretRef: github-secret
    github:
      url: https://github.com/rannox/microservice.git
      owner: rannox
      repository: microservice
  targetBranch: 
    name: refs/heads/main
  interval: 1m

Authentication and Authorization

The Github and Bitbucket providers accept only an access token.

Bitbucket

In order to create an access token, go to Profile->Account settings->HTTP access tokens->create token. Encode the created token in base64 and save the value in a kubernetes Secret with the key accessToken:

apiVersion: v1
data:
  accessToken: BASE64
kind: Secret
metadata:
  name: bitbucket-secret
type: Opaque

GitHub

apiVersion: v1
data:
  accessToken: BASE64 Personal Access Token
kind: Secret
metadata:
  name: github-secret
type: Opaque

Status Example

The following status is created after a successful pull for the pull requests:

Status:
  Conditions:
    Last Transition Time:  2022-04-14T17:38:29Z
    Message:               Source branches reconciliation is successful.
    Observed Generation:   1
    Reason:                Succeded
    Status:                True
    Type:                  Success
  Source Branches:
    Branches:
      Commit:   e75d9b5beaf8dc12ac19ec0f72d254ad32edcc19
      Details:  {} # JSON representation of the response from Bitbucket or Github
      Name:     feature-kaniko

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
api
v1alpha1
Package v1alpha1 contains API Schema definitions for the pipeline v1alpha1 API group +kubebuilder:object:generate=true +groupName=pipeline.jquad.rocks
Package v1alpha1 contains API Schema definitions for the pipeline v1alpha1 API group +kubebuilder:object:generate=true +groupName=pipeline.jquad.rocks
pkg
git

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL