Skip to content

Commit

Permalink
add CI and project.yml (open-telemetry#1)
Browse files Browse the repository at this point in the history
* add CI and project.yml

* add caching

* add lint check

* add lint check

* rearrange steps

* rearrange steps and generify CI job for any component

* rearrange steps and generify CI job for any component

* add MANDATORY_REVIEWERS
  • Loading branch information
Abdurrahman Allawala authored and edma2 committed Aug 14, 2024
1 parent 23d56ed commit 1be78ec
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 1 deletion.
1 change: 1 addition & 0 deletions MANDATORY_REVIEWERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
third-party/observability
2 changes: 1 addition & 1 deletion Makefile.Common
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ fmt: $(GOIMPORTS)
$(GOIMPORTS) -w -local github.com/open-telemetry/opentelemetry-collector-contrib ./

.PHONY: lint
lint: $(LINT) checklicense misspell
lint: $(LINT) misspell
$(LINT) run --allow-parallel-runners --verbose --build-tags integration --timeout=30m --path-prefix $(shell basename "$(CURDIR)")

.PHONY: govulncheck
Expand Down
27 changes: 27 additions & 0 deletions _infra/ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This Dockerfile describes the container in which to run your CI jobs.
# You can install whatever dependencies you'd like in this Dockerfile,
# and you can even define more Dockerfiles if you have multiple jobs
# that need to run in different environments!
#
# By default, CI Dockerfiles are built with an empty build context. You
# can configure a custom build context in your job.
#
# Questions? Visit air.bb/ci-docs or ask a question on Stack Overflow with
# the tag #continuous-integration.

FROM 172631448019.dkr.ecr.us-east-1.amazonaws.com/ubuntu1804:2024-01-09-5ed90b7b

######### install go
ARG GO_VERSION=1.20.13
RUN /jorb/scripts/install-go.sh ${GO_VERSION}
#########

# Set up Gopath for caching
WORKDIR /go
ENV GOPATH=/go
ENV GOMAXTHREADS=3
ENV PATH="/usr/local/go/bin:$GOPATH/bin:$PATH"
ENV GO=go

# Delete forward-udp to enable statsd_receiver testing
RUN rm -f /usr/local/bin/forward-udp
16 changes: 16 additions & 0 deletions _infra/ci/dispatch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
# Generated by: onetouch-gen v1.26.3 (titanic: e28693593a57d500d94cdd97ceddff82c776522a)

# This file configures your CI jobs to run when you push your branch.
# In this file, you can define build matrices, dependencies between
# jobs, resource requests, timeouts, parallelism, and more!
#
# Questions? Visit air.bb/ci-docs or ask a question on Stack Overflow with
# the tag #continuous-integration.

jobs:
- name: receiver/statsdreceiver CI Check
path: _infra/ci/jobs/component_ci.yml
options:
env:
COMPONENT_PATH: "receiver/statsdreceiver"
59 changes: 59 additions & 0 deletions _infra/ci/jobs/component_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
# Generated by: onetouch-gen v1.26.3 (titanic: e28693593a57d500d94cdd97ceddff82c776522a)

# This is a simple CI job. A CI job comprises a list of steps that run
# sequentially in a container described by an image or a Dockerfile.
#
# Questions? Visit air.bb/ci-docs or ask a question on Stack Overflow with
# the tag #continuous-integration.

dockerfile: ../Dockerfile

steps:
# start: environment setup #
- type: restore_cache
label: Restore cache
cache_key: go-image-{% image_id %}-go-sum-{% checksum files=[go.sum] %}

- type: run
label: make moddownload
command: |
set -ex
sudo mkdir -p "$GOPATH"
sudo chmod -R ugo+rwX "$GOPATH"
cd $COMPONENT_PATH
make moddownload
- type: run
label: make install-tools
command: make install-tools

- type: save_cache
label: Save cache
cache_key: go-image-{% image_id %}-go-sum-{% checksum files=[go.sum] %}
paths:
- /go
# end: environment setup #

# start: go mod tidy, unit tests, and lint #
- type: run
label: Check for go mod dependency changes
command: |
cd $COMPONENT_PATH
make tidy
git diff --exit-code || (echo 'go.mod/go.sum deps changes detected, please run "make gotidy" and commit the changes in this PR.' && exit 1)
- type: run
label: make test
command: |
cd $COMPONENT_PATH
make test
- type: run
label: make lint
command: |
cd $COMPONENT_PATH
make lint
# end: go mod tidy, unit tests, and lint #
11 changes: 11 additions & 0 deletions _infra/project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
# Generated by: onetouch-gen v1.26.3 (titanic: e28693593a57d500d94cdd97ceddff82c776522a)
name: opentelemetry-collector-contrib
description: An Airbnb-specific fork of the opentelemetry-collector-contrib repo
slack: observability
teams:
- 'Airbnb Platform: Infrastructure: Data Platform: Observability'
data_sensitivity: public
additional_owners: []
type: library
primary_language: golang

0 comments on commit 1be78ec

Please sign in to comment.