awscodecommitsource

command
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

README

AWS CodeCommit event source for Knative Eventing

This event source consumes messages from a AWS CodeCommit repository and sends them as CloudEvents to an arbitrary event sink.

Contents

  1. Prerequisites
  2. Deployment to Kubernetes
  3. Running locally

Prerequisites

Deployment to Kubernetes

The AWS CodeCommit event source can be deployed to Kubernetes in different manners:

  • As an AWSCodeCommitSource object, to a cluster where the TriggerMesh AWS Sources Controller is running.
  • As a Knative ContainerSource, to any cluster running Knative Eventing.

ℹ The sample manifests below reference AWS credentials (Access Key) from a Kubernetes Secret object called awscreds. This Secret can be generated with the following command:

$ kubectl -n <my_namespace> create secret generic awscreds \
  --from-literal=aws_access_key_id=<my_key_id> \
  --from-literal=aws_secret_access_key=<my_secret_key>

Alternatively, credentials can be used as literal strings instead of references to Kubernetes Secrets by replacing valueFrom attributes with value inside API objects' manifests.

As a AWSCodeCommitSource object

Copy the sample manifest from config/samples/awscodecommitsource.yaml and replace the pre-filled spec attributes with the values corresponding to your AWS CodeCommit repository. Then, create that AWSCodeCommitSource object in your Kubernetes cluster:

$ kubectl -n <my_namespace> create -f my-awscodecommitsource.yaml
As a ContainerSource object

Copy the sample manifest from config/samples/awscodecommit-containersource.yaml and replace the pre-filled environment variables under env with the values corresponding to your AWS CodeCommit repository. Then, create that ContainerSource object in your Kubernetes cluster:

$ kubectl -n <my_namespace> create -f my-awscodecommit-containersource.yaml
As a Deployment object bound by a SinkBinding

Copy the sample manifest from config/samples/awscodecommit-sinkbinding.yaml and replace the pre-filled environment variables under env with the values corresponding to your AWS CodeCommit repository. Then, create the Deployment and SinkBinding objects in your Kubernetes cluster:

$ kubectl -n <my_namespace> create -f my-awscodecommit-sinkbinding.yaml

Running locally

Running the event source on your local machine can be convenient for development purposes.

In the shell

Ensure the following environment variables are exported to your current shell's environment:

export ARN=<arn_of_my_codecommit_repo>
export BRANCH=<my_git_branch>
export EVENT_TYPES=push,pull_request
export AWS_ACCESS_KEY_ID=<my_key_id>
export AWS_SECRET_ACCESS_KEY=<my_secret_key>
export NAME=my-awscodecommitsource
export NAMESPACE=default
export K_SINK=http://<url_of_event_sink>
export K_LOGGING_CONFIG=''
export K_METRICS_CONFIG='{"domain":"triggermesh.io/sources", "component":"awscodecommitsource", "configMap":{}}'

Then, run the event source with:

$ go run ./cmd/awscodecommitsource
In a Docker container

Using one of TriggerMesh's release images:

$ docker run --rm \
  -e ARN=<arn_of_my_codecommit_repo> \
  -e BRANCH=<my_git_branch> \
  -e EVENT_TYPES=push,pull_request \
  -e AWS_ACCESS_KEY_ID=<my_key_id> \
  -e AWS_SECRET_ACCESS_KEY=<my_secret_key> \
  -e NAME=my-awscodecommitsource \
  -e NAMESPACE=default \
  -e K_SINK=http://<url_of_event_sink> \
  -e K_LOGGING_CONFIG='' \
  -e K_METRICS_CONFIG='{"domain":"triggermesh.io/sources", "component":"awscodecommitsource", "configMap":{}}' \
  gcr.io/triggermesh/awscodecommitsource:latest

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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