provider-bitbucket-server

module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2022 License: Apache-2.0

README

provider-bitbucket-server

provider-bitbucket-server is a Crossplane provider that is meant to integrate with Bitbucket Server or Bitbucket Data Center APIs.

It does not support the API for Bitbucket Cloud.

The scope of the current feature set is to provide enough resources to provision CI/CD pipelines.

Configure

Create a secret containing an API token (for a personal token, go to Profile > Manage account > Personal Access Token), and configure a Bitbucket Server ProviderConfig with a BaseURL pointing to your bitbucket server: embedmd:# (examples/provider/config.yaml yaml)

apiVersion: v1
kind: Secret
metadata:
  namespace: crossplane-system
  name: example-provider-secret
type: Opaque
stringData:
  credentials: "foo"
---
apiVersion: bitbucket-server.crossplane.io/v1alpha1
kind: ProviderConfig
metadata:
  name: example
spec:
  baseURL: https://bitbucket.company.example.com
  credentials:
    source: Secret
    secretRef:
      namespace: crossplane-system
      name: example-provider-secret
      key: credentials

Usage

The following resources can be created:

AccessKey

Set up access keys to git repositories. They can be read only or read+write. The bitbucket server has strict validation of this resource which you must know:

  • All fields are immutable except permission
  • You can't upload a key which is already used as a personal keys
  • You can't upload a key to a repo if the key already has access (for example at the project level)
apiVersion: accesskey.bitbucket-server.crossplane.io/v1alpha1
kind: AccessKey
metadata:
  name: example
spec:
  forProvider:
    projectKey: TEST
    repoName: test
    publicKey:
      key: "ssh-rsa 100"
      label: "test2"
      permission: "REPO_WRITE"
  providerConfigRef:
    name: example
Webhook

The webhook resource is fully mutable and refers to an URL which will be triggered when the configured events occur:

apiVersion: webhook.bitbucket-server.crossplane.io/v1alpha1
kind: Webhook
metadata:
  name: example
spec:
  forProvider:
    projectKey: TEST
    repoName: test
    webhook:
      name: "build-trigger"
      configuration:
        secret: "123"
      events:
        - "repo:refs_changed"
        - "repo:modified"
      url: "https://hooks.example.com/test"
  providerConfigRef:
    name: example

Developing

https://docs.atlassian.com/bitbucket-server/rest/7.10.0/bitbucket-rest.html https://docs.atlassian.com/bitbucket-server/rest/7.10.0/bitbucket-ssh-rest.html

Run against a Kubernetes cluster:

make run

Install latest into Kubernetes cluster where Crossplane is installed:

make install

Install local build into Kind cluster where Crossplane is installed:

make install-local

Build, push, and install:

make all

Build image:

make image

Push image:

make push

Build binary:

make build

Directories

Path Synopsis
Package apis contains Kubernetes API for the Template provider.
Package apis contains Kubernetes API for the Template provider.
accesskey
Package accesskey contains group Accesskey API versions
Package accesskey contains group Accesskey API versions
accesskey/v1alpha1
Package v1alpha1 contains the v1alpha1 group AccessKey resources of the Bitbucket Service provider.
Package v1alpha1 contains the v1alpha1 group AccessKey resources of the Bitbucket Service provider.
v1alpha1
Package v1alpha1 contains the core resources of the Bitbucket Server provider.
Package v1alpha1 contains the core resources of the Bitbucket Server provider.
webhook
Package webhook contains group Webhook API versions
Package webhook contains group Webhook API versions
webhook/v1alpha1
Package v1alpha1 contains the v1alpha1 group Webhook resources of the Bitbucket Service provider.
Package v1alpha1 contains the v1alpha1 group Webhook resources of the Bitbucket Service provider.
cmd
internal

Jump to

Keyboard shortcuts

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